public String toString() { StringBuilder buf = new StringBuilder().append( getClass().getName() ) .append( '(' ); if ( getCatalog() != null ) { buf.append( getCatalog() ).append( "." ); } if ( getSchema() != null ) { buf.append( getSchema() ).append( "." ); } buf.append( getName() ).append( ')' ); return buf.toString(); }
protected String getCatalog(String catalogFromAnnotation, Table table) { // Get the catalog from the annotation ... String catalog = catalogFromAnnotation; // ... if empty, try using the default ... if ( StringTools.isEmpty( catalog ) ) { catalog = globalCfg.getDefaultCatalogName(); // ... if still empty, use the same as the normal table. if ( StringTools.isEmpty( catalog ) ) { catalog = table.getCatalog(); } } return catalog; }
), annotations, table.getCatalog(), table.getSchema(), table.getName(),
@Override public String[] getSqlDropStrings(Table table, Metadata metadata) { StringBuilder buf = new StringBuilder( "drop table " ); if ( dialect.supportsIfExistsBeforeTableName() ) { buf.append( "if exists " ); } final QualifiedName tableName = new QualifiedNameParser.NameParts( Identifier.toIdentifier( table.getCatalog(), table.isCatalogQuoted() ), Identifier.toIdentifier( table.getSchema(), table.isSchemaQuoted() ), table.getNameIdentifier() ); final JdbcEnvironment jdbcEnvironment = metadata.getDatabase().getJdbcEnvironment(); buf.append( jdbcEnvironment.getQualifiedObjectNameFormatter().format( tableName, jdbcEnvironment.getDialect() ) ) .append( dialect.getCascadeConstraintsString() ); if ( dialect.supportsIfExistsAfterTableName() ) { buf.append( " if exists" ); } return new String[] { buf.toString() }; } }
@Override public String[] getSqlCreateStrings(Table table, Metadata metadata) { final QualifiedName tableName = new QualifiedNameParser.NameParts( Identifier.toIdentifier( table.getCatalog(), table.isCatalogQuoted() ), Identifier.toIdentifier( table.getSchema(), table.isSchemaQuoted() ), table.getNameIdentifier()
@Override public void addSecondaryTable(QualifiedTableName logicalQualifiedTableName, Join secondaryTableJoin) { Identifier logicalName = logicalQualifiedTableName.getTableName(); if ( Identifier.areEqual( Identifier.toIdentifier( new QualifiedTableName( Identifier.toIdentifier( primaryTable.getCatalog() ), Identifier.toIdentifier( primaryTable.getSchema() ), primaryTableLogicalName ).render() ), Identifier.toIdentifier( logicalQualifiedTableName.render() ) ) ) { throw new DuplicateSecondaryTableException( logicalName ); } if ( secondaryTableJoinMap == null ) { //secondaryTableJoinMap = new HashMap<Identifier,Join>(); //secondaryTableJoinMap.put( logicalName, secondaryTableJoin ); secondaryTableJoinMap = new HashMap<>(); secondaryTableJoinMap.put( logicalName.getCanonicalName(), secondaryTableJoin ); } else { //final Join existing = secondaryTableJoinMap.put( logicalName, secondaryTableJoin ); final Join existing = secondaryTableJoinMap.put( logicalName.getCanonicalName(), secondaryTableJoin ); if ( existing != null ) { throw new DuplicateSecondaryTableException( logicalName ); } } }
String schema = columns[0].getTable().getSchema(); schema = schema == null ? "" : schema; String catalog = columns[0].getTable().getCatalog(); catalog = catalog == null ? "" : catalog; typeParameters.setProperty( EnumType.SCHEMA, schema );
public String toString() { StringBuilder buf = new StringBuilder().append( getClass().getName() ) .append( '(' ); if ( getCatalog() != null ) { buf.append( getCatalog() ).append( "." ); } if ( getSchema() != null ) { buf.append( getSchema() ).append( "." ); } buf.append( getName() ).append( ')' ); return buf.toString(); }
public String toString() { StringBuffer buf = new StringBuffer().append( getClass().getName() ) .append('('); if ( getCatalog()!=null ) buf.append( getCatalog() + "." ); if ( getSchema()!=null ) buf.append( getSchema()+ "."); buf.append( getName() ).append(')'); return buf.toString(); }
public String toString() { StringBuffer buf = new StringBuffer().append( getClass().getName() ) .append( '(' ); if ( getCatalog() != null ) { buf.append( getCatalog() + "." ); } if ( getSchema() != null ) { buf.append( getSchema() + "." ); } buf.append( getName() ).append( ')' ); return buf.toString(); }
public String toString() { StringBuffer buf = new StringBuffer().append( getClass().getName() ) .append( '(' ); if ( getCatalog() != null ) { buf.append( getCatalog() + "." ); } if ( getSchema() != null ) { buf.append( getSchema() + "." ); } buf.append( getName() ).append( ')' ); return buf.toString(); }
private static boolean equalTable( Table table1, Table table2, String defaultSchema, String defaultCatalog) { return table1.getName().equals(table2.getName()) && ( equal( getSchemaForModel(table1.getSchema(), defaultSchema), getSchemaForModel(table2.getSchema(), defaultSchema)) && ( equal( getCatalogForModel(table1.getCatalog(), defaultCatalog), getCatalogForModel(table2.getCatalog(), defaultCatalog)))); }
private static boolean equalTable( Table table1, Table table2, String defaultSchema, String defaultCatalog) { return table1.getName().equals(table2.getName()) && ( equal( getSchemaForModel(table1.getSchema(), defaultSchema), getSchemaForModel(table2.getSchema(), defaultSchema)) && ( equal( getCatalogForModel(table1.getCatalog(), defaultCatalog), getCatalogForModel(table2.getCatalog(), defaultCatalog)))); }
public static TableIdentifier createTableIdentifier( Table table, String defaultCatalog, String defaultSchema) { String tableName = table.getName(); String tableCatalog = getCatalogForModel(table.getCatalog(), defaultCatalog); String tableSchema = getSchemaForModel(table.getSchema(), defaultSchema); return new TableIdentifier(tableCatalog, tableSchema, tableName); }
private void setSchemaSelection(Table table) { tableSelector.clearSchemaSelections(); tableSelector.addSchemaSelection( new SchemaSelection( table .getCatalog(), table.getSchema(), table.getName() ) ); }
private void setSchemaSelection(Table table) { tableSelector.clearSchemaSelections(); tableSelector.addSchemaSelection( new SchemaSelection( table .getCatalog(), table.getSchema(), table.getName() ) ); }
public static TableIdentifier createTableIdentifier( Table table, String defaultCatalog, String defaultSchema) { String tableName = table.getName(); String tableCatalog = getCatalogForModel(table.getCatalog(), defaultCatalog); String tableSchema = getSchemaForModel(table.getSchema(), defaultSchema); return new TableIdentifier(tableCatalog, tableSchema, tableName); }
public Table getTable(String schema, String catalog, String name) { for (Table table : metadataCollector.collectTableMappings()) { if (equalOrBothNull(schema, table.getSchema()) && equalOrBothNull(catalog, table.getCatalog()) && equalOrBothNull(name, table.getName())) { return table; } } return null; }
public Table getTable(String schema, String catalog, String name) { for (Table table : metadataCollector.collectTableMappings()) { if (equalOrBothNull(schema, table.getSchema()) && equalOrBothNull(catalog, table.getCatalog()) && equalOrBothNull(name, table.getName())) { return table; } } return null; }
private TableMetadata getTableMetadata(Connection connection, Table table) throws SQLException { String tableSchema = table.getSchema(); if (tableSchema == null) tableSchema = getDefaultSchema(); String tableCatalog = table.getCatalog(); if (tableCatalog == null) tableCatalog = getDefaultCatalog(); return getDatabaseMetadata(connection) .getTableMetadata(table.getName(), tableSchema, tableCatalog, table.isQuoted()); }