org.apache.openjpa.jdbc.identifier
Interface DBIdentifierUtil

All Superinterfaces:
IdentifierUtil
All Known Implementing Classes:
DBIdentifierUtilImpl

public interface DBIdentifierUtil
extends IdentifierUtil

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
static int ANY
           
static int COLUMN
           
static int SEQUENCE
           
static int TABLE
           
 
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
 DBIdentifier append(DBIdentifier.DBIdentifierType resultId, DBIdentifier... names)
          Appends multiple names together using the appropriate name delimiter.
 String appendColumns(Column[] columns)
          Appends multiple columns names together into comma delimited string.
 String convertAlias(String alias)
          Converts a provided alias to a format specified in the configuration.
 DBIdentifier convertSchemaCase(DBIdentifier schema)
          Converts the name of the specified delimiter to the appropriate case as defined by the configuration.
 DBIdentifier fromDBName(String name, DBIdentifier.DBIdentifierType id)
          Converts the name returned by the database to an identifier of the specified type.
 DBIdentifier getGeneratedKeySequenceName(Column col, int maxLen)
          Returns a generated key sequence identifier for the column.
 DBIdentifier getValidColumnIdentifier(DBIdentifier name, Table table, int maxLen, boolean checkForUniqueness)
          Returns a valid column name/identifier, based upon the configuration and provided parameters.
 DBIdentifier getValidForeignKeyIdentifier(DBIdentifier name, Table table, Table toTable, int maxLen)
          Returns a valid foreign key identifier, based upon the configuration and provided parameters.
 DBIdentifier getValidIndexIdentifier(DBIdentifier name, Table table, int maxLen)
          Returns a valid index identifier, based upon the configuration and provided parameters.
 DBIdentifier getValidSequenceIdentifier(DBIdentifier name, Schema schema, int maxLen)
          Returns a valid index identifier, based upon the configuration and provided parameters.
 DBIdentifier getValidTableIdentifier(DBIdentifier name, Schema schema, int maxLen)
          Returns a valid table identifier, based upon the configuration and provided parameters.
 DBIdentifier getValidUniqueIdentifier(DBIdentifier name, Table table, int maxLen)
          Returns a valid unique constraint identifier, based upon the configuration and provided parameters.
 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.
 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.
 String toDBName(DBIdentifier name)
          Converts the specified identifier to a format required by the database.
 String toDBName(DBIdentifier name, boolean delimit)
          Converts the specified identifier to a format required by the database, optionally delimiting the name.
 String toDBName(String name)
          Converts the specified string to a format required by the database.
 String toDBName(String name, boolean delimit)
          Converts the specified string 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 Detail

ANY

static final int ANY
See Also:
Constant Field Values

TABLE

static final int TABLE
See Also:
Constant Field Values

SEQUENCE

static final int SEQUENCE
See Also:
Constant Field Values

COLUMN

static final int COLUMN
See Also:
Constant Field Values
Method Detail

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 -
Returns:

getValidIndexIdentifier

DBIdentifier getValidIndexIdentifier(DBIdentifier name,
                                     Table table,
                                     int maxLen)
Returns a valid index identifier, based upon the configuration and provided parameters.

Parameters:
name -
table -
maxLen -
checkForUniqueness -
Returns:

getValidSequenceIdentifier

DBIdentifier getValidSequenceIdentifier(DBIdentifier name,
                                        Schema schema,
                                        int maxLen)
Returns a valid index identifier, based upon the configuration and provided parameters.

Parameters:
name -
table -
maxLen -
checkForUniqueness -
Returns:

getValidTableIdentifier

DBIdentifier getValidTableIdentifier(DBIdentifier name,
                                     Schema schema,
                                     int maxLen)
Returns a valid table identifier, based upon the configuration and provided parameters.

Parameters:
name -
schema -
maxLen -
Returns:

getValidUniqueIdentifier

DBIdentifier getValidUniqueIdentifier(DBIdentifier name,
                                      Table table,
                                      int maxLen)
Returns a valid unique constraint identifier, based upon the configuration and provided parameters.

Parameters:
name -
table -
maxLen -
Returns:

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 -
Returns:

toDBName

String toDBName(DBIdentifier name)
Converts the specified identifier to a format required by the database.

Parameters:
name -
Returns:

toDBName

String toDBName(DBIdentifier name,
                boolean delimit)
Converts the specified identifier to a format required by the database, optionally delimiting the name.

Parameters:
name -
delimit -
Returns:

toDBName

String toDBName(String name)
Converts the specified string to a format required by the database.

Parameters:
name -
Returns:

toDBName

String toDBName(String name,
                boolean delimit)
Converts the specified string to a format required by the database, optionally delimiting the name.

Parameters:
name -
Returns:

fromDBName

DBIdentifier fromDBName(String name,
                        DBIdentifier.DBIdentifierType id)
Converts the name returned by the database to an identifier of the specified type.

Parameters:
name -
Returns:

appendColumns

String appendColumns(Column[] columns)
Appends multiple columns names together into comma delimited string.

Parameters:
columns -
Returns:

convertSchemaCase

DBIdentifier convertSchemaCase(DBIdentifier schema)
Converts the name of the specified delimiter to the appropriate case as defined by the configuration.

Parameters:
columns -
Returns:

append

DBIdentifier append(DBIdentifier.DBIdentifierType resultId,
                    DBIdentifier... names)
Appends multiple names together using the appropriate name delimiter.

Parameters:
resultId -
names -
Returns:

getGeneratedKeySequenceName

DBIdentifier getGeneratedKeySequenceName(Column col,
                                         int maxLen)
Returns a generated key sequence identifier for the column.

Parameters:
col -
maxLen -
Returns:

convertAlias

String convertAlias(String alias)
Converts a provided alias to a format specified in the configuration.

Parameters:
alias -
Returns:


Copyright © 2006-2012 Apache Software Foundation. All Rights Reserved.