Interface DBIdentifierUtil
- All Superinterfaces:
IdentifierUtil
- All Known Implementing Classes:
DBIdentifierUtilImpl
An interface for DB identifier utility-style operations. This interface
extends the basic operations provided by IdentifierUtil with additional
operations those specific to DBIdentifiers and identifier conversion.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
Fields inherited from interface org.apache.openjpa.lib.identifier.IdentifierUtil
BAR, CASE_LOWER, CASE_PRESERVE, CASE_UPPER, DOLLAR_CHAR, DOT, DOUBLE_QUOTE, EMPTY, PERCENT, SPACE, UNDERSCORE, UNDERSCORE_CHAR
-
Method Summary
Modifier and TypeMethodDescriptionappend
(DBIdentifier.DBIdentifierType resultId, DBIdentifier... names) Appends multiple names together using the appropriate name delimiter.appendColumns
(Column[] columns) Appends multiple columns names together into comma delimited string.convertAlias
(String alias) Converts a provided alias to a format specified in the configuration.convertSchemaCase
(DBIdentifier schema) Converts the name of the specified delimiter to the appropriate case as defined by the configuration.fromDBName
(String name, DBIdentifier.DBIdentifierType id) Converts the name returned by the database to an identifier of the specified type.getGeneratedKeySequenceName
(Column col, int maxLen) Returns a generated key sequence identifier for the column.getValidColumnIdentifier
(DBIdentifier name, Table table, int maxLen, boolean checkForUniqueness) Returns a valid column name/identifier, based upon the configuration and provided parameters.getValidForeignKeyIdentifier
(DBIdentifier name, Table table, Table toTable, int maxLen) Returns a valid foreign key identifier, based upon the configuration and provided parameters.getValidIndexIdentifier
(DBIdentifier name, Table table, int maxLen) Returns a valid index identifier, based upon the configuration and provided parameters.getValidSequenceIdentifier
(DBIdentifier name, Schema schema, int maxLen) Returns a valid index identifier, based upon the configuration and provided parameters.getValidTableIdentifier
(DBIdentifier name, Schema schema, int maxLen) Returns a valid table identifier, based upon the configuration and provided parameters.getValidUniqueIdentifier
(DBIdentifier name, Table table, int maxLen) Returns a valid unique constraint identifier, based upon the configuration and provided parameters.makeIdentifierValid
(DBIdentifier sname, NameSet set, int maxLen, boolean checkForUniqueness) Shortens the given name to the given maximum length, then checks that it is not a reserved word.makeNameValid
(String name, NameSet set, int maxLen, int nameType, boolean checkForUniqueness) Shortens the given name to the given maximum length, then checks that it is not a reserved word.Converts the specified string to a format required by the database.Converts the specified string to a format required by the database, optionally delimiting the name.toDBName
(DBIdentifier name) Converts the specified identifier to a format required by the database.toDBName
(DBIdentifier name, boolean delimit) Converts the specified identifier to a format required by the database, optionally delimiting the name.Methods inherited from interface org.apache.openjpa.lib.identifier.IdentifierUtil
appendNames, appendNames, canSplit, canSplit, canSplit, canSplit, combineNames, combineNames, combineNames, combineNames, combineNames, combineNames, convert, convertFull, delimit, delimit, delimit, delimit, getIdentifierConfiguration, isDelimited, isDelimited, isReservedWord, isReservedWord, joinNames, joinNames, joinNames, joinNames, joinNames, joinNames, removeDelimiters, removeDelimiters, removeDelimiters, removeHungarianNotation, removeHungarianNotation, requiresDelimiters, requiresDelimiters, setIdentifierConfiguration, splitName, splitName, splitName, splitName, truncateName, truncateName
-
Field Details
-
ANY
static final int ANY- See Also:
-
TABLE
static final int TABLE- See Also:
-
SEQUENCE
static final int SEQUENCE- See Also:
-
COLUMN
static final int COLUMN- See Also:
-
-
Method Details
-
makeIdentifierValid
DBIdentifier makeIdentifierValid(DBIdentifier sname, NameSet set, int maxLen, boolean checkForUniqueness) Shortens the given name to the given maximum length, then checks that it is not a reserved word. If it is reserved, appends a "0". If the name conflicts with an existing schema component and uniqueness checking is enabled, the last character is replace with '0', then '1', etc. Note that the given max len may be 0 if the database metadata is incomplete. Note: If the name is delimited, make sure the ending delimiter is not stripped off. -
makeNameValid
DBIdentifier makeNameValid(String name, NameSet set, int maxLen, int nameType, boolean checkForUniqueness) Shortens the given name to the given maximum length, then checks that it is not a reserved word. If it is reserved, appends a "0". If the name conflicts with an existing schema component and uniqueness checking is enabled, the last character is replace with '0', then '1', etc. Note that the given max len may be 0 if the database metadata is incomplete. Note: If the name is delimited, make sure the ending delimiter is not stripped off. -
getValidColumnIdentifier
DBIdentifier getValidColumnIdentifier(DBIdentifier name, Table table, int maxLen, boolean checkForUniqueness) Returns a valid column name/identifier, based upon the configuration and provided parameters.- Parameters:
name
-table
-maxLen
-checkForUniqueness
-
-
getValidIndexIdentifier
Returns a valid index identifier, based upon the configuration and provided parameters.- Parameters:
name
-table
-maxLen
-checkForUniqueness
-
-
getValidSequenceIdentifier
Returns a valid index identifier, based upon the configuration and provided parameters.- Parameters:
name
-table
-maxLen
-checkForUniqueness
-
-
getValidTableIdentifier
Returns a valid table identifier, based upon the configuration and provided parameters.- Parameters:
name
-schema
-maxLen
-
-
getValidUniqueIdentifier
Returns a valid unique constraint identifier, based upon the configuration and provided parameters.- Parameters:
name
-table
-maxLen
-
-
getValidForeignKeyIdentifier
DBIdentifier getValidForeignKeyIdentifier(DBIdentifier name, Table table, Table toTable, int maxLen) Returns a valid foreign key identifier, based upon the configuration and provided parameters.- Parameters:
name
-table
-toTable
-maxLen
-
-
toDBName
Converts the specified identifier to a format required by the database.- Parameters:
name
-
-
toDBName
Converts the specified identifier to a format required by the database, optionally delimiting the name.- Parameters:
name
-delimit
-
-
toDBName
Converts the specified string to a format required by the database.- Parameters:
name
-
-
toDBName
Converts the specified string to a format required by the database, optionally delimiting the name.- Parameters:
name
-
-
fromDBName
Converts the name returned by the database to an identifier of the specified type.- Parameters:
name
-
-
appendColumns
Appends multiple columns names together into comma delimited string.- Parameters:
columns
-
-
convertSchemaCase
Converts the name of the specified delimiter to the appropriate case as defined by the configuration.- Parameters:
columns
-
-
append
Appends multiple names together using the appropriate name delimiter.- Parameters:
resultId
-names
-
-
getGeneratedKeySequenceName
Returns a generated key sequence identifier for the column.- Parameters:
col
-maxLen
-
-
convertAlias
Converts a provided alias to a format specified in the configuration.- Parameters:
alias
-
-