@Override public final Table<Record> getTable() { if (table == null) table = name.qualified() ? DSL.table(name.qualifier()) : null; return table; } }
private final Name generatedName() { Name t = table.getQualifiedName(); StringBuilder sb = new StringBuilder(table.getName()); for (SortField<?> f : sortFields) sb.append('_').append(f.getName()); sb.append("_idx"); if (t.qualified()) return t.qualifier().append(sb.toString()); else return name(sb.toString()); }
@Override public /* non-final */ Catalog getCatalog() { if (catalog == null) catalog = getQualifiedName().qualified() ? DSL.catalog(getQualifiedName().qualifier()) : null; return catalog; }
@Override public /* non-final */ Schema getSchema() { if (tableschema == null) tableschema = getQualifiedName().qualified() ? DSL.schema(getQualifiedName().qualifier()) : null; return tableschema; }
@Override public final Schema getSchema() { if (schema == null) schema = getQualifiedName().qualified() ? DSL.schema(getQualifiedName().qualifier()) : null; return schema; }
private static final Field<?> parseFieldNameOrSequenceExpression(ParserContext ctx) { Name name = parseName(ctx); if (name.qualified()) { String last = name.last(); if ("NEXTVAL".equalsIgnoreCase(last)) return sequence(name.qualifier()).nextval(); else if ("CURRVAL".equalsIgnoreCase(last)) return sequence(name.qualifier()).currval(); } if (ctx.dsl.settings().getParseUnknownFunctions() == ParseUnknownFunctions.IGNORE && parseIf(ctx, '(')) { List<Field<?>> arguments = new ArrayList<Field<?>>(); if (!parseIf(ctx, ')')) { do { arguments.add(parseField(ctx)); } while (parseIf(ctx, ',')); parse(ctx, ')'); } return function(name, Object.class, arguments.toArray(EMPTY_FIELD)); } else { return field(name); } }
private static final Query parseExec(ParserContext ctx) { parseKeyword(ctx, "EXEC"); if (parseKeywordIf(ctx, "SP_RENAME")) { if (parseKeywordIf(ctx, "@OBJNAME")) parse(ctx, '='); Name oldName = ctx.dsl.parser().parseName(parseStringLiteral(ctx)); parse(ctx, ','); if (parseKeywordIf(ctx, "@NEWNAME")) parse(ctx, '='); Name newName = ctx.dsl.parser().parseName(parseStringLiteral(ctx)); String objectType = "TABLE"; if (parseIf(ctx, ',')) { if (parseKeywordIf(ctx, "@OBJTYPE")) parse(ctx, '='); if (!parseKeywordIf(ctx, "NULL")) objectType = parseStringLiteral(ctx); } if ("TABLE".equalsIgnoreCase(objectType)) return ctx.dsl.alterTable(oldName).renameTo(newName.unqualifiedName()); else if ("INDEX".equalsIgnoreCase(objectType)) return ctx.dsl.alterIndex(oldName).renameTo(newName.unqualifiedName()); else if ("COLUMN".equalsIgnoreCase(objectType)) return ctx.dsl.alterTable(oldName.qualifier()).renameColumn(oldName.unqualifiedName()).to(newName.unqualifiedName()); else throw ctx.exception("Unsupported object type: " + objectType); } else { throw ctx.unsupportedClause(); } }