/** * Returns the table name that will be used for obtaining information * from {@link DatabaseMetaData}. */ protected String getTableNameForMetadata(DBIdentifier tableName) { return convertSchemaCase(tableName.getUnqualifiedName()); }
/** * Returns the table name that will be used for obtaining information * from {@link DatabaseMetaData}. */ protected String getTableNameForMetadata(DBIdentifier tableName) { return convertSchemaCase(tableName.getUnqualifiedName()); }
/** * Returns the table name that will be used for obtaining information * from {@link DatabaseMetaData}. */ protected String getTableNameForMetadata(DBIdentifier tableName) { return convertSchemaCase(tableName.getUnqualifiedName()); }
/** * Returns the table name that will be used for obtaining information * from {@link DatabaseMetaData}. */ protected String getTableNameForMetadata(DBIdentifier tableName) { return convertSchemaCase(tableName.getUnqualifiedName()); }
/** * Return a series of SQL statements to create the given index. Returns * <code>CREATE [UNIQUE] INDEX <index name> ON <table name> * (<col list>)</code> by default. */ public String[] getCreateIndexSQL(Index index) { StringBuilder buf = new StringBuilder(); buf.append("CREATE "); if (index.isUnique()) buf.append("UNIQUE "); DBIdentifier fullIdxName = index.getIdentifier(); DBIdentifier unQualifiedName = fullIdxName.getUnqualifiedName(); checkNameLength(toDBName(unQualifiedName), maxIndexNameLength, "long-index-name"); String indexName = toDBName(fullIdxName); buf.append("INDEX ").append(indexName); buf.append(" ON ").append(getFullName(index.getTable(), false)); buf.append(" (").append(namingUtil.appendColumns(index.getColumns())). append(")"); return new String[]{ buf.toString() }; }
/** * Return a series of SQL statements to create the given index. Returns * <code>CREATE [UNIQUE] INDEX <index name> ON <table name> * (<col list>)</code> by default. */ public String[] getCreateIndexSQL(Index index) { StringBuilder buf = new StringBuilder(); buf.append("CREATE "); if (index.isUnique()) buf.append("UNIQUE "); DBIdentifier fullIdxName = index.getIdentifier(); DBIdentifier unQualifiedName = fullIdxName.getUnqualifiedName(); checkNameLength(toDBName(unQualifiedName), maxIndexNameLength, "long-index-name"); String indexName = toDBName(fullIdxName); buf.append("INDEX ").append(indexName); buf.append(" ON ").append(getFullName(index.getTable(), false)); buf.append(" (").append(namingUtil.appendColumns(index.getColumns())). append(")"); return new String[]{ buf.toString() }; }
/** * Return a series of SQL statements to create the given index. Returns * <code>CREATE [UNIQUE] INDEX <index name> ON <table name> * (<col list>)</code> by default. */ public String[] getCreateIndexSQL(Index index) { StringBuilder buf = new StringBuilder(); buf.append("CREATE "); if (index.isUnique()) buf.append("UNIQUE "); DBIdentifier fullIdxName = index.getIdentifier(); DBIdentifier unQualifiedName = fullIdxName.getUnqualifiedName(); checkNameLength(toDBName(unQualifiedName), maxIndexNameLength, "long-index-name"); String indexName = toDBName(fullIdxName); buf.append("INDEX ").append(indexName); buf.append(" ON ").append(getFullName(index.getTable(), false)); buf.append(" (").append(namingUtil.appendColumns(index.getColumns())). append(")"); return new String[]{ buf.toString() }; }
/** * Return a series of SQL statements to create the given index. Returns * <code>CREATE [UNIQUE] INDEX <index name> ON <table name> * (<col list>)</code> by default. */ public String[] getCreateIndexSQL(Index index) { StringBuilder buf = new StringBuilder(); buf.append("CREATE "); if (index.isUnique()) buf.append("UNIQUE "); DBIdentifier fullIdxName = index.getIdentifier(); DBIdentifier unQualifiedName = fullIdxName.getUnqualifiedName(); checkNameLength(toDBName(unQualifiedName), maxIndexNameLength, "long-index-name"); String indexName = toDBName(fullIdxName); buf.append("INDEX ").append(indexName); buf.append(" ON ").append(getFullName(index.getTable(), false)); buf.append(" (").append(namingUtil.appendColumns(index.getColumns())). append(")"); return new String[]{ buf.toString() }; }
/** * Validate that the given name is not longer than given maximum length. Conditionally uses the unqualified name * from the supplied {@link DBIdentifier}. * * @param identifer The database identifier to check. * @param length Max length for this type of identifier * @param msgKey message identifier for the exception. * @param qualified If true the qualified name of the DBIdentifier will be used. * * @throws {@link UserException} with the given message key if the given name is indeed longer. * @return the same name. */ final String checkNameLength(DBIdentifier identifier, int length, String msgKey, boolean qualified) { // always return the input name, String name = toDBName(identifier); String compareName = qualified ? name : toDBName(identifier.getUnqualifiedName()); if (compareName.length() > length) { throw new UserException(_loc.get(msgKey, name, name.length(), length)); } return name; }
public Table addTable(DBIdentifier name) { SchemaGroup group = getSchemaGroup(); Table tab; name = name.getUnqualifiedName(); if (group != null) { group.addName(name, true); tab = group.newTable(name, this); } else tab = new Table(name, this); if (_tableMap == null) _tableMap = new TreeMap<DBIdentifier, Table>(); DBIdentifier sName = DBIdentifier.toUpper(name); _tableMap.put(sName, tab); _tables = null; return tab; }
/** * Validate that the given name is not longer than given maximum length. Conditionally uses the unqualified name * from the supplied {@link DBIdentifier}. * * @param identifier The database identifier to check. * @param length Max length for this type of identifier * @param msgKey message identifier for the exception. * @param qualified If true the qualified name of the DBIdentifier will be used. * * @throws {@link UserException} with the given message key if the given name is indeed longer. * @return the same name. */ final String checkNameLength(DBIdentifier identifier, int length, String msgKey, boolean qualified) { // always return the input name, String name = toDBName(identifier); String compareName = qualified ? name : toDBName(identifier.getUnqualifiedName()); if (compareName.length() > length) { throw new UserException(_loc.get(msgKey, name, name.length(), length)); } return name; }
/** * Validate that the given name is not longer than given maximum length. Conditionally uses the unqualified name * from the supplied {@link DBIdentifier}. * * @param identifier The database identifier to check. * @param length Max length for this type of identifier * @param msgKey message identifier for the exception. * @param qualified If true the qualified name of the DBIdentifier will be used. * * @throws {@link UserException} with the given message key if the given name is indeed longer. * @return the same name. */ final String checkNameLength(DBIdentifier identifier, int length, String msgKey, boolean qualified) { // always return the input name, String name = toDBName(identifier); String compareName = qualified ? name : toDBName(identifier.getUnqualifiedName()); if (compareName.length() > length) { throw new UserException(_loc.get(msgKey, name, name.length(), length)); } return name; }
/** * Validate that the given name is not longer than given maximum length. Conditionally uses the unqualified name * from the supplied {@link DBIdentifier}. * * @param identifer The database identifier to check. * @param length Max length for this type of identifier * @param msgKey message identifier for the exception. * @param qualified If true the qualified name of the DBIdentifier will be used. * * @throws {@link UserException} with the given message key if the given name is indeed longer. * @return the same name. */ final String checkNameLength(DBIdentifier identifier, int length, String msgKey, boolean qualified) { // always return the input name, String name = toDBName(identifier); String compareName = qualified ? name : toDBName(identifier.getUnqualifiedName()); if (compareName.length() > length) { throw new UserException(_loc.get(msgKey, name, name.length(), length)); } return name; }
public Table addTable(DBIdentifier name) { SchemaGroup group = getSchemaGroup(); Table tab; name = name.getUnqualifiedName(); if (group != null) { group.addName(name, true); tab = group.newTable(name, this); } else tab = new Table(name, this); if (_tableMap == null) _tableMap = new TreeMap<DBIdentifier, Table>(); DBIdentifier sName = DBIdentifier.toUpper(name); _tableMap.put(sName, tab); _tables = null; return tab; }
public Table addTable(DBIdentifier name) { SchemaGroup group = getSchemaGroup(); Table tab; name = name.getUnqualifiedName(); if (group != null) { group.addName(name, true); tab = group.newTable(name, this); } else tab = new Table(name, this); if (_tableMap == null) _tableMap = new TreeMap<DBIdentifier, Table>(); DBIdentifier sName = DBIdentifier.toUpper(name); _tableMap.put(sName, tab); _tables = null; return tab; }
public Table addTable(DBIdentifier name) { SchemaGroup group = getSchemaGroup(); Table tab; name = name.getUnqualifiedName(); if (group != null) { group.addName(name, true); tab = group.newTable(name, this); } else tab = new Table(name, this); if (_tableMap == null) _tableMap = new TreeMap<DBIdentifier, Table>(); DBIdentifier sName = DBIdentifier.toUpper(name); _tableMap.put(sName, tab); _tables = null; return tab; }
public void createIndexIfNecessary(Schema schema, DBIdentifier table, Column pkColumn) { if (db2ServerType == db2ZOSV8xOrLater) { // build the index for the sequence tables // the index name will be the fully qualified table name + _IDX Table tab = schema.getTable(table); DBIdentifier fullIdxId = tab.getFullIdentifier().clone(); DBIdentifier unQualifiedName = DBIdentifier.append(fullIdxId.getUnqualifiedName(), "IDX"); fullIdxId.setName(getValidIndexName(unQualifiedName, tab)); Index idx = tab.addIndex(fullIdxId); idx.setUnique(true); idx.addColumn(pkColumn); } }
public void createIndexIfNecessary(Schema schema, DBIdentifier table, Column pkColumn) { if (db2ServerType == db2ZOSV8xOrLater) { // build the index for the sequence tables // the index name will be the fully qualified table name + _IDX Table tab = schema.getTable(table); DBIdentifier fullIdxId = tab.getFullIdentifier().clone(); DBIdentifier unQualifiedName = DBIdentifier.append(fullIdxId.getUnqualifiedName(), "IDX"); fullIdxId.setName(getValidIndexName(unQualifiedName, tab)); Index idx = tab.addIndex(fullIdxId); idx.setUnique(true); idx.addColumn(pkColumn); } }
public void createIndexIfNecessary(Schema schema, DBIdentifier table, Column pkColumn) { if (db2ServerType == db2ZOSV8xOrLater) { // build the index for the sequence tables // the index name will be the fully qualified table name + _IDX Table tab = schema.getTable(table); DBIdentifier fullIdxId = tab.getFullIdentifier().clone(); DBIdentifier unQualifiedName = DBIdentifier.append(fullIdxId.getUnqualifiedName(), "IDX"); fullIdxId.setName(getValidIndexName(unQualifiedName, tab)); Index idx = tab.addIndex(fullIdxId); idx.setUnique(true); idx.addColumn(pkColumn); } }
public void createIndexIfNecessary(Schema schema, DBIdentifier table, Column pkColumn) { if (db2ServerType == db2ZOSV8xOrLater) { // build the index for the sequence tables // the index name will be the fully qualified table name + _IDX Table tab = schema.getTable(table); DBIdentifier fullIdxId = tab.getFullIdentifier().clone(); DBIdentifier unQualifiedName = DBIdentifier.append(fullIdxId.getUnqualifiedName(), "IDX"); fullIdxId.setName(getValidIndexName(unQualifiedName, tab)); Index idx = tab.addIndex(fullIdxId); idx.setUnique(true); idx.addColumn(pkColumn); } }