|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.openjpa.jdbc.sql.DBDictionary
public class DBDictionary
Class which allows the creation of SQL dynamically, in a database agnostic fashion. Subclass for the nuances of different data stores.
Nested Class Summary | |
---|---|
static class |
DBDictionary.SerializedData
Used by some mappings to represent data that has already been serialized so that we don't have to serialize multiple times. |
Fields inherited from interface org.apache.openjpa.jdbc.sql.JoinSyntaxes |
---|
SYNTAX_DATABASE, SYNTAX_SQL92, SYNTAX_TRADITIONAL |
Constructor Summary | |
---|---|
DBDictionary()
|
Method Summary | ||
---|---|---|
String |
addCastAsType(String func,
Val val)
add CAST for a function operator where operand is a param |
|
void |
addErrorCode(int errorType,
String errorCode)
|
|
void |
appendCast(SQLBuffer buf,
Object val,
int type)
Cast the specified value to the specified type. |
|
protected void |
appendLength(SQLBuffer buf,
int type)
|
|
protected void |
appendNumericCast(SQLBuffer buf,
FilterValue val)
Append SQL for the given numeric value to the buffer, casting as needed. |
|
protected void |
appendSelect(SQLBuffer selectSQL,
Object elem,
Select sel,
int idx)
Append elem to selectSQL . |
|
protected void |
appendSelectRange(SQLBuffer buf,
long start,
long end,
boolean subselect)
If this dictionary can select ranges, use this method to append the range SQL. |
|
protected String |
appendSize(Column col,
String typeName)
Helper method to add size properties to the specified type. |
|
protected void |
appendUpdates(Select sel,
JDBCStore store,
SQLBuffer sql,
Object[] params,
Map updateParams,
boolean allowAlias)
|
|
void |
appendXmlComparison(SQLBuffer buf,
String op,
FilterValue lhs,
FilterValue rhs,
boolean lhsxml,
boolean rhsxml)
If this dictionary supports XML type, use this method to append xml predicate. |
|
void |
assertSupport(boolean feature,
String property)
Assert that the given dictionary flag is true. |
|
protected void |
calculateValue(Val val,
Select sel,
ExpContext ctx,
ExpState state,
Path path,
ExpState pathState)
This method is to provide override for non-JDBC or JDBC-like implementation of calculating value. |
|
boolean |
canOuterJoin(int syntax,
ForeignKey fk)
Returns if the given foreign key can be eagerly loaded using other joins. |
|
(package private) String |
checkNameLength(DBIdentifier identifier,
int length,
String msgKey)
Validate that the given name is not longer than given maximum length. |
|
(package private) String |
checkNameLength(DBIdentifier identifier,
int length,
String msgKey,
boolean qualified)
Validate that the given name is not longer than given maximum length. |
|
(package private) String |
checkNameLength(String name,
int length,
String msgKey)
Validate that the given name is not longer than given maximum length. |
|
void |
closeDataSource(DataSource dataSource)
Closes the specified DataSource and releases any
resources associated with it. |
|
protected ForeignKey |
combineForeignKey(Map<ForeignKey.FKMapKey,ForeignKey> fkMap,
ForeignKey fk)
Combines partial foreign keys into singular key |
|
protected StringBuilder |
comment(StringBuilder buf,
String comment)
|
|
void |
comparison(SQLBuffer buf,
String op,
FilterValue lhs,
FilterValue rhs)
Append a comparison. |
|
protected void |
configureNamingRules()
Configures the naming rules for this dictionary. |
|
void |
connectedConfiguration(Connection conn)
This method is called when the dictionary first sees any connection. |
|
String |
convertSchemaCase(DBIdentifier objectName)
Convert the specified schema name to a name that the database will be able to understand. |
|
String |
convertSchemaCase(String objectName)
Convert the specified schema name to a name that the database will be able to understand. |
|
protected long |
copy(InputStream in,
OutputStream out)
|
|
protected long |
copy(Reader reader,
Writer writer)
|
|
void |
createIndexIfNecessary(Schema schema,
DBIdentifier table,
Column pkColumn)
|
|
void |
createIndexIfNecessary(Schema schema,
String table,
Column pkColumn)
Deprecated. |
|
Connection |
decorate(Connection conn)
Decorate the given connection if needed. |
|
void |
deleteStream(JDBCStore store,
Select sel)
|
|
boolean |
delimitAll()
Returns true if global name delimiting is enabled. |
|
void |
endConfiguration()
Invoked upon completion of bean property configuration for this object. |
|
protected ResultSet |
executeQuery(Connection conn,
PreparedStatement stmnt,
String sql)
This method is to provide override for non-JDBC or JDBC-like implementation of executing query. |
|
DBIdentifier |
fromDBName(String name,
DBIdentifier.DBIdentifierType id)
|
|
String[] |
getAddColumnSQL(Column column)
Return a series of SQL statements to add the given column to its table. |
|
String[] |
getAddForeignKeySQL(ForeignKey fk)
Return a series of SQL statements to add the given foreign key to its table. |
|
String[] |
getAddPrimaryKeySQL(PrimaryKey pk)
Return a series of SQL statements to add the given primary key to its table. |
|
String |
getAlterSequenceSQL(Sequence seq)
|
|
Array |
getArray(ResultSet rs,
int column)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
InputStream |
getAsciiStream(ResultSet rs,
int column)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
int |
getBatchFetchSize(int batchFetchSize)
|
|
int |
getBatchLimit()
Return the batchLimit |
|
int |
getBatchUpdateCount(PreparedStatement ps)
Return batched statements update success count |
|
BigDecimal |
getBigDecimal(ResultSet rs,
int column)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
BigInteger |
getBigInteger(ResultSet rs,
int column)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
InputStream |
getBinaryStream(ResultSet rs,
int column)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
Blob |
getBlob(ResultSet rs,
int column)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
Object |
getBlobObject(ResultSet rs,
int column,
JDBCStore store)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
boolean |
getBoolean(ResultSet rs,
int column)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
byte |
getByte(ResultSet rs,
int column)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
byte[] |
getBytes(ResultSet rs,
int column)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
Calendar |
getCalendar(ResultSet rs,
int column)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
String |
getCastFunction(Val val,
String func)
Attach CAST to the current function if necessary |
|
String |
getCastFunction(Val val,
String func,
Column col)
Return the correct CAST function syntax. |
|
protected String |
getCatalogNameForMetadata(DBIdentifier catalogName)
Returns the catalog name that will be used for obtaining information from DatabaseMetaData . |
|
protected String |
getCatalogNameForMetadata(String catalogName)
Returns the catalog name that will be used for obtaining information from DatabaseMetaData . |
|
char |
getChar(ResultSet rs,
int column)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
Reader |
getCharacterStream(ResultSet rs,
int column)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
Clob |
getClob(ResultSet rs,
int column)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
String |
getClobString(ResultSet rs,
int column)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
String |
getColumnDBName(Column column)
|
|
DBIdentifier |
getColumnIdentifier(Column column)
Returns the name of the column using database specific delimiters. |
|
protected String |
getColumnNameForMetadata(DBIdentifier columnName)
Returns the column name that will be used for obtaining information from DatabaseMetaData . |
|
protected String |
getColumnNameForMetadata(String columnName)
Returns the column name that will be used for obtaining information from DatabaseMetaData . |
|
Column[] |
getColumns(DatabaseMetaData meta,
DBIdentifier catalog,
DBIdentifier schemaName,
DBIdentifier tableName,
DBIdentifier columnName,
Connection conn)
Reflect on the schema to find columns matching the given table and column patterns. |
|
Column[] |
getColumns(DatabaseMetaData meta,
String catalog,
String schemaName,
String tableName,
String columnName,
Connection conn)
Deprecated. |
|
String |
getConversionKey()
Returns a key that can be used to determine whether conversion should take place. |
|
String[] |
getCreateIndexSQL(Index index)
Return a series of SQL statements to create the given index. |
|
String[] |
getCreateSequenceSQL(Sequence seq)
Return a series of SQL statements to create the given sequence. |
|
String[] |
getCreateTableSQL(Table table)
Return a series of SQL statements to create the given table, complete with columns. |
|
String[] |
getCreateTableSQL(Table table,
SchemaGroup group)
Return a series of SQL statements to create the given table, complete with columns. |
|
Date |
getDate(ResultSet rs,
int column)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
Date |
getDate(ResultSet rs,
int column,
Calendar cal)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
protected String |
getDeclareColumnSQL(Column col,
boolean alter)
Return the declaration SQL for the given column. |
|
IdentifierRule |
getDefaultIdentifierRule()
Gets the default naming rule |
|
String |
getDefaultSchemaName()
|
|
String[] |
getDeleteTableContentsSQL(Table[] tables,
Connection conn)
Create SQL to delete the contents of the specified tables. |
|
protected SQLBuffer |
getDeleteTargets(Select sel)
|
|
String |
getDelimitedCase()
Returns the case that is used when delimiting. |
|
boolean |
getDelimitIdentifiers()
|
|
double |
getDouble(ResultSet rs,
int column)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
String[] |
getDropColumnSQL(Column column)
Return a series of SQL statements to drop the given column from its table. |
|
String[] |
getDropForeignKeySQL(ForeignKey fk,
Connection conn)
Return a series of SQL statements to drop the given foreign key from its table. |
|
String[] |
getDropIndexSQL(Index index)
Return a series of SQL statements to drop the given index. |
|
String[] |
getDropPrimaryKeySQL(PrimaryKey pk)
Return a series of SQL statements to drop the given primary key from its table. |
|
String[] |
getDropSequenceSQL(Sequence seq)
Return a series of SQL statements to drop the given sequence. |
|
String[] |
getDropTableSQL(Table table)
Return a series of SQL statements to drop the given table. |
|
float |
getFloat(ResultSet rs,
int column)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
protected String |
getForeignKeyConstraintSQL(ForeignKey fk)
Return the declaration SQL for the given foreign key, or null if it is not supported. |
|
protected String |
getForUpdateClause(JDBCFetchConfiguration fetch,
boolean isForUpdate,
Select sel)
Get the update clause for the query based on the updateClause and isolationLevel hints |
|
protected SQLBuffer |
getFrom(Select sel,
boolean forUpdate)
Return the portion of the select statement between the FROM keyword and the WHERE keyword. |
|
protected SQLBuffer |
getFromSelect(Select sel,
boolean forUpdate)
Return the FROM clause for a select that selects from a tmp table created by an inner select. |
|
DBIdentifier |
getFullIdentifier(Table table,
boolean logical)
Returns the full name of the table, including the schema (delimited by catalogSeparator ). |
|
String |
getFullName(Index index)
Returns the full name of the index, including the schema (delimited by the result of catalogSeparator ). |
|
String |
getFullName(Sequence seq)
Returns the full name of the sequence, including the schema (delimited by the result of catalogSeparator ). |
|
String |
getFullName(Table table,
boolean logical)
|
|
Object |
getGeneratedKey(Column col,
Connection conn)
Return the last generated value for the given column. |
|
protected String |
getGeneratedKeySequenceName(Column col)
Return the sequence name used by databases for the given autoassigned column. |
|
protected String |
getGenKeySeqName(String query,
Column col)
|
|
String |
getIdentifierConcatenator()
Returns the value used to concatenate multiple names together. |
|
String |
getIdentifierDelimiter()
Returns the value used to delimit between individual names. |
|
|
getIdentifierRule(T t)
Returns a naming rule or null if the rule is not found. |
|
Map<String,IdentifierRule> |
getIdentifierRules()
Returns all naming rules |
|
String |
getIdentityColumnName()
|
|
ForeignKey[] |
getImportedKeys(DatabaseMetaData meta,
DBIdentifier catalog,
DBIdentifier schemaName,
DBIdentifier tableName,
Connection conn)
Reflect on the schema to return foreign keys imported by the given table pattern. |
|
ForeignKey[] |
getImportedKeys(DatabaseMetaData meta,
DBIdentifier catalog,
DBIdentifier schemaName,
DBIdentifier tableName,
Connection conn,
boolean partialKeys)
Reflect on the schema to return full foreign keys imported by the given table pattern. |
|
ForeignKey[] |
getImportedKeys(DatabaseMetaData meta,
String catalog,
String schemaName,
String tableName,
Connection conn)
Deprecated. |
|
ForeignKey[] |
getImportedKeys(DatabaseMetaData meta,
String catalog,
String schemaName,
String tableName,
Connection conn,
boolean partialKeys)
Deprecated. |
|
Index[] |
getIndexInfo(DatabaseMetaData meta,
DBIdentifier catalog,
DBIdentifier schemaName,
DBIdentifier tableName,
boolean unique,
boolean approx,
Connection conn)
Reflect on the schema to find indexes matching the given table pattern. |
|
Index[] |
getIndexInfo(DatabaseMetaData meta,
String catalog,
String schemaName,
String tableName,
boolean unique,
boolean approx,
Connection conn)
Deprecated. |
|
int |
getInt(ResultSet rs,
int column)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
Set<String> |
getInvalidColumnWordSet()
Return the subset of the words in reservedWordSet that cannot be used as valid column names for the current DB. |
|
String |
getIsNotNullSQL(String colAlias,
int colType)
|
|
String |
getIsNullSQL(String colAlias,
int colType)
|
|
int |
getJDBCType(int metaTypeCode,
boolean lob)
Return the preferred Types constant for the given
JavaTypes or JavaSQLTypes constant. |
|
int |
getJDBCType(int metaTypeCode,
boolean lob,
int precis,
int scale)
Return the preferred Types constant for the given
JavaTypes or JavaSQLTypes constant. |
|
int |
getJDBCType(int metaTypeCode,
boolean lob,
int precis,
int scale,
boolean xml)
Return the preferred Types constant for the given
JavaTypes or JavaSQLTypes constant. |
|
protected Object |
getKey(ResultSet rs,
Column col)
This method is to provide override for non-JDBC or JDBC-like implementation of getting key from the result set. |
|
String |
getLeadingDelimiter()
Returns the leading delimiter value to use when delimiting a name. |
|
InputStream |
getLOBStream(JDBCStore store,
ResultSet rs,
int column)
|
|
Locale |
getLocale(ResultSet rs,
int column)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
Log |
getLog()
|
|
long |
getLong(ResultSet rs,
int column)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
String |
getMarkerForInsertUpdate(Column col,
Object val)
Return parameter marker for INSERT and UPDATE statements. |
|
DBIdentifierUtil |
getNamingUtil()
Returns the naming utility used by this dictionary instance |
|
Number |
getNumber(ResultSet rs,
int column)
Returns the specified column value as an unknown numeric type; we try from the most generic to the least generic. |
|
Object |
getObject(ResultSet rs,
int column,
Map map)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
String |
getPlaceholderValueString(Column col)
Return a SQL string to act as a placeholder for the given column. |
|
int |
getPreferredType(int type)
Return the preferred Types type for the given one. |
|
protected String |
getPrimaryKeyConstraintSQL(PrimaryKey pk)
Return the declaration SQL for the given primary key. |
|
PrimaryKey[] |
getPrimaryKeys(DatabaseMetaData meta,
DBIdentifier catalog,
DBIdentifier schemaName,
DBIdentifier tableName,
Connection conn)
Reflect on the schema to find primary keys for the given table pattern. |
|
PrimaryKey[] |
getPrimaryKeys(DatabaseMetaData meta,
String catalog,
String schemaName,
String tableName,
Connection conn)
Deprecated. |
|
protected PrimaryKey[] |
getPrimaryKeysFromBestRowIdentifier(DatabaseMetaData meta,
DBIdentifier catalog,
DBIdentifier schemaName,
DBIdentifier tableName,
Connection conn)
Reflect on the schema to find primary keys for the given table pattern. |
|
protected PrimaryKey[] |
getPrimaryKeysFromBestRowIdentifier(DatabaseMetaData meta,
String catalog,
String schemaName,
String tableName,
Connection conn)
Deprecated. |
|
protected PrimaryKey[] |
getPrimaryKeysFromGetPrimaryKeys(DatabaseMetaData meta,
DBIdentifier catalog,
DBIdentifier schemaName,
DBIdentifier tableName,
Connection conn)
Reflect on the schema to find primary keys for the given table pattern. |
|
protected PrimaryKey[] |
getPrimaryKeysFromGetPrimaryKeys(DatabaseMetaData meta,
String catalog,
String schemaName,
String tableName,
Connection conn)
Deprecated. |
|
Ref |
getRef(ResultSet rs,
int column,
Map map)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
String |
getSchemaCase()
Return DB specific schemaCase |
|
protected String |
getSchemaNameForMetadata(DBIdentifier schemaName)
Returns the schema name that will be used for obtaining information from DatabaseMetaData . |
|
protected String |
getSchemaNameForMetadata(String schemaName)
Returns the schema name that will be used for obtaining information from DatabaseMetaData . |
|
String |
getSelectOperation(JDBCFetchConfiguration fetch)
Return the "SELECT" operation clause, adding any available hints, etc. |
|
protected SQLBuffer |
getSelects(Select sel,
boolean distinctIdentifiers,
boolean forUpdate)
Return the portion of the select statement between the SELECT keyword and the FROM keyword. |
|
protected Collection<String> |
getSelectTableAliases(Select sel)
|
|
protected Sequence[] |
getSequence(ResultSet rs)
This method is to provide override for non-JDBC or JDBC-like implementation of getting sequence from the result set. |
|
Sequence[] |
getSequences(DatabaseMetaData meta,
DBIdentifier catalog,
DBIdentifier schemaName,
DBIdentifier sequenceName,
Connection conn)
|
|
Sequence[] |
getSequences(DatabaseMetaData meta,
String catalog,
String schemaName,
String sequenceName,
Connection conn)
Deprecated. |
|
protected String |
getSequencesSQL(DBIdentifier schemaName,
DBIdentifier sequenceName)
|
|
protected String |
getSequencesSQL(String schemaName,
String sequenceName)
Deprecated. |
|
short |
getShort(ResultSet rs,
int column)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
String |
getString(ResultSet rs,
int column)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
boolean |
getSupportsDelimitedIdentifiers()
Returns true if delimiting is supported |
|
boolean |
getSupportsXMLColumn()
|
|
protected String |
getTableNameForMetadata(DBIdentifier tableName)
Returns the table name that will be used for obtaining information from DatabaseMetaData . |
|
protected String |
getTableNameForMetadata(String tableName)
Returns the table name that will be used for obtaining information from DatabaseMetaData . |
|
Table[] |
getTables(DatabaseMetaData meta,
DBIdentifier sqlCatalog,
DBIdentifier sqlSchemaName,
DBIdentifier sqlTableName,
Connection conn)
Reflect on the schema to find tables matching the given name pattern. |
|
Table[] |
getTables(DatabaseMetaData meta,
String catalog,
String schemaName,
String tableName,
Connection conn)
Deprecated. |
|
Time |
getTime(ResultSet rs,
int column,
Calendar cal)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
Timestamp |
getTimestamp(ResultSet rs,
int column,
Calendar cal)
Convert the specified column of the SQL ResultSet to the proper java type. |
|
String |
getTrailingDelimiter()
Returns the trailing delimiter value to use when delimiting a name. |
|
boolean |
getTrimSchemaName()
|
|
String |
getTypeName(Column col)
Return the preferred database type name for the given column's type from Types . |
|
String |
getTypeName(int type)
Returns the type name for the specific constant as defined by Types . |
|
protected String |
getUniqueConstraintSQL(Unique unq)
Return the declaration SQL for the given unique constraint. |
|
DBIdentifier |
getValidColumnName(DBIdentifier name,
Table table)
Make any necessary changes to the given column name to make it valid for the current DB. |
|
DBIdentifier |
getValidColumnName(DBIdentifier name,
Table table,
boolean checkForUniqueness)
Make any necessary changes to the given column name to make it valid for the current DB. |
|
String |
getValidColumnName(String name,
Table table)
Deprecated. |
|
String |
getValidColumnName(String name,
Table table,
boolean checkForUniqueness)
Deprecated. |
|
DBIdentifier |
getValidForeignKeyName(DBIdentifier name,
Table table,
Table toTable)
Make any necessary changes to the given foreign key name to make it valid for the current DB. |
|
String |
getValidForeignKeyName(String name,
Table table,
Table toTable)
Deprecated. |
|
DBIdentifier |
getValidIndexName(DBIdentifier name,
Table table)
Make any necessary changes to the given index name to make it valid for the current DB. |
|
String |
getValidIndexName(String name,
Table table)
Deprecated. |
|
String |
getValidPrimaryKeyName(String name,
Table table)
Make any necessary changes to the given primary key name to make it valid for the current DB. |
|
DBIdentifier |
getValidSequenceName(DBIdentifier name,
Schema schema)
Make any necessary changes to the given sequence name to make it valid for the current DB. |
|
String |
getValidSequenceName(String name,
Schema schema)
Deprecated. |
|
DBIdentifier |
getValidTableName(DBIdentifier name,
Schema schema)
Make any necessary changes to the given table name to make it valid for the current DB. |
|
String |
getValidTableName(String name,
Schema schema)
Deprecated. |
|
DBIdentifier |
getValidUniqueName(DBIdentifier name,
Table table)
Make any necessary changes to the given unique constraint name to make it valid for the current DB. |
|
String |
getValidUniqueName(String name,
Table table)
Deprecated. |
|
DBIdentifier |
getVersionColumn(Column column,
DBIdentifier tableAlias)
|
|
String |
getVersionColumn(Column column,
String tableAlias)
Return version column name |
|
protected SQLBuffer |
getWhere(Select sel,
boolean forUpdate)
Return the WHERE portion of the select statement, or null if no where conditions. |
|
String |
getXMLTypeEncoding()
|
|
void |
handleWarning(SQLWarning warning)
Implementation of the LoggingConnectionDecorator.SQLWarningHandler interface
that allows customization of the actions to perform when a
SQLWarning occurs at any point on a Connection ,
Statement , or ResultSet . |
|
void |
indexOf(SQLBuffer buf,
FilterValue str,
FilterValue find,
FilterValue start)
Invoke this database's indexOf function. |
|
void |
insertBlobForStreamingLoad(Row row,
Column col,
JDBCStore store,
Object ob,
Select sel)
|
|
void |
insertClobForStreamingLoad(Row row,
Column col,
Object ob)
|
|
protected String |
insertSize(String typeName,
String size)
Helper method that inserts a size clause for a given SQL type. |
|
boolean |
isFatalException(int subtype,
SQLException ex)
Determine if the given SQL Exception is fatal or recoverable (such as a timeout). |
|
boolean |
isSelect(String sql)
Determine whether the provided sql may be treated as a
select statement on this database. |
|
boolean |
isSystemIndex(DBIdentifier name,
Table table)
This method is used to filter system indexes from database metadata. |
|
boolean |
isSystemIndex(String name,
Table table)
Deprecated. |
|
boolean |
isSystemSequence(DBIdentifier name,
DBIdentifier schema,
boolean targetSchema)
This method is used to filter system sequences from database metadata. |
|
boolean |
isSystemSequence(DBIdentifier name,
DBIdentifier schema,
boolean targetSchema,
Connection conn)
This method is used to filter system sequences from database metadata. |
|
boolean |
isSystemSequence(String name,
String schema,
boolean targetSchema)
Deprecated. |
|
boolean |
isSystemTable(DBIdentifier name,
DBIdentifier schema,
boolean targetSchema)
This method is used to filter system tables from database metadata. |
|
boolean |
isSystemTable(String name,
String schema,
boolean targetSchema)
Deprecated. |
|
protected DBIdentifier |
makeNameValid(DBIdentifier name,
NameSet set,
int maxLen,
int nameType)
Shortens the given name to the given maximum length, then checks that it is not a reserved word. |
|
protected DBIdentifier |
makeNameValid(DBIdentifier 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. |
|
protected String |
makeNameValid(String name,
NameSet set,
int maxLen,
int nameType)
Deprecated. |
|
protected String |
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. |
|
protected int |
matchErrorState(Map<Integer,Set<String>> errorStates,
SQLException ex)
Determine the more appropriate type of store exception by matching the SQL Error State of the the given SQLException to the given Error States categorized by error types. |
|
void |
mathFunction(SQLBuffer buf,
String op,
FilterValue lhs,
FilterValue rhs)
Append the numeric parts of a mathematical function. |
|
(package private) OpenJPAException |
narrow(String msg,
SQLException ex,
Object failed)
Gets the category of StoreException by matching the given SQLException's error state code to the list of error codes supplied by the dictionary. |
|
boolean |
needsToCreateIndex(Index idx,
Table table)
|
|
boolean |
needsToCreateIndex(Index idx,
Table table,
Unique[] uniques)
|
|
protected Column |
newColumn(ResultSet colMeta)
Create a new column from the information in the schema metadata. |
|
protected ForeignKey |
newForeignKey(ResultSet fkMeta)
Create a new foreign key from the information in the schema metadata. |
|
protected Index |
newIndex(ResultSet idxMeta)
Create a new index from the information in the schema metadata. |
|
protected PrimaryKey |
newPrimaryKey(ResultSet pkMeta)
Create a new primary key from the information in the schema metadata. |
|
protected Sequence |
newSequence(ResultSet sequenceMeta)
Create a new sequence from the information in the schema metadata. |
|
OpenJPAException |
newStoreException(String msg,
SQLException[] causes,
Object failed)
Return a new exception that wraps causes . |
|
protected Table |
newTable(ResultSet tableMeta)
Create a new table from the information in the schema metadata. |
|
protected PreparedStatement |
prepareStatement(Connection conn,
String sql)
This method is to provide override for non-JDBC or JDBC-like implementation of preparing statement. |
|
void |
putBytes(Blob blob,
byte[] data)
Invoke the JDK 1.4 setBytes method on the given BLOB object. |
|
void |
putChars(Clob clob,
char[] data)
Invoke the JDK 1.4 setCharacterStream method on the given
CLOB object. |
|
void |
putString(Clob clob,
String data)
Invoke the JDK 1.4 setString method on the given CLOB
object. |
|
void |
refSchemaComponents(Table table)
Increment the reference count of any table components that this dictionary adds that are not used by mappings. |
|
byte[] |
serialize(Object val,
JDBCStore store)
Return the serialized bytes for the given object. |
|
void |
setArray(PreparedStatement stmnt,
int idx,
Array val,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setAsciiStream(PreparedStatement stmnt,
int idx,
InputStream val,
int length,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setBatchLimit(int limit)
Set the batchLimit value |
|
void |
setBigDecimal(PreparedStatement stmnt,
int idx,
BigDecimal val,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setBigInteger(PreparedStatement stmnt,
int idx,
BigInteger val,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setBinaryStream(PreparedStatement stmnt,
int idx,
InputStream val,
int length,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setBlob(PreparedStatement stmnt,
int idx,
Blob val,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setBlobObject(PreparedStatement stmnt,
int idx,
Object val,
Column col,
JDBCStore store)
Set the given value as a parameter to the statement. |
|
void |
setBoolean(PreparedStatement stmnt,
int idx,
boolean val,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setByte(PreparedStatement stmnt,
int idx,
byte val,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setBytes(PreparedStatement stmnt,
int idx,
byte[] val,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setCalendar(PreparedStatement stmnt,
int idx,
Calendar val,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setChar(PreparedStatement stmnt,
int idx,
char val,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setCharacterStream(PreparedStatement stmnt,
int idx,
Reader val,
int length,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setClob(PreparedStatement stmnt,
int idx,
Clob val,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setClobString(PreparedStatement stmnt,
int idx,
String val,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setConfiguration(Configuration conf)
Invoked prior to setting bean properties. |
|
void |
setDate(PreparedStatement stmnt,
int idx,
Date val,
Calendar cal,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setDate(PreparedStatement stmnt,
int idx,
Date val,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setDefaultSchemaName(String defaultSchemaName)
|
|
protected void |
setDelimitedCase(DatabaseMetaData metaData)
|
|
void |
setDelimitIdentifiers(boolean delimitIds)
|
|
void |
setDouble(PreparedStatement stmnt,
int idx,
double val,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setFloat(PreparedStatement stmnt,
int idx,
float val,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setInt(PreparedStatement stmnt,
int idx,
int val,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setJoinSyntax(String syntax)
Set the name of the join syntax to use: sql92, traditional, database. |
|
void |
setLeadingDelimiter(String delim)
|
|
void |
setLocale(PreparedStatement stmnt,
int idx,
Locale val,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setLong(PreparedStatement stmnt,
int idx,
long val,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setNull(PreparedStatement stmnt,
int idx,
int colType,
Column col)
Set null as a parameter to the statement. |
|
void |
setNumber(PreparedStatement stmnt,
int idx,
Number num,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setObject(PreparedStatement stmnt,
int idx,
Object val,
int colType,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setQueryTimeout(PreparedStatement stmnt,
int timeout)
Provides the default validation handling of setting a query timeout. |
|
void |
setRef(PreparedStatement stmnt,
int idx,
Ref val,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setShort(PreparedStatement stmnt,
int idx,
short val,
Column col)
Set the given value as a parameter to the statement. |
|
protected void |
setStatementQueryTimeout(PreparedStatement stmnt,
int timeout)
Allow subclasses to provide DB unique override implementations of setting query timeouts, while preserving the default timeout logic in the public setQueryTimeout method. |
|
void |
setString(PreparedStatement stmnt,
int idx,
String val,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setSupportsDelimitedIdentifiers(DatabaseMetaData metaData)
|
|
void |
setSupportsXMLColumn(boolean b)
|
|
void |
setTime(PreparedStatement stmnt,
int idx,
Time val,
Calendar cal,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setTimeouts(PreparedStatement stmnt,
JDBCConfiguration conf,
boolean forUpdate)
FIXME - OPENJPA-957 - lockTimeout is a server-side function and shouldn't be using client-side setQueryTimeout for lock timeouts. |
|
void |
setTimeouts(PreparedStatement stmnt,
JDBCFetchConfiguration fetch,
boolean forUpdate)
FIXME - OPENJPA-957 - lockTimeout is a server-side function and shouldn't be using client-side setQueryTimeout for lock timeouts. |
|
void |
setTimestamp(PreparedStatement stmnt,
int idx,
Timestamp val,
Calendar cal,
Column col)
Set the given value as a parameter to the statement. |
|
void |
setTrailingDelimiter(String delim)
|
|
void |
setTrimSchemaName(boolean trimSchemaName)
|
|
void |
setTyped(PreparedStatement stmnt,
int idx,
Object val,
Column col,
int type,
JDBCStore store)
Set a column value into a prepared statement. |
|
void |
setUnknown(PreparedStatement stmnt,
int idx,
Object val,
Column col)
Set a completely unknown parameter into a prepared statement. |
|
void |
setXMLTypeEncoding(String encoding)
|
|
static String |
shorten(String name,
int targetLength)
Shorten the specified name to the specified target name. |
|
void |
startConfiguration()
Invoked before bean property configuration is begun on this object. |
|
protected void |
storageWarning(Object orig,
Object converted)
Warn that a particular value could not be stored precisely. |
|
void |
substring(SQLBuffer buf,
FilterValue str,
FilterValue start,
FilterValue length)
Invoke this database's substring function. |
|
protected boolean |
supportsDeferredForeignKeyConstraints()
Whether or not this dictionary supports deferred foreign key constraints. |
|
protected boolean |
supportsDeferredUniqueConstraints()
Whether or not this dictionary supports deferred unique constraints. |
|
boolean |
supportsDeleteAction(int action)
Whether this database supports the given foreign key delete action. |
|
boolean |
supportsIsolationForUpdate()
Return true if the dictionary uses isolation level to compute the returned getForUpdateClause() SQL clause. |
|
boolean |
supportsLocking(Select sel)
Returns true if a "FOR UPDATE" clause can be used for the specified Select object. |
|
boolean |
supportsRandomAccessResultSet(Select sel,
boolean forUpdate)
Return false if the given select requires a forward-only result set. |
|
boolean |
supportsUpdateAction(int action)
Whether this database supports the given foreign key update action. |
|
protected SQLBuffer |
toBulkOperation(ClassMapping mapping,
Select sel,
JDBCStore store,
Object[] params,
Map updateParams)
Returns the SQL for a bulk operation, either a DELETE or an UPDATE. |
|
String |
toDBName(DBIdentifier name)
|
|
String |
toDBName(DBIdentifier name,
boolean delimit)
|
|
SQLBuffer |
toDelete(ClassMapping mapping,
Select sel,
Object[] params)
Create a DELETE statement for the specified Select. |
|
(package private) long |
toLong(FilterValue litValue)
|
|
SQLBuffer |
toNativeJoin(Join join)
Use the given join instance to create SQL joining its tables in the database's native syntax. |
|
SQLBuffer |
toOperation(String op,
SQLBuffer selects,
SQLBuffer from,
SQLBuffer where,
SQLBuffer group,
SQLBuffer having,
SQLBuffer order,
boolean distinct,
long start,
long end,
String forUpdateClause)
Return the SQL for the given selecting operation. |
|
SQLBuffer |
toOperation(String op,
SQLBuffer selects,
SQLBuffer from,
SQLBuffer where,
SQLBuffer group,
SQLBuffer having,
SQLBuffer order,
boolean distinct,
long start,
long end,
String forUpdateClause,
boolean subselect)
Return the SQL for the given selecting operation. |
|
SQLBuffer |
toSelect(Select sel,
boolean forUpdate,
JDBCFetchConfiguration fetch)
Create a SELECT statement in the proper join syntax for the given instance. |
|
SQLBuffer |
toSelect(SQLBuffer selects,
JDBCFetchConfiguration fetch,
SQLBuffer from,
SQLBuffer where,
SQLBuffer group,
SQLBuffer having,
SQLBuffer order,
boolean distinct,
boolean forUpdate,
long start,
long end)
Combine the given components into a SELECT statement. |
|
SQLBuffer |
toSelect(SQLBuffer selects,
JDBCFetchConfiguration fetch,
SQLBuffer from,
SQLBuffer where,
SQLBuffer group,
SQLBuffer having,
SQLBuffer order,
boolean distinct,
boolean forUpdate,
long start,
long end,
boolean subselect,
boolean checkTableForUpdate)
|
|
protected SQLBuffer |
toSelect(SQLBuffer selects,
JDBCFetchConfiguration fetch,
SQLBuffer from,
SQLBuffer where,
SQLBuffer group,
SQLBuffer having,
SQLBuffer order,
boolean distinct,
boolean forUpdate,
long start,
long end,
boolean subselect,
Select sel)
Combine the given components into a SELECT statement. |
|
protected SQLBuffer |
toSelect(SQLBuffer selects,
JDBCFetchConfiguration fetch,
SQLBuffer from,
SQLBuffer where,
SQLBuffer group,
SQLBuffer having,
SQLBuffer order,
boolean distinct,
boolean forUpdate,
long start,
long end,
Select sel)
Combine the given components into a SELECT statement. |
|
SQLBuffer |
toSelectCount(Select sel)
Create a SELECT COUNT statement in the proper join syntax for the given instance. |
|
SQLBuffer |
toSQL92Join(Select sel,
Join join,
boolean forUpdate,
boolean first)
Use the given join instance to create SQL joining its tables in the SQL92 style. |
|
SQLBuffer |
toTraditionalJoin(Join join)
Use the given join instance to create SQL joining its tables in the traditional style. |
|
SQLBuffer |
toUpdate(ClassMapping mapping,
Select sel,
JDBCStore store,
Object[] params,
Map updates)
|
|
void |
updateBlob(Select sel,
JDBCStore store,
InputStream is)
|
|
void |
updateClob(Select sel,
JDBCStore store,
Reader reader)
|
|
boolean |
validateBatchProcess(RowImpl row,
Column[] autoAssign,
OpenJPAStateManager sm,
ClassMapping cmd)
Validate the batch process. |
|
boolean |
validateDBSpecificBatchProcess(boolean disableBatch,
RowImpl row,
Column[] autoAssign,
OpenJPAStateManager sm,
ClassMapping cmd)
Allow each Dictionary to validate its own batch process. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String VENDOR_OTHER
public static final String VENDOR_DATADIRECT
public static final String SCHEMA_CASE_UPPER
public static final String SCHEMA_CASE_LOWER
public static final String SCHEMA_CASE_PRESERVE
public static final String CONS_NAME_BEFORE
public static final String CONS_NAME_MID
public static final String CONS_NAME_AFTER
public int blobBufferSize
public int clobBufferSize
protected static final int RANGE_POST_SELECT
protected static final int RANGE_PRE_DISTINCT
protected static final int RANGE_POST_DISTINCT
protected static final int RANGE_POST_LOCK
protected static final int NANO
protected static final int MICRO
protected static final int MILLI
protected static final int CENTI
protected static final int DECI
protected static final int SEC
protected static final int NAME_ANY
protected static final int NAME_TABLE
protected static final int NAME_SEQUENCE
protected static final int UNLIMITED
protected static final int NO_BATCH
public String platform
public String driverVendor
public boolean createPrimaryKeys
public String constraintNameMode
public int maxTableNameLength
public int maxColumnNameLength
public int maxConstraintNameLength
public int maxIndexNameLength
public int maxIndexesPerTable
public boolean supportsForeignKeys
public boolean supportsParameterInSelect
public boolean supportsForeignKeysComposite
public boolean supportsUniqueConstraints
public boolean supportsDeferredConstraints
public boolean supportsRestrictDeleteAction
public boolean supportsCascadeDeleteAction
public boolean supportsNullDeleteAction
public boolean supportsNullUniqueColumn
public boolean supportsDefaultDeleteAction
public boolean supportsRestrictUpdateAction
public boolean supportsCascadeUpdateAction
public boolean supportsNullUpdateAction
public boolean supportsDefaultUpdateAction
public boolean supportsAlterTableWithAddColumn
public boolean supportsAlterTableWithDropColumn
public boolean supportsComments
public Boolean supportsGetGeneratedKeys
public String reservedWords
public String systemSchemas
public String systemTables
public String selectWords
public String fixedSizeTypeNames
public String schemaCase
public boolean setStringRightTruncationOn
public String validationSQL
public String closePoolSQL
public String initializationSQL
public int joinSyntax
public String outerJoinClause
public String innerJoinClause
public String crossJoinClause
public boolean requiresConditionForCrossJoin
public String forUpdateClause
public String tableForUpdateClause
public String distinctCountColumnSeparator
public boolean supportsSelectForUpdate
public boolean supportsLockingWithDistinctClause
public boolean supportsLockingWithMultipleTables
public boolean supportsLockingWithOrderClause
public boolean supportsLockingWithOuterJoin
public boolean supportsLockingWithInnerJoin
public boolean supportsLockingWithSelectRange
public boolean supportsQueryTimeout
public boolean simulateLocking
public boolean supportsSubselect
public boolean supportsCorrelatedSubselect
public boolean supportsHaving
public boolean supportsSelectStartIndex
public boolean supportsSelectEndIndex
public int rangePosition
public boolean requiresAliasForSubselect
public boolean requiresTargetForDelete
public boolean allowsAliasInBulkClause
public boolean supportsMultipleNontransactionalResultSets
public boolean requiresSearchStringEscapeForLike
public String searchStringEscape
public boolean requiresCastForMathFunctions
public boolean requiresCastForComparisons
public boolean supportsModOperator
public boolean supportsXMLColumn
public boolean supportsCaseConversionForLob
public boolean reportsSuccessNoInfoOnBatchUpdates
public boolean supportsSelectFromFinalTable
public boolean supportsSimpleCaseExpression
public boolean supportsGeneralCaseExpression
public boolean useWildCardForCount
public boolean trimSchemaName
public String castFunction
public String toLowerCaseFunction
public String toUpperCaseFunction
public String stringLengthFunction
public String bitLengthFunction
public String trimLeadingFunction
public String trimTrailingFunction
public String trimBothFunction
public String concatenateFunction
public String concatenateDelimiter
public String substringFunctionName
public String currentDateFunction
public String currentTimeFunction
public String currentTimestampFunction
public String dropTableSQL
public boolean storageLimitationsFatal
public boolean storeLargeNumbersAsStrings
public boolean storeCharsAsNumbers
public boolean useGetBytesForBlobs
public boolean useSetBytesForBlobs
public boolean useGetObjectForBlobs
public boolean useGetStringForClobs
public boolean useSetStringForClobs
public int maxEmbeddedBlobSize
public int maxEmbeddedClobSize
public int inClauseLimit
public int datePrecision
public int characterColumnSize
public String arrayTypeName
public String bigintTypeName
public String binaryTypeName
public String bitTypeName
public String blobTypeName
public String booleanTypeName
public String charTypeName
public String clobTypeName
public String dateTypeName
public String decimalTypeName
public String distinctTypeName
public String doubleTypeName
public String floatTypeName
public String integerTypeName
public String javaObjectTypeName
public String longVarbinaryTypeName
public String longVarcharTypeName
public String nullTypeName
public String numericTypeName
public String otherTypeName
public String realTypeName
public String refTypeName
public String smallintTypeName
public String structTypeName
public String timeTypeName
public String timestampTypeName
public String tinyintTypeName
public String varbinaryTypeName
public String varcharTypeName
public String xmlTypeName
public String xmlTypeEncoding
public String getStringVal
public boolean useSchemaName
public String tableTypes
public boolean supportsSchemaForGetTables
public boolean supportsSchemaForGetColumns
public boolean supportsNullTableForGetColumns
public boolean supportsNullTableForGetPrimaryKeys
public boolean supportsNullTableForGetIndexInfo
public boolean supportsNullTableForGetImportedKeys
public boolean useGetBestRowIdentifierForPrimaryKeys
public boolean requiresAutoCommitForMetaData
public boolean tableLengthIncludesSchema
public int maxAutoAssignNameLength
public String autoAssignClause
public String autoAssignTypeName
public boolean supportsAutoAssign
public String lastGeneratedKeyQuery
public String nextSequenceQuery
public String sequenceSQL
public String sequenceSchemaSQL
public String sequenceNameSQL
public int nativeSequenceType
@Deprecated public boolean useNativeSequenceCache
protected JDBCConfiguration conf
protected Log log
protected boolean connected
protected boolean isJDBC3
protected boolean isJDBC4
protected final Set<String> reservedWordSet
protected Set<String> invalidColumnWordSet
protected final Set<String> systemSchemaSet
protected final Set<String> systemTableSet
protected final Set<String> fixedSizeTypeNameSet
protected final Set<String> typeModifierSet
public boolean supportsDelimitedIdentifiers
public String leadingDelimiter
public String trailingDelimiter
public String nameConcatenator
public String delimitedCase
public String catalogSeparator
protected String defaultSchemaName
protected final Set selectWordSet
public int batchLimit
public final Map<Integer,Set<String>> sqlStateCodes
protected ProxyManager _proxyManager
Constructor Detail |
---|
public DBDictionary()
Method Detail |
---|
public void connectedConfiguration(Connection conn) throws SQLException
super.connectedConfiguration
.
SQLException
protected void configureNamingRules()
public Array getArray(ResultSet rs, int column) throws SQLException
SQLException
public InputStream getAsciiStream(ResultSet rs, int column) throws SQLException
SQLException
public BigDecimal getBigDecimal(ResultSet rs, int column) throws SQLException
SQLException
public Number getNumber(ResultSet rs, int column) throws SQLException
SQLException
public BigInteger getBigInteger(ResultSet rs, int column) throws SQLException
SQLException
public InputStream getBinaryStream(ResultSet rs, int column) throws SQLException
SQLException
public InputStream getLOBStream(JDBCStore store, ResultSet rs, int column) throws SQLException
SQLException
public Blob getBlob(ResultSet rs, int column) throws SQLException
SQLException
public Object getBlobObject(ResultSet rs, int column, JDBCStore store) throws SQLException
SQLException
public boolean getBoolean(ResultSet rs, int column) throws SQLException
SQLException
public byte getByte(ResultSet rs, int column) throws SQLException
SQLException
public byte[] getBytes(ResultSet rs, int column) throws SQLException
SQLException
public Calendar getCalendar(ResultSet rs, int column) throws SQLException
Timestamp
by default.
SQLException
public char getChar(ResultSet rs, int column) throws SQLException
SQLException
public Reader getCharacterStream(ResultSet rs, int column) throws SQLException
SQLException
public Clob getClob(ResultSet rs, int column) throws SQLException
SQLException
public String getClobString(ResultSet rs, int column) throws SQLException
SQLException
public Date getDate(ResultSet rs, int column) throws SQLException
Timestamp
by default.
SQLException
public Date getDate(ResultSet rs, int column, Calendar cal) throws SQLException
SQLException
public double getDouble(ResultSet rs, int column) throws SQLException
SQLException
public float getFloat(ResultSet rs, int column) throws SQLException
SQLException
public int getInt(ResultSet rs, int column) throws SQLException
SQLException
public Locale getLocale(ResultSet rs, int column) throws SQLException
SQLException
public long getLong(ResultSet rs, int column) throws SQLException
SQLException
public Object getObject(ResultSet rs, int column, Map map) throws SQLException
SQLException
public Ref getRef(ResultSet rs, int column, Map map) throws SQLException
SQLException
public short getShort(ResultSet rs, int column) throws SQLException
SQLException
public String getString(ResultSet rs, int column) throws SQLException
SQLException
public Time getTime(ResultSet rs, int column, Calendar cal) throws SQLException
SQLException
public Timestamp getTimestamp(ResultSet rs, int column, Calendar cal) throws SQLException
SQLException
public void setArray(PreparedStatement stmnt, int idx, Array val, Column col) throws SQLException
SQLException
public void setAsciiStream(PreparedStatement stmnt, int idx, InputStream val, int length, Column col) throws SQLException
SQLException
public void setBigDecimal(PreparedStatement stmnt, int idx, BigDecimal val, Column col) throws SQLException
SQLException
public void setBigInteger(PreparedStatement stmnt, int idx, BigInteger val, Column col) throws SQLException
SQLException
public void setBinaryStream(PreparedStatement stmnt, int idx, InputStream val, int length, Column col) throws SQLException
SQLException
public void setBlob(PreparedStatement stmnt, int idx, Blob val, Column col) throws SQLException
SQLException
public void setBlobObject(PreparedStatement stmnt, int idx, Object val, Column col, JDBCStore store) throws SQLException
serialize(java.lang.Object, org.apache.openjpa.jdbc.kernel.JDBCStore)
method to serialize the value.
SQLException
public void setBoolean(PreparedStatement stmnt, int idx, boolean val, Column col) throws SQLException
SQLException
public void setByte(PreparedStatement stmnt, int idx, byte val, Column col) throws SQLException
SQLException
public void setBytes(PreparedStatement stmnt, int idx, byte[] val, Column col) throws SQLException
SQLException
public void setChar(PreparedStatement stmnt, int idx, char val, Column col) throws SQLException
SQLException
public void setCharacterStream(PreparedStatement stmnt, int idx, Reader val, int length, Column col) throws SQLException
SQLException
public void setClob(PreparedStatement stmnt, int idx, Clob val, Column col) throws SQLException
SQLException
public void setClobString(PreparedStatement stmnt, int idx, String val, Column col) throws SQLException
SQLException
public void setDate(PreparedStatement stmnt, int idx, Date val, Column col) throws SQLException
SQLException
public void setDate(PreparedStatement stmnt, int idx, Date val, Calendar cal, Column col) throws SQLException
SQLException
public void setCalendar(PreparedStatement stmnt, int idx, Calendar val, Column col) throws SQLException
SQLException
public void setDouble(PreparedStatement stmnt, int idx, double val, Column col) throws SQLException
SQLException
public void setFloat(PreparedStatement stmnt, int idx, float val, Column col) throws SQLException
SQLException
public void setInt(PreparedStatement stmnt, int idx, int val, Column col) throws SQLException
SQLException
public void setLong(PreparedStatement stmnt, int idx, long val, Column col) throws SQLException
SQLException
public void setLocale(PreparedStatement stmnt, int idx, Locale val, Column col) throws SQLException
SQLException
public void setNull(PreparedStatement stmnt, int idx, int colType, Column col) throws SQLException
Types
.
SQLException
public void setNumber(PreparedStatement stmnt, int idx, Number num, Column col) throws SQLException
SQLException
public void setObject(PreparedStatement stmnt, int idx, Object val, int colType, Column col) throws SQLException
Types
.
SQLException
public void setRef(PreparedStatement stmnt, int idx, Ref val, Column col) throws SQLException
SQLException
public void setShort(PreparedStatement stmnt, int idx, short val, Column col) throws SQLException
SQLException
public void setString(PreparedStatement stmnt, int idx, String val, Column col) throws SQLException
SQLException
public void setTime(PreparedStatement stmnt, int idx, Time val, Calendar cal, Column col) throws SQLException
SQLException
public void setTimestamp(PreparedStatement stmnt, int idx, Timestamp val, Calendar cal, Column col) throws SQLException
SQLException
public void setTyped(PreparedStatement stmnt, int idx, Object val, Column col, int type, JDBCStore store) throws SQLException
stmnt
- the prepared statement to parameterizeidx
- the index of the parameter in the prepared statementval
- the value of the columncol
- the column being settype
- the field mapping type code for the valuestore
- the store manager for the current context
SQLException
public void setUnknown(PreparedStatement stmnt, int idx, Object val, Column col) throws SQLException
SQLException
public byte[] serialize(Object val, JDBCStore store) throws SQLException
SQLException
public void putBytes(Blob blob, byte[] data) throws SQLException
setBytes
method on the given BLOB object.
SQLException
public void putString(Clob clob, String data) throws SQLException
setString
method on the given CLOB
object.
SQLException
public void putChars(Clob clob, char[] data) throws SQLException
setCharacterStream
method on the given
CLOB object.
SQLException
protected void storageWarning(Object orig, Object converted)
public int getJDBCType(int metaTypeCode, boolean lob)
Types
constant for the given
JavaTypes
or JavaSQLTypes
constant.
public int getJDBCType(int metaTypeCode, boolean lob, int precis, int scale, boolean xml)
Types
constant for the given
JavaTypes
or JavaSQLTypes
constant.
public int getJDBCType(int metaTypeCode, boolean lob, int precis, int scale)
Types
constant for the given
JavaTypes
or JavaSQLTypes
constant.
public int getPreferredType(int type)
Types
type for the given one. Returns
the given type by default.
public String getTypeName(Column col)
Types
.
public String getTypeName(int type)
Types
.
type
- the type
protected String appendSize(Column col, String typeName)
fixedSizeTypeNameSet
).
Some databases support "type modifiers", for example the unsigned
"modifier" in MySQL. In these cases the size should go between the type
and the "modifier", instead of after the modifier. For example
CREATE table FOO ( myint INT (10) UNSIGNED . . .) instead of
CREATE table FOO ( myint INT UNSIGNED (10) . . .).
Type modifiers should be added to typeModifierSet
in
subclasses.
protected String insertSize(String typeName, String size)
typeName
- The SQL type e.g. INTsize
- The size clause e.g. (10)
appendSize
public void setJoinSyntax(String syntax)
public String getPlaceholderValueString(Column col)
public SQLBuffer toSelectCount(Select sel)
public SQLBuffer toDelete(ClassMapping mapping, Select sel, Object[] params)
public SQLBuffer toUpdate(ClassMapping mapping, Select sel, JDBCStore store, Object[] params, Map updates)
protected SQLBuffer toBulkOperation(ClassMapping mapping, Select sel, JDBCStore store, Object[] params, Map updateParams)
mapping
- the mapping against which we are operatingsel
- the Select that will constitute the WHERE clausestore
- the current storeupdateParams
- the Map that holds the update parameters; a null
value indicates that this is a delete operation
protected Collection<String> getSelectTableAliases(Select sel)
protected SQLBuffer getDeleteTargets(Select sel)
protected void appendUpdates(Select sel, JDBCStore store, SQLBuffer sql, Object[] params, Map updateParams, boolean allowAlias)
public String[] getDeleteTableContentsSQL(Table[] tables, Connection conn)
public SQLBuffer toSelect(Select sel, boolean forUpdate, JDBCFetchConfiguration fetch)
protected SQLBuffer getFrom(Select sel, boolean forUpdate)
protected SQLBuffer getFromSelect(Select sel, boolean forUpdate)
protected SQLBuffer getWhere(Select sel, boolean forUpdate)
public SQLBuffer toTraditionalJoin(Join join)
public SQLBuffer toSQL92Join(Select sel, Join join, boolean forUpdate, boolean first)
public SQLBuffer toNativeJoin(Join join)
public boolean canOuterJoin(int syntax, ForeignKey fk)
public SQLBuffer toSelect(SQLBuffer selects, JDBCFetchConfiguration fetch, SQLBuffer from, SQLBuffer where, SQLBuffer group, SQLBuffer having, SQLBuffer order, boolean distinct, boolean forUpdate, long start, long end)
protected SQLBuffer toSelect(SQLBuffer selects, JDBCFetchConfiguration fetch, SQLBuffer from, SQLBuffer where, SQLBuffer group, SQLBuffer having, SQLBuffer order, boolean distinct, boolean forUpdate, long start, long end, boolean subselect, Select sel)
public SQLBuffer toSelect(SQLBuffer selects, JDBCFetchConfiguration fetch, SQLBuffer from, SQLBuffer where, SQLBuffer group, SQLBuffer having, SQLBuffer order, boolean distinct, boolean forUpdate, long start, long end, boolean subselect, boolean checkTableForUpdate)
protected SQLBuffer toSelect(SQLBuffer selects, JDBCFetchConfiguration fetch, SQLBuffer from, SQLBuffer where, SQLBuffer group, SQLBuffer having, SQLBuffer order, boolean distinct, boolean forUpdate, long start, long end, Select sel)
protected String getForUpdateClause(JDBCFetchConfiguration fetch, boolean isForUpdate, Select sel)
public boolean supportsIsolationForUpdate()
public String getSelectOperation(JDBCFetchConfiguration fetch)
public SQLBuffer toOperation(String op, SQLBuffer selects, SQLBuffer from, SQLBuffer where, SQLBuffer group, SQLBuffer having, SQLBuffer order, boolean distinct, long start, long end, String forUpdateClause)
public SQLBuffer toOperation(String op, SQLBuffer selects, SQLBuffer from, SQLBuffer where, SQLBuffer group, SQLBuffer having, SQLBuffer order, boolean distinct, long start, long end, String forUpdateClause, boolean subselect)
protected void appendSelectRange(SQLBuffer buf, long start, long end, boolean subselect)
protected SQLBuffer getSelects(Select sel, boolean distinctIdentifiers, boolean forUpdate)
protected void appendSelect(SQLBuffer selectSQL, Object elem, Select sel, int idx)
elem
to selectSQL
.
selectSQL
- The SQLBuffer to append to.alias
- A SQLBuffer
or a String
to append.public boolean supportsLocking(Select sel)
public boolean supportsRandomAccessResultSet(Select sel, boolean forUpdate)
public void assertSupport(boolean feature, String property)
public void substring(SQLBuffer buf, FilterValue str, FilterValue start, FilterValue length)
buf
- the SQL buffer to write the substring invocation tostr
- a query value representing the target stringstart
- a query value representing the start indexlength
- a query value representing the length of substring, or null for nonelong toLong(FilterValue litValue)
public void indexOf(SQLBuffer buf, FilterValue str, FilterValue find, FilterValue start)
buf
- the SQL buffer to write the indexOf invocation tostr
- a query value representing the target stringfind
- a query value representing the search stringstart
- a query value representing the start index, or null
to start at the beginningpublic void mathFunction(SQLBuffer buf, String op, FilterValue lhs, FilterValue rhs)
buf
- the SQL buffer to write the math functionop
- the mathematical operation to performlhs
- the left hand side of the math functionrhs
- the right hand side of the math functionpublic void comparison(SQLBuffer buf, String op, FilterValue lhs, FilterValue rhs)
buf
- the SQL buffer to write the comparisonop
- the comparison operation to performlhs
- the left hand side of the comparisonrhs
- the right hand side of the comparisonpublic void appendXmlComparison(SQLBuffer buf, String op, FilterValue lhs, FilterValue rhs, boolean lhsxml, boolean rhsxml)
protected void appendNumericCast(SQLBuffer buf, FilterValue val)
public void appendCast(SQLBuffer buf, Object val, int type)
buf
- the buffer to append the cast toval
- the value to casttype
- the type of the case, e.g. Types.NUMERIC
protected void appendLength(SQLBuffer buf, int type)
public String addCastAsType(String func, Val val)
func
- function nameval
-
public void refSchemaComponents(Table table)
public DBIdentifier getColumnIdentifier(Column column)
public String getColumnDBName(Column column)
public DBIdentifier getFullIdentifier(Table table, boolean logical)
catalogSeparator
).
public String getFullName(Table table, boolean logical)
public String getFullName(Index index)
catalogSeparator
).
public String getFullName(Sequence seq)
catalogSeparator
).
public final Set<String> getInvalidColumnWordSet()
getValidColumnName
public String getValidTableName(String name, Schema schema)
public DBIdentifier getValidTableName(DBIdentifier name, Schema schema)
public String getValidSequenceName(String name, Schema schema)
public DBIdentifier getValidSequenceName(DBIdentifier name, Schema schema)
public String getValidColumnName(String name, Table table)
public DBIdentifier getValidColumnName(DBIdentifier name, Table table)
public String getValidColumnName(String name, Table table, boolean checkForUniqueness)
public DBIdentifier getValidColumnName(DBIdentifier name, Table table, boolean checkForUniqueness)
public String getValidPrimaryKeyName(String name, Table table)
public String getValidForeignKeyName(String name, Table table, Table toTable)
public DBIdentifier getValidForeignKeyName(DBIdentifier name, Table table, Table toTable)
public String getValidIndexName(String name, Table table)
public DBIdentifier getValidIndexName(DBIdentifier name, Table table)
public String getValidUniqueName(String name, Table table)
public DBIdentifier getValidUniqueName(DBIdentifier name, Table table)
public static String shorten(String name, int targetLength)
protected String makeNameValid(String name, NameSet set, int maxLen, int nameType)
protected DBIdentifier makeNameValid(DBIdentifier name, NameSet set, int maxLen, int nameType)
protected String makeNameValid(String name, NameSet set, int maxLen, int nameType, boolean checkForUniqueness)
protected DBIdentifier makeNameValid(DBIdentifier name, NameSet set, int maxLen, int nameType, boolean checkForUniqueness)
public String[] getCreateTableSQL(Table table, SchemaGroup group)
public String[] getCreateTableSQL(Table table)
public int getBatchFetchSize(int batchFetchSize)
protected StringBuilder comment(StringBuilder buf, String comment)
public String[] getDropTableSQL(Table table)
DROP TABLE <table name>
by default.
public String[] getCreateSequenceSQL(Sequence seq)
CREATE SEQUENCE <sequence name>[ START WITH <start>]
[ INCREMENT BY <increment>]
by default.
public String getAlterSequenceSQL(Sequence seq)
public String[] getDropSequenceSQL(Sequence seq)
DROP SEQUENCE <sequence name>
by default.
public String[] getCreateIndexSQL(Index index)
CREATE [UNIQUE] INDEX <index name> ON <table name>
(<col list>)
by default.
public String[] getDropIndexSQL(Index index)
DROP INDEX <index name>
by default.
public String[] getAddColumnSQL(Column column)
ALTER TABLE <table name> ADD (<col dec>)
by default.
public String[] getDropColumnSQL(Column column)
ALTER TABLE <table name> DROP COLUMN <col name>
by default.
public String[] getAddPrimaryKeySQL(PrimaryKey pk)
ALTER TABLE <table name> ADD
<pk cons sql >
by default.
public String[] getDropPrimaryKeySQL(PrimaryKey pk)
ALTER TABLE <table name> DROP CONSTRAINT
<pk name>
by default.
public String[] getAddForeignKeySQL(ForeignKey fk)
ALTER TABLE <table name> ADD
<fk cons sql >
by default.
public String[] getDropForeignKeySQL(ForeignKey fk, Connection conn)
ALTER TABLE <table name> DROP CONSTRAINT
<fk name>
by default.
protected String getDeclareColumnSQL(Column col, boolean alter)
getCreateTableSQL(org.apache.openjpa.jdbc.schema.Table, org.apache.openjpa.jdbc.schema.SchemaGroup)
and
getAddColumnSQL(org.apache.openjpa.jdbc.schema.Column)
.
protected String getPrimaryKeyConstraintSQL(PrimaryKey pk)
getCreateTableSQL(org.apache.openjpa.jdbc.schema.Table, org.apache.openjpa.jdbc.schema.SchemaGroup)
and
getAddPrimaryKeySQL(org.apache.openjpa.jdbc.schema.PrimaryKey)
. Returns
CONSTRAINT <pk name> PRIMARY KEY (<col list>)
by default.
protected String getForeignKeyConstraintSQL(ForeignKey fk)
getCreateTableSQL(org.apache.openjpa.jdbc.schema.Table, org.apache.openjpa.jdbc.schema.SchemaGroup)
and getAddForeignKeySQL(org.apache.openjpa.jdbc.schema.ForeignKey)
. Returns
CONSTRAINT <cons name> FOREIGN KEY (<col list>)
REFERENCES <foreign table> (<col list>)
[ON DELETE <action>] [ON UPDATE <action>]
by default.
protected boolean supportsDeferredForeignKeyConstraints()
supportsUniqueConstraints
.
public boolean supportsDeleteAction(int action)
public boolean supportsUpdateAction(int action)
protected String getUniqueConstraintSQL(Unique unq)
getCreateTableSQL(org.apache.openjpa.jdbc.schema.Table, org.apache.openjpa.jdbc.schema.SchemaGroup)
.
Returns CONSTRAINT <name> UNIQUE (<col list>)
by default.
protected boolean supportsDeferredUniqueConstraints()
supportsUniqueConstraints
.
public boolean isSystemTable(String name, String schema, boolean targetSchema)
name
- the table nameschema
- the table schema; may be nulltargetSchema
- if true, then the given schema was listed by
the user as one of his schemaspublic boolean isSystemTable(DBIdentifier name, DBIdentifier schema, boolean targetSchema)
name
- the table nameschema
- the table schema; may be nulltargetSchema
- if true, then the given schema was listed by
the user as one of his schemaspublic boolean isSystemIndex(String name, Table table)
name
- the index nametable
- the index tablepublic boolean isSystemIndex(DBIdentifier name, Table table)
name
- the index nametable
- the index tablepublic boolean isSystemSequence(String name, String schema, boolean targetSchema)
name
- the table nameschema
- the table schema; may be nulltargetSchema
- if true, then the given schema was listed by
the user as one of his schemaspublic boolean isSystemSequence(DBIdentifier name, DBIdentifier schema, boolean targetSchema)
name
- the table nameschema
- the table schema; may be nulltargetSchema
- if true, then the given schema was listed by
the user as one of his schemaspublic boolean isSystemSequence(DBIdentifier name, DBIdentifier schema, boolean targetSchema, Connection conn)
name
- the table nameschema
- the table schema; may be nulltargetSchema
- if true, then the given schema was listed by
the user as one of his schemasconn
- connection to the databasepublic Table[] getTables(DatabaseMetaData meta, String catalog, String schemaName, String tableName, Connection conn) throws SQLException
SQLException
public Table[] getTables(DatabaseMetaData meta, DBIdentifier sqlCatalog, DBIdentifier sqlSchemaName, DBIdentifier sqlTableName, Connection conn) throws SQLException
SQLException
protected Table newTable(ResultSet tableMeta) throws SQLException
SQLException
public Sequence[] getSequences(DatabaseMetaData meta, String catalog, String schemaName, String sequenceName, Connection conn) throws SQLException
SQLException
public Sequence[] getSequences(DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier sequenceName, Connection conn) throws SQLException
SQLException
protected Sequence newSequence(ResultSet sequenceMeta) throws SQLException
SQLException
protected String getSequencesSQL(String schemaName, String sequenceName)
protected String getSequencesSQL(DBIdentifier schemaName, DBIdentifier sequenceName)
public Column[] getColumns(DatabaseMetaData meta, String catalog, String schemaName, String tableName, String columnName, Connection conn) throws SQLException
SQLException
public Column[] getColumns(DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, DBIdentifier columnName, Connection conn) throws SQLException
SQLException
protected Column newColumn(ResultSet colMeta) throws SQLException
SQLException
public PrimaryKey[] getPrimaryKeys(DatabaseMetaData meta, String catalog, String schemaName, String tableName, Connection conn) throws SQLException
SQLException
public PrimaryKey[] getPrimaryKeys(DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, Connection conn) throws SQLException
SQLException
protected PrimaryKey[] getPrimaryKeysFromGetPrimaryKeys(DatabaseMetaData meta, String catalog, String schemaName, String tableName, Connection conn) throws SQLException
SQLException
protected PrimaryKey[] getPrimaryKeysFromGetPrimaryKeys(DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, Connection conn) throws SQLException
SQLException
protected PrimaryKey newPrimaryKey(ResultSet pkMeta) throws SQLException
SQLException
protected PrimaryKey[] getPrimaryKeysFromBestRowIdentifier(DatabaseMetaData meta, String catalog, String schemaName, String tableName, Connection conn) throws SQLException
SQLException
protected PrimaryKey[] getPrimaryKeysFromBestRowIdentifier(DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, Connection conn) throws SQLException
SQLException
public Index[] getIndexInfo(DatabaseMetaData meta, String catalog, String schemaName, String tableName, boolean unique, boolean approx, Connection conn) throws SQLException
SQLException
public Index[] getIndexInfo(DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, boolean unique, boolean approx, Connection conn) throws SQLException
SQLException
protected Index newIndex(ResultSet idxMeta) throws SQLException
SQLException
public ForeignKey[] getImportedKeys(DatabaseMetaData meta, String catalog, String schemaName, String tableName, Connection conn) throws SQLException
SQLException
public ForeignKey[] getImportedKeys(DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, Connection conn) throws SQLException
SQLException
public ForeignKey[] getImportedKeys(DatabaseMetaData meta, String catalog, String schemaName, String tableName, Connection conn, boolean partialKeys) throws SQLException
SQLException
public ForeignKey[] getImportedKeys(DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, Connection conn, boolean partialKeys) throws SQLException
SQLException
protected ForeignKey combineForeignKey(Map<ForeignKey.FKMapKey,ForeignKey> fkMap, ForeignKey fk)
protected ForeignKey newForeignKey(ResultSet fkMeta) throws SQLException
SQLException
protected String getTableNameForMetadata(String tableName)
DatabaseMetaData
.
protected String getTableNameForMetadata(DBIdentifier tableName)
DatabaseMetaData
.
protected String getSchemaNameForMetadata(String schemaName)
DatabaseMetaData
.
protected String getSchemaNameForMetadata(DBIdentifier schemaName)
DatabaseMetaData
.
protected String getCatalogNameForMetadata(String catalogName)
DatabaseMetaData
.
protected String getCatalogNameForMetadata(DBIdentifier catalogName)
DatabaseMetaData
.
protected String getColumnNameForMetadata(String columnName)
DatabaseMetaData
.
protected String getColumnNameForMetadata(DBIdentifier columnName)
DatabaseMetaData
.
public String convertSchemaCase(String objectName)
public String convertSchemaCase(DBIdentifier objectName)
public String getSchemaCase()
getSchemaCase
in interface IdentifierConfiguration
public Object getGeneratedKey(Column col, Connection conn) throws SQLException
lastGeneratedKeyQuery
is null.
SQLException
protected String getGenKeySeqName(String query, Column col)
protected String getGeneratedKeySequenceName(Column col)
public void setConfiguration(Configuration conf)
Configurable
setConfiguration
in interface Configurable
public void startConfiguration()
Configurable
startConfiguration
in interface Configurable
public void endConfiguration()
Configurable
endConfiguration
in interface Configurable
public void addErrorCode(int errorType, String errorCode)
public void setTimeouts(PreparedStatement stmnt, JDBCFetchConfiguration fetch, boolean forUpdate) throws SQLException
stmnt
- fetch
- - optional lock and query timeouts in millisecondsforUpdate
- - true if we should also try setting a lock timeout
SQLException
public void setTimeouts(PreparedStatement stmnt, JDBCConfiguration conf, boolean forUpdate) throws SQLException
stmnt
- conf
- - optional lock and query timeouts in millisecondsforUpdate
- - true if we should also try setting a lock timeout
SQLException
public void setQueryTimeout(PreparedStatement stmnt, int timeout) throws SQLException
stmnt
- timeout
- in milliseconds
SQLException
protected void setStatementQueryTimeout(PreparedStatement stmnt, int timeout) throws SQLException
stmnt
- timeout
- in milliseconds
SQLException
public Connection decorate(Connection conn) throws SQLException
initializationSQL
that has been set for the dictionary but
does not decorate the connection.
decorate
in interface ConnectionDecorator
SQLException
public void handleWarning(SQLWarning warning) throws SQLException
LoggingConnectionDecorator.SQLWarningHandler
interface
that allows customization of the actions to perform when a
SQLWarning
occurs at any point on a Connection
,
Statement
, or ResultSet
. This method may
be used determine those warnings the application wants to
consider critical failures, and throw the warning in those
cases. By default, this method does nothing.
handleWarning
in interface LoggingConnectionDecorator.SQLWarningHandler
SQLException
LoggingConnectionDecorator.setWarningAction(java.lang.String)
,
LoggingConnectionDecorator.setWarningHandler(org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.SQLWarningHandler)
public OpenJPAException newStoreException(String msg, SQLException[] causes, Object failed)
causes
.
However, the details of exactly what type of exception is returned can
be determined by the implementation. This may take into account
DB-specific exception information in causes
.
OpenJPAException narrow(String msg, SQLException ex, Object failed)
general
category
if the given SQL Exception can not be further categorized.matchErrorState(Map, SQLException)
protected int matchErrorState(Map<Integer,Set<String>> errorStates, SQLException ex)
errorStates
- classification of SQL error states by their specific nature. The keys of the
map represent one of the constants defined in StoreException
. The value corresponding to
a key represent the set of SQL Error States representing specific category of database error.
This supplied map is sourced from sql-error-state-codes.xml and filtered the
error states for the current database.ex
- original SQL Exception as raised by the database driver.
- Returns:
- A constant indicating the category of error as defined in
StoreException
.
public boolean isFatalException(int subtype, SQLException ex)
subtype
- A constant indicating the category of error as defined in StoreException
.ex
- original SQL Exception as raised by the database driver.
public void closeDataSource(DataSource dataSource)
DataSource
and releases any
resources associated with it.
dataSource
- the DataSource to closepublic String getVersionColumn(Column column, String tableAlias)
column
- tableAlias
- : this is needed for platform specific version column
public DBIdentifier getVersionColumn(Column column, DBIdentifier tableAlias)
public void insertBlobForStreamingLoad(Row row, Column col, JDBCStore store, Object ob, Select sel) throws SQLException
SQLException
public void insertClobForStreamingLoad(Row row, Column col, Object ob) throws SQLException
SQLException
public void updateBlob(Select sel, JDBCStore store, InputStream is) throws SQLException
SQLException
public void updateClob(Select sel, JDBCStore store, Reader reader) throws SQLException
SQLException
protected long copy(InputStream in, OutputStream out) throws IOException
IOException
protected long copy(Reader reader, Writer writer) throws IOException
IOException
public String getCastFunction(Val val, String func)
val
- operand value
public String getCastFunction(Val val, String func, Column col)
val
- operand of castfunc
- original stringcol
- database column
public void createIndexIfNecessary(Schema schema, String table, Column pkColumn)
public void createIndexIfNecessary(Schema schema, DBIdentifier table, Column pkColumn)
public int getBatchLimit()
public void setBatchLimit(int limit)
public boolean validateBatchProcess(RowImpl row, Column[] autoAssign, OpenJPAStateManager sm, ClassMapping cmd)
public boolean validateDBSpecificBatchProcess(boolean disableBatch, RowImpl row, Column[] autoAssign, OpenJPAStateManager sm, ClassMapping cmd)
protected ResultSet executeQuery(Connection conn, PreparedStatement stmnt, String sql) throws SQLException
SQLException
protected PreparedStatement prepareStatement(Connection conn, String sql) throws SQLException
SQLException
protected Sequence[] getSequence(ResultSet rs) throws SQLException
SQLException
protected Object getKey(ResultSet rs, Column col) throws SQLException
SQLException
protected void calculateValue(Val val, Select sel, ExpContext ctx, ExpState state, Path path, ExpState pathState)
public boolean isSelect(String sql)
sql
may be treated as a
select statement on this database.
sql
- A sql statement.
sql
represents a select statement.public boolean needsToCreateIndex(Index idx, Table table, Unique[] uniques)
public boolean needsToCreateIndex(Index idx, Table table)
public int getBatchUpdateCount(PreparedStatement ps) throws SQLException
ps
- A PreparedStatement
SQLException
public boolean getTrimSchemaName()
public void setTrimSchemaName(boolean trimSchemaName)
public void deleteStream(JDBCStore store, Select sel) throws SQLException
SQLException
final String checkNameLength(String name, int length, String msgKey)
final String checkNameLength(DBIdentifier identifier, int length, String msgKey)
DBIdentifier
by default..
identifer
- The database identifier to check.length
- Max length for this type of identifiermsgKey
- message identifier for the exception.qualified
- If true the qualified name of the DBIdentifier will be used.
{@link
- UserException} with the given message key if the given name is indeed longer.final String checkNameLength(DBIdentifier identifier, int length, String msgKey, boolean qualified)
DBIdentifier
.
identifer
- The database identifier to check.length
- Max length for this type of identifiermsgKey
- message identifier for the exception.qualified
- If true the qualified name of the DBIdentifier will be used.
{@link
- UserException} with the given message key if the given name is indeed longer.protected void setDelimitedCase(DatabaseMetaData metaData)
public boolean getSupportsDelimitedIdentifiers()
IdentifierConfiguration
getSupportsDelimitedIdentifiers
in interface IdentifierConfiguration
public void setSupportsDelimitedIdentifiers(DatabaseMetaData metaData)
supportsDelimitedIds
- the supportsDelimitedIds to setpublic boolean getDelimitIdentifiers()
public void setDelimitIdentifiers(boolean delimitIds)
delimitIds
- the delimitIds to setpublic boolean getSupportsXMLColumn()
public void setSupportsXMLColumn(boolean b)
b
- boolean representing if XML columns are supportedpublic String getXMLTypeEncoding()
public void setXMLTypeEncoding(String encoding)
encoding
- database required JAXB encoding for the XML valuepublic Log getLog()
public boolean delimitAll()
IdentifierConfiguration
delimitAll
in interface IdentifierConfiguration
public String getLeadingDelimiter()
IdentifierConfiguration
getLeadingDelimiter
in interface IdentifierConfiguration
public void setLeadingDelimiter(String delim)
public String getIdentifierDelimiter()
IdentifierConfiguration
getIdentifierDelimiter
in interface IdentifierConfiguration
public String getIdentifierConcatenator()
IdentifierConfiguration
getIdentifierConcatenator
in interface IdentifierConfiguration
public String getTrailingDelimiter()
IdentifierConfiguration
getTrailingDelimiter
in interface IdentifierConfiguration
public void setTrailingDelimiter(String delim)
public IdentifierRule getDefaultIdentifierRule()
IdentifierConfiguration
getDefaultIdentifierRule
in interface IdentifierConfiguration
public <T> IdentifierRule getIdentifierRule(T t)
IdentifierConfiguration
getIdentifierRule
in interface IdentifierConfiguration
public Map<String,IdentifierRule> getIdentifierRules()
IdentifierConfiguration
getIdentifierRules
in interface IdentifierConfiguration
public DBIdentifierUtil getNamingUtil()
public String getDelimitedCase()
IdentifierConfiguration
getDelimitedCase
in interface IdentifierConfiguration
public String toDBName(DBIdentifier name)
public String toDBName(DBIdentifier name, boolean delimit)
public DBIdentifier fromDBName(String name, DBIdentifier.DBIdentifierType id)
public void setDefaultSchemaName(String defaultSchemaName)
public String getDefaultSchemaName()
public String getConversionKey()
IdentifierConfiguration
getConversionKey
in interface IdentifierConfiguration
public String getMarkerForInsertUpdate(Column col, Object val)
?
but some database-specific types might require customization.
col
- column definitionval
- value to be inserted/updated
public String getIsNullSQL(String colAlias, int colType)
public String getIsNotNullSQL(String colAlias, int colType)
public String getIdentityColumnName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |