public JDBCTableDefinition(SchemaDefinition schema, Table<?> table) { super(schema, table.getName(), ""); this.table = table; }
int endIndex = partialSql.lastIndexOf(')'); String fullSql = partialSql.substring(0, endIndex) + "," + " CONSTRAINT pk_" + kvs.METADATA_TABLE.getName() + " PRIMARY KEY (" + TABLE_NAME.getName() + ")" + partialSql.substring(endIndex);
@Override public final Table<?> getTable(String name) { for (Table<?> table : getTables()) { if (table.getName().equals(name)) { return table; } } return null; }
/** * Add tables to this mapping * * @param inputTable The table known at codegen time to be mapped * @param outputTable The table configured at run time to be mapped */ public void add(Table<?> inputTable, Table<?> outputTable) { add(inputTable, outputTable.getName()); }
private final String tableName(Field<?> field) { if (field instanceof TableField) { Table<?> table = ((TableField<?, ?>) field).getTable(); if (table != null) { return table.getName(); } } return null; }
@Override public final Table<?> getTable(String tableName) { for (Table<?> table : getTables()) if (table.getName().equals(tableName)) return table; return null; }
/** * Add tables to this mapping * * @param inputTable The table known at codegen time to be mapped * @param outputTable The table configured at run time to be mapped */ public void add(Table<?> inputTable, Table<?> outputTable) { add(inputTable, outputTable.getName()); }
/** * Optimizes the performance of the database for some table. * On postgres this translates to vacuum analyze. * On h2 it does nothing. */ public void optimize(Table table) throws DaoException { optimize(table.getName()); }
Lateral(Table<R> table) { super(table.getName(), table.getSchema()); this.table = table; }
public void update() { tables = new LinkedHashMap<>(); cachedTables = new LinkedHashMap<>(); for (Table<?> table : dsl.meta().getTables()) { if (!(table.toString().startsWith(tablePrefix))) { // table not in current catalog or schema continue; } tables.put(table.getName(), table); } }
private static String getQualifiedName(Table<?> table) { StringBuilder sb = new StringBuilder(); if (table.getSchema() != null) { sb.append(table.getSchema().getName()); sb.append("."); } sb.append(table.getName()); return sb.toString(); } }
CountTable(Table<?> table, boolean distinct) { super("count", distinct, SQLDataType.INTEGER, DSL.field("{0}", DSL.name(table.getName()))); this.table = table; this.distinct = distinct; }
/** * Render a list of names of the <code>NamedQueryParts</code> contained in * this list. */ static final void tableNames(RenderContext context, Collection<? extends Table<?>> list) { String separator = ""; for (Table<?> table : list) { context.sql(separator).literal(table.getName()); separator = ", "; } }
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()); }
private String findForeignKeyReference(ForeignKey<?, ?> fk) { UniqueKey<?> pk = fk.getKey(); if (pk != null) { Field<?>[] pks = pk.getFieldsArray(); if (pks.length == 1) { return pk.getTable().getName(); } } return null; }
@Override public String getTableName(int column) throws SQLException { rs.checkNotClosed(); Field<?> field = rs.result.field(column - 1); if (field instanceof TableField) { Table<?> table = ((TableField<?, ?>) field).getTable(); if (table != null) { return table.getName(); } } // By default, no table is available return ""; }
public boolean isSemanticallyEquals(Table<Record> table) { if (!table.getName().equals(getName())) { return false; } if (table.getSchema() == null || !getSchema().getName().equals(table.getSchema().getName())) { return false; } if (table.fields().length != 7) { return false; } return true; //TODO: improve the check }
private SqlSubJoin(SqlQuery parent, SqlQuery sub, SqlJoin join) { this.sqlQuery = sub; AbstractSqlDatabase database = sub.database; String alias = sub.recordTableAlias; Field<?> id = DSL.field(DSL.name(alias, database.recordIdField.getName()), database.uuidType()); this.table = sub.initialize(DSL.table(DSL.name(database.recordTable.getName())).as(alias)); this.on = join.valueField.eq(id); if (sub.needsDistinct) { parent.needsDistinct = true; } } }
/** * Returns an SQL statement that can be used to get when the rows * matching the query were last updated. */ public String lastUpdateStatement() { Table<?> table = initialize(DSL.table(DSL.name(database.recordUpdateTable.getName())).as(recordTableAlias)); return tableRenderContext.render(dslContext .select(DSL.field(DSL.name(recordTableAlias, database.recordUpdateDateField.getName())).max()) .from(table) .where(whereCondition)); }