/** * INTERNAL: * May override this method if the platform support temporary tables. * @parameter DatabaseTable table is original table for which temp table is created. * @return DatabaseTable temorary table */ public DatabaseTable getTempTableForTable(DatabaseTable table) { return new DatabaseTable("TL_" + table.getName(), table.getTableQualifier(), table.shouldUseDelimiters(), getStartDelimiter(), getEndDelimiter()); }
public void onConnect() { if(this.table.getName().length() == 0) { this.table.setName(((DatabasePlatform)getDatasourcePlatform()).getDefaultSequenceTableName()); } if ((this.qualifier == null || this.qualifier.length() == 0) && (this.table.getTableQualifier() != null && this.table.getTableQualifier().length() != 0)) { this.qualifier = this.table.getTableQualifier(); } super.onConnect(); }
/** * Constructs a new database table which appears as <code>guise</code> but * in fact really is <code>identity</code>. */ public HistoricalDatabaseTable(DatabaseTable source, DatabaseTable mirroring, DatasourcePlatform platform) { super(source.getName(), source.getTableQualifier()); this.historicalName = mirroring.getQualifiedName(); if(mirroring.shouldUseDelimiters()) { this.historicalNameDelimited = mirroring.getQualifiedNameDelimited(platform); } }
@Override public final DatabaseTable getTempTableForTable(final DatabaseTable table) { return new DatabaseTable("$" + table.getName(), "TEMP"); }
/** * Determine whether the receiver has any identification information. * Return true if the name or qualifier of the receiver are nonempty. */ public boolean hasName() { if ((getName().length() == 0) && (getTableQualifier().length() == 0)) { return false; } return true; }
/** * Build a table definition object from a database table object */ protected TableDefinition getTableDefFromDBTable(DatabaseTable databaseTable) { TableDefinition tableDefinition = this.tableMap.get(databaseTable.getName()); if (tableDefinition == null) { //table not built yet, simply built it tableDefinition = new TableDefinition(); tableDefinition.setTable(databaseTable); tableDefinition.setName(databaseTable.getNameDelimited(databasePlatform)); tableDefinition.setQualifier(databaseTable.getTableQualifier()); if (databaseTable.hasUniqueConstraints()) { addUniqueKeyConstraints(tableDefinition, databaseTable.getUniqueConstraints()); } if (databaseTable.hasIndexes()) { tableDefinition.getIndexes().addAll(databaseTable.getIndexes()); } if (databaseTable.getCreationSuffix() !=null){ tableDefinition.setCreationSuffix(databaseTable.getCreationSuffix()); } // Add the foreign key constraints that were set on the table. if (databaseTable.hasForeignKeyConstraints()) { tableDefinition.setUserDefinedForeignKeyConstraints(databaseTable.getForeignKeyConstraints()); } tableMap.put(databaseTable.getName(), tableDefinition); } return tableDefinition; }
/** * Build a table definition object from a database table object */ private TableDefinition getTableDefFromDBTable(DatabaseTable dbTbl) { TableDefinition tblDef = this.tableMap.get(dbTbl.getName()); if (tblDef == null) { //table not built yet, simply built it tblDef = new TableDefinition(); tblDef.setName(dbTbl.getNameDelimited(databasePlatform)); tblDef.setQualifier(dbTbl.getTableQualifier()); addUniqueKeyConstraints(tblDef, dbTbl.getUniqueConstraints()); tableMap.put(dbTbl.getName(), tblDef); } return tblDef; }
/** * Reset the field's name and table from the qualified name. */ public void resetQualifiedName(String qualifiedName) { setIndex(-1); int index = qualifiedName.lastIndexOf('.'); if (index == -1) { setName(qualifiedName); getTable().setName(""); getTable().setTableQualifier(""); } else { setName(qualifiedName.substring(index + 1, qualifiedName.length())); getTable().setPossiblyQualifiedName(qualifiedName.substring(0, index)); } }
tableName = getBuilder().aliasForTable(defaultTable).getName(); } else { tableName = defaultTable.getNameDelimited(printer.getPlatform());
/** * INTERNAL: * This method will update the table by cloning it and setting a new name * on it. The table association will be stored here as well for ease of * future look up. */ protected DatabaseTable updateTable(DatabaseTable table) { DatabaseTable tableClone = table.clone(); tablePerTenantTables.put(table, tableClone); tableClone.setName(getTableName(tableClone, contextTenant)); return tableClone; }
/** * Return the hashcode of the name, because it is fairly unique. */ public int hashCode() { return getName().hashCode(); }
public NestedTable(QueryKeyExpression queryKeyExpression) { super(); this.queryKeyExpression = queryKeyExpression; setName((queryKeyExpression.getMapping().getDescriptor().getTables().firstElement()).getName()); tableQualifier = (queryKeyExpression.getMapping().getDescriptor().getTables().firstElement()).getQualifiedName(); }
/** * This method will set the table name regardless if the name has * a qualifier. Used when aliasing table names. * * If the name contains database delimiters, they will be stripped and a flag will be set to have them * added when the DatabaseTable is written to SQL * * @param name */ public void setName(String name) { setName(name, null, null); }
/** * PUBLIC: * Return the relation table qualified name associated with the mapping. */ public String getRelationTableQualifiedName() { if (relationTable == null) { return null; } return relationTable.getQualifiedName(); }
protected static void writeUniqueFieldName(Writer writer, DatabaseField field, DatasourcePlatform platform) throws IOException { // EMPLOYEE_EMP_ID writer.write(field.getTable().getNameDelimited(platform)); writer.write("_"); writer.write(field.getNameDelimited(platform)); }
/** * PUBLIC: * Set the name of the relational table. * This is the join table that store both the source and target primary keys. */ public void setRelationTableName(String tableName) { relationTable = new DatabaseTable(tableName); }
private int lookupValueIndexOf(DatabaseTable table) { for (int i = 0; i < lastUsed; i++) { if (values[i].equals(table)) { return i; } } return -1; }
/** * INTERNAL: DB2 allows LIKE to be used to create temp tables, which avoids having to know the types. * This is used by UpdateAllQuerys. */ @Override protected String getCreateTempTableSqlBodyForTable(DatabaseTable table) { return " LIKE " + table.getQualifiedNameDelimited(this); }
/** * Add an index definition to this table. */ public void addIndex(IndexDefinition index) { getIndexes().add(index); }