Package org.apache.openjpa.jdbc.sql
Class DBDictionary
- java.lang.Object
-
- org.apache.openjpa.jdbc.sql.DBDictionary
-
- All Implemented Interfaces:
JoinSyntaxes
,Configurable
,IdentifierConfiguration
,ConnectionDecorator
,LoggingConnectionDecorator.SQLWarningHandler
- Direct Known Subclasses:
AbstractDB2Dictionary
,AbstractSQLServerDictionary
,AccessDictionary
,CacheDictionary
,EmpressDictionary
,FirebirdDictionary
,FoxProDictionary
,H2Dictionary
,HerdDBDictionary
,HSQLDictionary
,InformixDictionary
,IngresDictionary
,InterbaseDictionary
,JDataStoreDictionary
,MariaDBDictionary
,MaxDBDictionary
,MySQLDictionary
,OracleDictionary
,PointbaseDictionary
,PostgresDictionary
,SolidDBDictionary
public class DBDictionary extends java.lang.Object implements Configurable, ConnectionDecorator, JoinSyntaxes, LoggingConnectionDecorator.SQLWarningHandler, IdentifierConfiguration
Class which allows the creation of SQL dynamically, in a database agnostic fashion. Subclass for the nuances of different data stores.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DBDictionary.DateMillisecondBehaviors
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.
-
Field Summary
-
Fields inherited from interface org.apache.openjpa.jdbc.sql.JoinSyntaxes
SYNTAX_DATABASE, SYNTAX_SQL92, SYNTAX_TRADITIONAL
-
-
Constructor Summary
Constructors Constructor Description DBDictionary()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.String
addCastAsType(java.lang.String func, Val val)
add CAST for a function operator where operand is a paramvoid
addErrorCode(int errorType, java.lang.String errorCode)
void
appendCast(SQLBuffer buf, java.lang.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, java.lang.Object elem, Select sel, int idx)
Appendelem
toselectSQL
.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 java.lang.String
appendSize(Column col, java.lang.String typeName)
Helper method to add size properties to the specified type.protected void
appendUpdates(Select sel, JDBCStore store, SQLBuffer sql, java.lang.Object[] params, java.util.Map updateParams, boolean allowAlias)
void
appendXmlComparison(SQLBuffer buf, java.lang.String op, FilterValue lhs, FilterValue rhs, boolean lhsxml, boolean rhsxml)
If this dictionary supports XML type, use this method to append xml predicate.int
applyRange(Select select, int count)
void
assertSupport(boolean feature, java.lang.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.void
closeDataSource(javax.sql.DataSource dataSource)
Closes the specifiedDataSource
and releases any resources associated with it.protected ForeignKey
combineForeignKey(java.util.Map<ForeignKey.FKMapKey,ForeignKey> fkMap, ForeignKey fk)
Combines partial foreign keys into singular keyprotected java.lang.StringBuilder
comment(java.lang.StringBuilder buf, java.lang.String comment)
void
comparison(SQLBuffer buf, java.lang.String op, FilterValue lhs, FilterValue rhs)
Append a comparison.protected void
configureNamingRules()
Configures the naming rules for this dictionary.void
connectedConfiguration(java.sql.Connection conn)
This method is called when the dictionary first sees any connection.java.lang.String
convertSchemaCase(java.lang.String objectName)
Convert the specified schema name to a name that the database will be able to understand.java.lang.String
convertSchemaCase(DBIdentifier objectName)
Convert the specified schema name to a name that the database will be able to understand.protected long
copy(java.io.InputStream in, java.io.OutputStream out)
protected long
copy(java.io.Reader reader, java.io.Writer writer)
void
createIndexIfNecessary(Schema schema, java.lang.String table, Column pkColumn)
Deprecated.void
createIndexIfNecessary(Schema schema, DBIdentifier table, Column pkColumn)
java.sql.Connection
decorate(java.sql.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 java.sql.ResultSet
executeQuery(java.sql.Connection conn, java.sql.PreparedStatement stmnt, java.lang.String sql)
This method is to provide override for non-JDBC or JDBC-like implementation of executing query.DBIdentifier
fromDBName(java.lang.String name, DBIdentifier.DBIdentifierType id)
java.lang.String[]
getAddColumnSQL(Column column)
Return a series of SQL statements to add the given column to its table.java.lang.String[]
getAddForeignKeySQL(ForeignKey fk)
Return a series of SQL statements to add the given foreign key to its table.java.lang.String[]
getAddPrimaryKeySQL(PrimaryKey pk)
Return a series of SQL statements to add the given primary key to its table.java.lang.String
getAlterSequenceSQL(Sequence seq)
java.sql.Array
getArray(java.sql.ResultSet rs, int column)
Convert the specified column of the SQL ResultSet to the proper java type.java.io.InputStream
getAsciiStream(java.sql.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 batchLimitint
getBatchUpdateCount(java.sql.PreparedStatement ps)
Return batched statements update success countjava.math.BigDecimal
getBigDecimal(java.sql.ResultSet rs, int column)
Convert the specified column of the SQL ResultSet to the proper java type.java.math.BigInteger
getBigInteger(java.sql.ResultSet rs, int column)
Convert the specified column of the SQL ResultSet to the proper java type.java.io.InputStream
getBinaryStream(java.sql.ResultSet rs, int column)
Convert the specified column of the SQL ResultSet to the proper java type.java.sql.Blob
getBlob(java.sql.ResultSet rs, int column)
Convert the specified column of the SQL ResultSet to the proper java type.java.lang.Object
getBlobObject(java.sql.ResultSet rs, int column, JDBCStore store)
Convert the specified column of the SQL ResultSet to the proper java type.boolean
getBoolean(java.sql.ResultSet rs, int column)
Convert the specified column of the SQL ResultSet to the proper java type.BooleanRepresentation
getBooleanRepresentation()
byte
getByte(java.sql.ResultSet rs, int column)
Convert the specified column of the SQL ResultSet to the proper java type.byte[]
getBytes(java.sql.ResultSet rs, int column)
Convert the specified column of the SQL ResultSet to the proper java type.java.util.Calendar
getCalendar(java.sql.ResultSet rs, int column)
Convert the specified column of the SQL ResultSet to the proper java type.java.lang.String
getCastFunction(Val val, java.lang.String func)
Attach CAST to the current function if necessaryjava.lang.String
getCastFunction(Val val, java.lang.String func, Column col)
Return the correct CAST function syntax.protected java.lang.String
getCatalogNameForMetadata(java.lang.String catalogName)
Returns the catalog name that will be used for obtaining information fromDatabaseMetaData
.protected java.lang.String
getCatalogNameForMetadata(DBIdentifier catalogName)
Returns the catalog name that will be used for obtaining information fromDatabaseMetaData
.char
getChar(java.sql.ResultSet rs, int column)
Convert the specified column of the SQL ResultSet to the proper java type.java.io.Reader
getCharacterStream(java.sql.ResultSet rs, int column)
Convert the specified column of the SQL ResultSet to the proper java type.java.sql.Clob
getClob(java.sql.ResultSet rs, int column)
Convert the specified column of the SQL ResultSet to the proper java type.java.lang.String
getClobString(java.sql.ResultSet rs, int column)
Convert the specified column of the SQL ResultSet to the proper java type.java.lang.String
getColumnDBName(Column column)
DBIdentifier
getColumnIdentifier(Column column)
Returns the name of the column using database specific delimiters.protected java.lang.String
getColumnNameForMetadata(java.lang.String columnName)
Returns the column name that will be used for obtaining information fromDatabaseMetaData
.protected java.lang.String
getColumnNameForMetadata(DBIdentifier columnName)
Returns the column name that will be used for obtaining information fromDatabaseMetaData
.Column[]
getColumns(java.sql.DatabaseMetaData meta, java.lang.String catalog, java.lang.String schemaName, java.lang.String tableName, java.lang.String columnName, java.sql.Connection conn)
Deprecated.Column[]
getColumns(java.sql.DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, DBIdentifier columnName, java.sql.Connection conn)
Reflect on the schema to find columns matching the given table and column patterns.java.lang.String
getConversionKey()
Returns a key that can be used to determine whether conversion should take place.java.lang.String[]
getCreateIndexSQL(Index index)
Return a series of SQL statements to create the given index.java.lang.String[]
getCreateSequenceSQL(Sequence seq)
Return a series of SQL statements to create the given sequence.java.lang.String[]
getCreateTableSQL(Table table)
Return a series of SQL statements to create the given table, complete with columns.java.lang.String[]
getCreateTableSQL(Table table, SchemaGroup group)
Return a series of SQL statements to create the given table, complete with columns.java.util.Date
getDate(java.sql.ResultSet rs, int column)
Convert the specified column of the SQL ResultSet to the proper java type.java.sql.Date
getDate(java.sql.ResultSet rs, int column, java.util.Calendar cal)
Convert the specified column of the SQL ResultSet to the proper java type.protected int
getDateFractionDigits(Column col, java.lang.String typeName)
Only get's used if no explicit scale is used (@{code @Column(scale=0)} which is the default).protected java.lang.String
getDeclareColumnSQL(Column col, boolean alter)
Return the declaration SQL for the given column.IdentifierRule
getDefaultIdentifierRule()
Gets the default naming rulejava.lang.String
getDefaultSchemaName()
java.lang.String[]
getDeleteTableContentsSQL(Table[] tables, java.sql.Connection conn)
Create SQL to delete the contents of the specified tables.protected SQLBuffer
getDeleteTargets(Select sel)
java.lang.String
getDelimitedCase()
Returns the case that is used when delimiting.boolean
getDelimitIdentifiers()
double
getDouble(java.sql.ResultSet rs, int column)
Convert the specified column of the SQL ResultSet to the proper java type.java.lang.String[]
getDropColumnSQL(Column column)
Return a series of SQL statements to drop the given column from its table.java.lang.String[]
getDropForeignKeySQL(ForeignKey fk, java.sql.Connection conn)
Return a series of SQL statements to drop the given foreign key from its table.java.lang.String[]
getDropIndexSQL(Index index)
Return a series of SQL statements to drop the given index.java.lang.String[]
getDropPrimaryKeySQL(PrimaryKey pk)
Return a series of SQL statements to drop the given primary key from its table.java.lang.String[]
getDropSequenceSQL(Sequence seq)
Return a series of SQL statements to drop the given sequence.java.lang.String[]
getDropTableSQL(Table table)
Return a series of SQL statements to drop the given table.float
getFloat(java.sql.ResultSet rs, int column)
Convert the specified column of the SQL ResultSet to the proper java type.protected java.lang.String
getForeignKeyConstraintSQL(ForeignKey fk)
Return the declaration SQL for the given foreign key, or null if it is not supported.protected java.lang.String
getForUpdateClause(JDBCFetchConfiguration fetch, boolean isForUpdate, Select sel)
Get the update clause for the query based on the updateClause and isolationLevel hintsprotected 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 bycatalogSeparator
).java.lang.String
getFullName(Index index)
Returns the full name of the index, including the schema (delimited by the result ofcatalogSeparator
).java.lang.String
getFullName(Sequence seq)
Returns the full name of the sequence, including the schema (delimited by the result ofcatalogSeparator
).java.lang.String
getFullName(Table table, boolean logical)
java.lang.Object
getGeneratedKey(Column col, java.sql.Connection conn)
Return the last generated value for the given column.protected java.lang.String
getGeneratedKeySequenceName(Column col)
Return the sequence name used by databases for the given autoassigned column.protected java.lang.String
getGenKeySeqName(java.lang.String query, Column col)
java.lang.String
getIdentifierConcatenator()
Returns the value used to concatenate multiple names together.java.lang.String
getIdentifierDelimiter()
Returns the value used to delimit between individual names.<T> IdentifierRule
getIdentifierRule(T t)
Returns a naming rule or null if the rule is not found.java.util.Map<java.lang.String,IdentifierRule>
getIdentifierRules()
Returns all naming rulesjava.lang.String
getIdentityColumnName()
ForeignKey[]
getImportedKeys(java.sql.DatabaseMetaData meta, java.lang.String catalog, java.lang.String schemaName, java.lang.String tableName, java.sql.Connection conn)
Deprecated.ForeignKey[]
getImportedKeys(java.sql.DatabaseMetaData meta, java.lang.String catalog, java.lang.String schemaName, java.lang.String tableName, java.sql.Connection conn, boolean partialKeys)
Deprecated.ForeignKey[]
getImportedKeys(java.sql.DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, java.sql.Connection conn)
Reflect on the schema to return foreign keys imported by the given table pattern.ForeignKey[]
getImportedKeys(java.sql.DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, java.sql.Connection conn, boolean partialKeys)
Reflect on the schema to return full foreign keys imported by the given table pattern.Index[]
getIndexInfo(java.sql.DatabaseMetaData meta, java.lang.String catalog, java.lang.String schemaName, java.lang.String tableName, boolean unique, boolean approx, java.sql.Connection conn)
Deprecated.Index[]
getIndexInfo(java.sql.DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, boolean unique, boolean approx, java.sql.Connection conn)
Reflect on the schema to find indexes matching the given table pattern.int
getInt(java.sql.ResultSet rs, int column)
Convert the specified column of the SQL ResultSet to the proper java type.java.util.Set<java.lang.String>
getInvalidColumnWordSet()
Return the subset of the words in reservedWordSet that cannot be used as valid column names for the current DB.java.lang.String
getIsNotNullSQL(java.lang.String colAlias, int colType)
java.lang.String
getIsNullSQL(java.lang.String colAlias, int colType)
int
getJDBCType(int metaTypeCode, boolean lob)
int
getJDBCType(int metaTypeCode, boolean lob, int precis, int scale)
int
getJDBCType(int metaTypeCode, boolean lob, int precis, int scale, boolean xml)
protected java.lang.Object
getKey(java.sql.ResultSet rs, Column col)
This method is to provide override for non-JDBC or JDBC-like implementation of getting key from the result set.java.lang.String
getLeadingDelimiter()
Returns the leading delimiter value to use when delimiting a name.java.io.InputStream
getLOBStream(JDBCStore store, java.sql.ResultSet rs, int column)
java.time.LocalDate
getLocalDate(java.sql.ResultSet rs, int column)
Retrieve the specified column of the SQL ResultSet to the properLocalDate
java type.java.time.LocalDateTime
getLocalDateTime(java.sql.ResultSet rs, int column)
Retrieve the specified column of the SQL ResultSet to the properLocalDateTime
java type.java.util.Locale
getLocale(java.sql.ResultSet rs, int column)
Convert the specified column of the SQL ResultSet to the proper java type.java.time.LocalTime
getLocalTime(java.sql.ResultSet rs, int column)
Retrieve the specified column of the SQL ResultSet to the properLocalTime
java type.Log
getLog()
long
getLong(java.sql.ResultSet rs, int column)
Convert the specified column of the SQL ResultSet to the proper java type.int
getMajorVersion()
Gets major version of the database server.java.lang.String
getMarkerForInsertUpdate(Column col, java.lang.Object val)
Return parameter marker for INSERT and UPDATE statements.DBDictionary.DateMillisecondBehaviors
getMillisecondBehavior()
Default behavior is ROUNDint
getMinorVersion()
Gets minor version of the database server.DBIdentifierUtil
getNamingUtil()
Returns the naming utility used by this dictionary instancejava.lang.Number
getNumber(java.sql.ResultSet rs, int column)
Returns the specified column value as an unknown numeric type; we try from the most generic to the least generic.java.lang.Object
getObject(java.sql.ResultSet rs, int column, java.util.Map map)
Convert the specified column of the SQL ResultSet to the proper java type.java.time.OffsetDateTime
getOffsetDateTime(java.sql.ResultSet rs, int column)
Retrieve the specified column of the SQL ResultSet to the properOffsetDateTime
java type.java.time.OffsetTime
getOffsetTime(java.sql.ResultSet rs, int column)
Retrieve the specified column of the SQL ResultSet to the properOffsetTime
java type.java.lang.String
getPlaceholderValueString(Column col)
Return a SQL string to act as a placeholder for the given column.int
getPreferredType(int type)
Return the preferredTypes
type for the given one.protected java.lang.String
getPrimaryKeyConstraintSQL(PrimaryKey pk)
Return the declaration SQL for the given primary key.PrimaryKey[]
getPrimaryKeys(java.sql.DatabaseMetaData meta, java.lang.String catalog, java.lang.String schemaName, java.lang.String tableName, java.sql.Connection conn)
Deprecated.PrimaryKey[]
getPrimaryKeys(java.sql.DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, java.sql.Connection conn)
Reflect on the schema to find primary keys for the given table pattern.protected PrimaryKey[]
getPrimaryKeysFromBestRowIdentifier(java.sql.DatabaseMetaData meta, java.lang.String catalog, java.lang.String schemaName, java.lang.String tableName, java.sql.Connection conn)
Deprecated.protected PrimaryKey[]
getPrimaryKeysFromBestRowIdentifier(java.sql.DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, java.sql.Connection conn)
Reflect on the schema to find primary keys for the given table pattern.protected PrimaryKey[]
getPrimaryKeysFromGetPrimaryKeys(java.sql.DatabaseMetaData meta, java.lang.String catalog, java.lang.String schemaName, java.lang.String tableName, java.sql.Connection conn)
Deprecated.protected PrimaryKey[]
getPrimaryKeysFromGetPrimaryKeys(java.sql.DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, java.sql.Connection conn)
Reflect on the schema to find primary keys for the given table pattern.java.sql.Ref
getRef(java.sql.ResultSet rs, int column, java.util.Map map)
Convert the specified column of the SQL ResultSet to the proper java type.java.lang.String
getSchemaCase()
Return DB specific schemaCaseprotected java.lang.String
getSchemaNameForMetadata(java.lang.String schemaName)
Returns the schema name that will be used for obtaining information fromDatabaseMetaData
.protected java.lang.String
getSchemaNameForMetadata(DBIdentifier schemaName)
Returns the schema name that will be used for obtaining information fromDatabaseMetaData
.java.lang.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 java.util.Collection<java.lang.String>
getSelectTableAliases(Select sel)
protected Sequence[]
getSequence(java.sql.ResultSet rs)
This method is to provide override for non-JDBC or JDBC-like implementation of getting sequence from the result set.Sequence[]
getSequences(java.sql.DatabaseMetaData meta, java.lang.String catalog, java.lang.String schemaName, java.lang.String sequenceName, java.sql.Connection conn)
Deprecated.Sequence[]
getSequences(java.sql.DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier sequenceName, java.sql.Connection conn)
protected java.lang.String
getSequencesSQL(java.lang.String schemaName, java.lang.String sequenceName)
Deprecated.protected java.lang.String
getSequencesSQL(DBIdentifier schemaName, DBIdentifier sequenceName)
short
getShort(java.sql.ResultSet rs, int column)
Convert the specified column of the SQL ResultSet to the proper java type.StoredProcedure
getStoredProcedure(java.sql.DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schema, java.lang.String procedure)
Gets the metadata of the stored procedure by the given name either from the cached version or by enquiring the database.java.lang.String
getString(java.sql.ResultSet rs, int column)
Convert the specified column of the SQL ResultSet to the proper java type.boolean
getSupportsDelimitedIdentifiers()
Returns true if delimiting is supportedboolean
getSupportsXMLColumn()
protected java.lang.String
getTableNameForMetadata(java.lang.String tableName)
Returns the table name that will be used for obtaining information fromDatabaseMetaData
.protected java.lang.String
getTableNameForMetadata(DBIdentifier tableName)
Returns the table name that will be used for obtaining information fromDatabaseMetaData
.Table[]
getTables(java.sql.DatabaseMetaData meta, java.lang.String catalog, java.lang.String schemaName, java.lang.String tableName, java.sql.Connection conn)
Deprecated.not used by openjpa internally anymoreTable[]
getTables(java.sql.DatabaseMetaData meta, DBIdentifier sqlCatalog, DBIdentifier sqlSchemaName, DBIdentifier sqlTableName, java.sql.Connection conn)
Reflect on the schema to find tables matching the given name pattern.java.sql.Time
getTime(java.sql.ResultSet rs, int column, java.util.Calendar cal)
Convert the specified column of the SQL ResultSet to the proper java type.java.sql.Timestamp
getTimestamp(java.sql.ResultSet rs, int column, java.util.Calendar cal)
Convert the specified column of the SQL ResultSet to the proper java type.java.lang.String
getTrailingDelimiter()
Returns the trailing delimiter value to use when delimiting a name.boolean
getTrimSchemaName()
java.lang.String
getTypeName(int type)
Returns the type name for the specific constant as defined byTypes
.java.lang.String
getTypeName(Column col)
Return the preferred database type name for the given column's type fromTypes
.protected java.lang.String
getUniqueConstraintSQL(Unique unq)
Return the declaration SQL for the given unique constraint.java.lang.String
getValidColumnName(java.lang.String name, Table table)
Deprecated.java.lang.String
getValidColumnName(java.lang.String name, Table table, boolean checkForUniqueness)
Deprecated.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.java.lang.String
getValidForeignKeyName(java.lang.String name, Table table, Table toTable)
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.java.lang.String
getValidIndexName(java.lang.String name, Table table)
Deprecated.DBIdentifier
getValidIndexName(DBIdentifier name, Table table)
Make any necessary changes to the given index name to make it valid for the current DB.java.lang.String
getValidPrimaryKeyName(java.lang.String name, Table table)
Make any necessary changes to the given primary key name to make it valid for the current DB.java.lang.String
getValidSequenceName(java.lang.String name, Schema schema)
Deprecated.DBIdentifier
getValidSequenceName(DBIdentifier name, Schema schema)
Make any necessary changes to the given sequence name to make it valid for the current DB.java.lang.String
getValidTableName(java.lang.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.java.lang.String
getValidUniqueName(java.lang.String name, Table table)
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.java.lang.String
getVersionColumn(Column column, java.lang.String tableAlias)
Return version column nameDBIdentifier
getVersionColumn(Column column, DBIdentifier tableAlias)
protected SQLBuffer
getWhere(Select sel, boolean forUpdate)
Return the WHERE portion of the select statement, or null if no where conditions.java.lang.String
getXMLTypeEncoding()
void
handleWarning(java.sql.SQLWarning warning)
Implementation of theLoggingConnectionDecorator.SQLWarningHandler
interface that allows customization of the actions to perform when aSQLWarning
occurs at any point on aConnection
,Statement
, orResultSet
.void
indexOf(SQLBuffer buf, FilterValue str, FilterValue find, FilterValue start)
Invoke this database's indexOf function.void
insertBlobForStreamingLoad(Row row, Column col, JDBCStore store, java.lang.Object ob, Select sel)
void
insertClobForStreamingLoad(Row row, Column col, java.lang.Object ob)
protected java.lang.String
insertSize(java.lang.String typeName, java.lang.String size)
Helper method that inserts a size clause for a given SQL type.boolean
isFatalException(int subtype, java.sql.SQLException ex)
Determine if the given SQL Exception is fatal or recoverable (such as a timeout).boolean
isImplicitJoin()
boolean
isSelect(java.lang.String sql)
Determine whether the providedsql
may be treated as a select statement on this database.boolean
isSystemIndex(java.lang.String name, Table table)
Deprecated.boolean
isSystemIndex(DBIdentifier name, Table table)
This method is used to filter system indexes from database metadata.boolean
isSystemSequence(java.lang.String name, java.lang.String schema, boolean targetSchema)
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, java.sql.Connection conn)
This method is used to filter system sequences from database metadata.boolean
isSystemTable(java.lang.String name, java.lang.String schema, boolean targetSchema)
Deprecated.boolean
isSystemTable(DBIdentifier name, DBIdentifier schema, boolean targetSchema)
This method is used to filter system tables from database metadata.protected boolean
isUsingLimit(long end)
protected boolean
isUsingOffset(long start)
protected boolean
isUsingOrderBy(SQLBuffer sql)
protected boolean
isUsingRange(long start, long end)
protected java.lang.String
makeNameValid(java.lang.String name, NameSet set, int maxLen, int nameType)
Deprecated.protected java.lang.String
makeNameValid(java.lang.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 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 int
matchErrorState(java.util.Map<java.lang.Integer,java.util.Set<java.lang.String>> errorStates, java.sql.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, java.lang.String op, FilterValue lhs, FilterValue rhs)
Append the numeric parts of a mathematical function.boolean
needsToCreateIndex(Index idx, Table table)
boolean
needsToCreateIndex(Index idx, Table table, Unique[] uniques)
protected Column
newColumn(java.sql.ResultSet colMeta)
Create a new column from the information in the schema metadata.protected ForeignKey
newForeignKey(java.sql.ResultSet fkMeta)
Create a new foreign key from the information in the schema metadata.protected Index
newIndex(java.sql.ResultSet idxMeta)
Create a new index from the information in the schema metadata.protected PrimaryKey
newPrimaryKey(java.sql.ResultSet pkMeta)
Create a new primary key from the information in the schema metadata.protected Sequence
newSequence(java.sql.ResultSet sequenceMeta)
Create a new sequence from the information in the schema metadata.OpenJPAException
newStoreException(java.lang.String msg, java.sql.SQLException[] causes, java.lang.Object failed)
Return a new exception that wrapscauses
.protected Table
newTable(java.sql.ResultSet tableMeta)
Create a new table from the information in the schema metadata.protected java.sql.PreparedStatement
prepareStatement(java.sql.Connection conn, java.lang.String sql)
This method is to provide override for non-JDBC or JDBC-like implementation of preparing statement.DBIdentifier
processDBColumnName(DBIdentifier name)
void
putBytes(java.sql.Blob blob, byte[] data)
Invoke the JDK 1.4setBytes
method on the given BLOB object.void
putChars(java.sql.Clob clob, char[] data)
Invoke the JDK 1.4setCharacterStream
method on the given CLOB object.void
putString(java.sql.Clob clob, java.lang.String data)
Invoke the JDK 1.4setString
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(java.lang.Object val, JDBCStore store)
Return the serialized bytes for the given object.void
setArray(java.sql.PreparedStatement stmnt, int idx, java.sql.Array val, Column col)
Set the given value as a parameter to the statement.void
setAsciiStream(java.sql.PreparedStatement stmnt, int idx, java.io.InputStream val, int length, Column col)
Set the given value as a parameter to the statement.void
setBatchLimit(int limit)
Set the batchLimit valuevoid
setBigDecimal(java.sql.PreparedStatement stmnt, int idx, java.math.BigDecimal val, Column col)
Set the given value as a parameter to the statement.void
setBigInteger(java.sql.PreparedStatement stmnt, int idx, java.math.BigInteger val, Column col)
Set the given value as a parameter to the statement.void
setBinaryStream(java.sql.PreparedStatement stmnt, int idx, java.io.InputStream val, int length, Column col)
Set the given value as a parameter to the statement.void
setBlob(java.sql.PreparedStatement stmnt, int idx, java.sql.Blob val, Column col)
Set the given value as a parameter to the statement.void
setBlobObject(java.sql.PreparedStatement stmnt, int idx, java.lang.Object val, Column col, JDBCStore store)
Set the given value as a parameter to the statement.void
setBoolean(java.sql.PreparedStatement stmnt, int idx, boolean val, Column col)
Set the given value as a parameter to the statement.void
setBooleanRepresentation(java.lang.String booleanRepresentationKey)
void
setByte(java.sql.PreparedStatement stmnt, int idx, byte val, Column col)
Set the given value as a parameter to the statement.void
setBytes(java.sql.PreparedStatement stmnt, int idx, byte[] val, Column col)
Set the given value as a parameter to the statement.void
setCalendar(java.sql.PreparedStatement stmnt, int idx, java.util.Calendar val, Column col)
Set the given value as a parameter to the statement.void
setChar(java.sql.PreparedStatement stmnt, int idx, char val, Column col)
Set the given value as a parameter to the statement.void
setCharacterStream(java.sql.PreparedStatement stmnt, int idx, java.io.Reader val, int length, Column col)
Set the given value as a parameter to the statement.void
setClob(java.sql.PreparedStatement stmnt, int idx, java.sql.Clob val, Column col)
Set the given value as a parameter to the statement.void
setClobString(java.sql.PreparedStatement stmnt, int idx, java.lang.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(java.sql.PreparedStatement stmnt, int idx, java.sql.Date val, java.util.Calendar cal, Column col)
Set the given value as a parameter to the statement.void
setDate(java.sql.PreparedStatement stmnt, int idx, java.util.Date val, Column col)
Set the given value as a parameter to the statement.void
setDateMillisecondBehavior(java.lang.String str)
void
setDefaultSchemaName(java.lang.String defaultSchemaName)
protected void
setDelimitedCase(java.sql.DatabaseMetaData metaData)
void
setDelimitIdentifiers(boolean delimitIds)
void
setDouble(java.sql.PreparedStatement stmnt, int idx, double val, Column col)
Set the given value as a parameter to the statement.void
setFloat(java.sql.PreparedStatement stmnt, int idx, float val, Column col)
Set the given value as a parameter to the statement.void
setInt(java.sql.PreparedStatement stmnt, int idx, int val, Column col)
Set the given value as a parameter to the statement.void
setJoinSyntax(java.lang.String syntax)
Set the name of the join syntax to use: sql92, traditional, database.void
setLeadingDelimiter(java.lang.String delim)
void
setLocalDate(java.sql.PreparedStatement stmnt, int idx, java.time.LocalDate val, Column col)
Set the given LocalDate value as a parameter to the statement.void
setLocalDateTime(java.sql.PreparedStatement stmnt, int idx, java.time.LocalDateTime val, Column col)
Set the given LocalTime value as a parameter to the statement.void
setLocale(java.sql.PreparedStatement stmnt, int idx, java.util.Locale val, Column col)
Set the given value as a parameter to the statement.void
setLocalTime(java.sql.PreparedStatement stmnt, int idx, java.time.LocalTime val, Column col)
Set the given LocalTime value as a parameter to the statement.void
setLong(java.sql.PreparedStatement stmnt, int idx, long val, Column col)
Set the given value as a parameter to the statement.void
setMajorVersion(int maj)
Sets major version of the database server.void
setMinorVersion(int min)
Sets minor version of the database server.void
setNull(java.sql.PreparedStatement stmnt, int idx, int colType, Column col)
Set null as a parameter to the statement.void
setNumber(java.sql.PreparedStatement stmnt, int idx, java.lang.Number num, Column col)
Set the given value as a parameter to the statement.void
setObject(java.sql.PreparedStatement stmnt, int idx, java.lang.Object val, int colType, Column col)
Set the given value as a parameter to the statement.void
setOffsetDateTime(java.sql.PreparedStatement stmnt, int idx, java.time.OffsetDateTime val, Column col)
Set the given LocalTime value as a parameter to the statement.void
setOffsetTime(java.sql.PreparedStatement stmnt, int idx, java.time.OffsetTime val, Column col)
Set the given LocalTime value as a parameter to the statement.void
setQueryTimeout(java.sql.PreparedStatement stmnt, int timeout)
Provides the default validation handling of setting a query timeout.void
setRef(java.sql.PreparedStatement stmnt, int idx, java.sql.Ref val, Column col)
Set the given value as a parameter to the statement.void
setShort(java.sql.PreparedStatement stmnt, int idx, short val, Column col)
Set the given value as a parameter to the statement.protected void
setStatementQueryTimeout(java.sql.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(java.sql.PreparedStatement stmnt, int idx, java.lang.String val, Column col)
Set the given value as a parameter to the statement.void
setSupportsDelimitedIdentifiers(boolean supportsDelimitedIds)
void
setSupportsXMLColumn(boolean b)
void
setTime(java.sql.PreparedStatement stmnt, int idx, java.sql.Time val, java.util.Calendar cal, Column col)
Set the given value as a parameter to the statement.void
setTimeouts(java.sql.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(java.sql.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(java.sql.PreparedStatement stmnt, int idx, java.sql.Timestamp val, java.util.Calendar cal, Column col)
Set the given value as a parameter to the statement.void
setTrailingDelimiter(java.lang.String delim)
void
setTrimSchemaName(boolean trimSchemaName)
void
setTyped(java.sql.PreparedStatement stmnt, int idx, java.lang.Object val, Column col, int type, JDBCStore store)
Set a column value into a prepared statement.void
setUnknown(java.sql.PreparedStatement stmt, int idx, java.lang.Object val, Column col)
Set a completely unknown parameter into a prepared statement.void
setUnknown(java.sql.PreparedStatement stmnt, int idx, Column col, java.lang.Object val)
Set a completely unknown parameter into a prepared statement.void
setXMLTypeEncoding(java.lang.String encoding)
static java.lang.String
shorten(java.lang.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(java.lang.Object orig, java.lang.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, java.lang.Object[] params, java.util.Map updateParams)
Returns the SQL for a bulk operation, either a DELETE or an UPDATE.java.lang.String
toDBName(DBIdentifier name)
java.lang.String
toDBName(DBIdentifier name, boolean delimit)
SQLBuffer
toDelete(ClassMapping mapping, Select sel, java.lang.Object[] params)
Create a DELETE statement for the specified Select.SQLBuffer
toNativeJoin(Join join)
Use the given join instance to create SQL joining its tables in the database's native syntax.SQLBuffer
toOperation(java.lang.String op, SQLBuffer selects, SQLBuffer from, SQLBuffer where, SQLBuffer group, SQLBuffer having, SQLBuffer order, boolean distinct, long start, long end, java.lang.String forUpdateClause)
Return the SQL for the given selecting operation.SQLBuffer
toOperation(java.lang.String op, SQLBuffer selects, SQLBuffer from, SQLBuffer where, SQLBuffer group, SQLBuffer having, SQLBuffer order, boolean distinct, long start, long end, java.lang.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.java.lang.String
toSnakeCase(java.lang.String name)
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, java.lang.Object[] params, java.util.Map updates)
void
updateBlob(Select sel, JDBCStore store, java.io.InputStream is)
void
updateClob(Select sel, JDBCStore store, java.io.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.protected boolean
versionEqualOrEarlierThan(int maj, int min)
protected boolean
versionEqualOrLaterThan(int maj, int min)
protected boolean
versionLaterThan(int maj)
-
-
-
Field Detail
-
VENDOR_OTHER
public static final java.lang.String VENDOR_OTHER
- See Also:
- Constant Field Values
-
VENDOR_DATADIRECT
public static final java.lang.String VENDOR_DATADIRECT
- See Also:
- Constant Field Values
-
SCHEMA_CASE_UPPER
public static final java.lang.String SCHEMA_CASE_UPPER
- See Also:
- Constant Field Values
-
SCHEMA_CASE_LOWER
public static final java.lang.String SCHEMA_CASE_LOWER
- See Also:
- Constant Field Values
-
SCHEMA_CASE_PRESERVE
public static final java.lang.String SCHEMA_CASE_PRESERVE
- See Also:
- Constant Field Values
-
CONS_NAME_BEFORE
public static final java.lang.String CONS_NAME_BEFORE
- See Also:
- Constant Field Values
-
CONS_NAME_MID
public static final java.lang.String CONS_NAME_MID
- See Also:
- Constant Field Values
-
CONS_NAME_AFTER
public static final java.lang.String CONS_NAME_AFTER
- See Also:
- Constant Field Values
-
blobBufferSize
public int blobBufferSize
-
clobBufferSize
public int clobBufferSize
-
RANGE_POST_SELECT
protected static final int RANGE_POST_SELECT
- See Also:
- Constant Field Values
-
RANGE_PRE_DISTINCT
protected static final int RANGE_PRE_DISTINCT
- See Also:
- Constant Field Values
-
RANGE_POST_DISTINCT
protected static final int RANGE_POST_DISTINCT
- See Also:
- Constant Field Values
-
RANGE_POST_LOCK
protected static final int RANGE_POST_LOCK
- See Also:
- Constant Field Values
-
NANO
protected static final int NANO
- See Also:
- Constant Field Values
-
MICRO
protected static final int MICRO
- See Also:
- Constant Field Values
-
MILLI
protected static final int MILLI
- See Also:
- Constant Field Values
-
CENTI
protected static final int CENTI
- See Also:
- Constant Field Values
-
DECI
protected static final int DECI
- See Also:
- Constant Field Values
-
SEC
protected static final int SEC
- See Also:
- Constant Field Values
-
NAME_ANY
protected static final int NAME_ANY
- See Also:
- Constant Field Values
-
NAME_TABLE
protected static final int NAME_TABLE
- See Also:
- Constant Field Values
-
NAME_SEQUENCE
protected static final int NAME_SEQUENCE
- See Also:
- Constant Field Values
-
UNLIMITED
protected static final int UNLIMITED
- See Also:
- Constant Field Values
-
NO_BATCH
protected static final int NO_BATCH
- See Also:
- Constant Field Values
-
platform
public java.lang.String platform
-
databaseProductName
public java.lang.String databaseProductName
-
databaseProductVersion
public java.lang.String databaseProductVersion
-
driverVendor
public java.lang.String driverVendor
-
createPrimaryKeys
public boolean createPrimaryKeys
-
constraintNameMode
public java.lang.String constraintNameMode
-
maxTableNameLength
public int maxTableNameLength
-
maxColumnNameLength
public int maxColumnNameLength
-
maxConstraintNameLength
public int maxConstraintNameLength
-
maxIndexNameLength
public int maxIndexNameLength
-
maxIndexesPerTable
public int maxIndexesPerTable
-
supportsForeignKeys
public boolean supportsForeignKeys
-
supportsParameterInSelect
public boolean supportsParameterInSelect
-
supportsForeignKeysComposite
public boolean supportsForeignKeysComposite
-
supportsUniqueConstraints
public boolean supportsUniqueConstraints
-
supportsDeferredConstraints
public boolean supportsDeferredConstraints
-
supportsRestrictDeleteAction
public boolean supportsRestrictDeleteAction
-
supportsCascadeDeleteAction
public boolean supportsCascadeDeleteAction
-
supportsNullDeleteAction
public boolean supportsNullDeleteAction
-
supportsNullUniqueColumn
public boolean supportsNullUniqueColumn
-
supportsDefaultDeleteAction
public boolean supportsDefaultDeleteAction
-
supportsRestrictUpdateAction
public boolean supportsRestrictUpdateAction
-
supportsCascadeUpdateAction
public boolean supportsCascadeUpdateAction
-
supportsNullUpdateAction
public boolean supportsNullUpdateAction
-
supportsDefaultUpdateAction
public boolean supportsDefaultUpdateAction
-
supportsAlterTableWithAddColumn
public boolean supportsAlterTableWithAddColumn
-
supportsAlterTableWithDropColumn
public boolean supportsAlterTableWithDropColumn
-
supportsComments
public boolean supportsComments
-
supportsGetGeneratedKeys
public java.lang.Boolean supportsGetGeneratedKeys
-
reservedWords
public java.lang.String reservedWords
-
systemSchemas
public java.lang.String systemSchemas
-
systemTables
public java.lang.String systemTables
-
selectWords
public java.lang.String selectWords
-
fixedSizeTypeNames
public java.lang.String fixedSizeTypeNames
-
schemaCase
public java.lang.String schemaCase
-
javaToDbColumnNameProcessing
public java.lang.String javaToDbColumnNameProcessing
-
setStringRightTruncationOn
public boolean setStringRightTruncationOn
-
fullResultCollectionInOrderByRelation
public boolean fullResultCollectionInOrderByRelation
-
disableSchemaFactoryColumnTypeErrors
public boolean disableSchemaFactoryColumnTypeErrors
-
disableAlterSeqenceIncrementBy
public boolean disableAlterSeqenceIncrementBy
-
validationSQL
public java.lang.String validationSQL
-
closePoolSQL
public java.lang.String closePoolSQL
-
initializationSQL
public java.lang.String initializationSQL
-
joinSyntax
public int joinSyntax
-
outerJoinClause
public java.lang.String outerJoinClause
-
innerJoinClause
public java.lang.String innerJoinClause
-
crossJoinClause
public java.lang.String crossJoinClause
-
requiresConditionForCrossJoin
public boolean requiresConditionForCrossJoin
-
forUpdateClause
public java.lang.String forUpdateClause
-
tableForUpdateClause
public java.lang.String tableForUpdateClause
-
distinctCountColumnSeparator
public java.lang.String distinctCountColumnSeparator
-
supportsSelectForUpdate
public boolean supportsSelectForUpdate
-
supportsLockingWithDistinctClause
public boolean supportsLockingWithDistinctClause
-
supportsLockingWithMultipleTables
public boolean supportsLockingWithMultipleTables
-
supportsLockingWithOrderClause
public boolean supportsLockingWithOrderClause
-
supportsLockingWithOuterJoin
public boolean supportsLockingWithOuterJoin
-
supportsLockingWithInnerJoin
public boolean supportsLockingWithInnerJoin
-
supportsLockingWithSelectRange
public boolean supportsLockingWithSelectRange
-
supportsQueryTimeout
public boolean supportsQueryTimeout
-
allowQueryTimeoutOnFindUpdate
public boolean allowQueryTimeoutOnFindUpdate
-
simulateLocking
public boolean simulateLocking
-
supportsSubselect
public boolean supportsSubselect
-
supportsCorrelatedSubselect
public boolean supportsCorrelatedSubselect
-
supportsHaving
public boolean supportsHaving
-
supportsSelectStartIndex
public boolean supportsSelectStartIndex
-
supportsSelectEndIndex
public boolean supportsSelectEndIndex
-
rangePosition
public int rangePosition
-
requiresAliasForSubselect
public boolean requiresAliasForSubselect
-
requiresTargetForDelete
public boolean requiresTargetForDelete
-
allowsAliasInBulkClause
public boolean allowsAliasInBulkClause
-
supportsMultipleNontransactionalResultSets
public boolean supportsMultipleNontransactionalResultSets
-
requiresSearchStringEscapeForLike
public boolean requiresSearchStringEscapeForLike
-
searchStringEscape
public java.lang.String searchStringEscape
-
requiresCastForMathFunctions
public boolean requiresCastForMathFunctions
-
requiresCastForComparisons
public boolean requiresCastForComparisons
-
supportsModOperator
public boolean supportsModOperator
-
supportsXMLColumn
public boolean supportsXMLColumn
-
supportsCaseConversionForLob
public boolean supportsCaseConversionForLob
-
reportsSuccessNoInfoOnBatchUpdates
public boolean reportsSuccessNoInfoOnBatchUpdates
-
supportsSelectFromFinalTable
public boolean supportsSelectFromFinalTable
-
supportsSimpleCaseExpression
public boolean supportsSimpleCaseExpression
-
supportsGeneralCaseExpression
public boolean supportsGeneralCaseExpression
-
useWildCardForCount
public boolean useWildCardForCount
-
trimSchemaName
public boolean trimSchemaName
Some Databases append whitespace after the schema name
-
castFunction
public java.lang.String castFunction
-
toLowerCaseFunction
public java.lang.String toLowerCaseFunction
-
toUpperCaseFunction
public java.lang.String toUpperCaseFunction
-
stringLengthFunction
public java.lang.String stringLengthFunction
-
bitLengthFunction
public java.lang.String bitLengthFunction
-
trimLeadingFunction
public java.lang.String trimLeadingFunction
-
trimTrailingFunction
public java.lang.String trimTrailingFunction
-
trimBothFunction
public java.lang.String trimBothFunction
-
concatenateFunction
public java.lang.String concatenateFunction
-
concatenateDelimiter
public java.lang.String concatenateDelimiter
-
substringFunctionName
public java.lang.String substringFunctionName
-
currentDateFunction
public java.lang.String currentDateFunction
-
currentTimeFunction
public java.lang.String currentTimeFunction
-
currentTimestampFunction
public java.lang.String currentTimestampFunction
-
dropTableSQL
public java.lang.String dropTableSQL
-
storageLimitationsFatal
public boolean storageLimitationsFatal
-
storeLargeNumbersAsStrings
public boolean storeLargeNumbersAsStrings
-
storeCharsAsNumbers
public boolean storeCharsAsNumbers
-
trimStringColumns
public boolean trimStringColumns
-
useGetBytesForBlobs
public boolean useGetBytesForBlobs
-
useSetBytesForBlobs
public boolean useSetBytesForBlobs
-
useGetObjectForBlobs
public boolean useGetObjectForBlobs
-
useGetStringForClobs
public boolean useGetStringForClobs
-
useSetStringForClobs
public boolean useSetStringForClobs
-
useJDBC4SetBinaryStream
public boolean useJDBC4SetBinaryStream
-
maxEmbeddedBlobSize
public int maxEmbeddedBlobSize
-
maxEmbeddedClobSize
public int maxEmbeddedClobSize
-
inClauseLimit
public int inClauseLimit
-
datePrecision
public int datePrecision
Attention, while this is named datePrecision it actually only get used for Timestamp handling!
-
roundTimeToMillisec
@Deprecated public boolean roundTimeToMillisec
Deprecated.Use 'dateMillisecondBehavior' instead.
-
booleanRepresentation
protected BooleanRepresentation booleanRepresentation
Defines howBoolean
andboolean
values get represented in OpenJPA. Default toINT_10
. for backward compatibility.
-
indexPhysicalForeignKeys
public boolean indexPhysicalForeignKeys
Whether an index is generated for a relation that is also a foreign key. Some database systems (e.g. MySQL) will automatically create an index for a foreign key, others (e.g. Oracle, MS-SQL-Server) do not. See alsoMappingDefaultsImpl._indexPhysicalFK
which may disable this feature for backwards compatibility.
-
characterColumnSize
public int characterColumnSize
-
arrayTypeName
public java.lang.String arrayTypeName
-
bigintTypeName
public java.lang.String bigintTypeName
-
binaryTypeName
public java.lang.String binaryTypeName
-
bitTypeName
public java.lang.String bitTypeName
-
blobTypeName
public java.lang.String blobTypeName
-
booleanTypeName
public java.lang.String booleanTypeName
-
charTypeName
public java.lang.String charTypeName
-
clobTypeName
public java.lang.String clobTypeName
-
dateTypeName
public java.lang.String dateTypeName
-
decimalTypeName
public java.lang.String decimalTypeName
-
distinctTypeName
public java.lang.String distinctTypeName
-
doubleTypeName
public java.lang.String doubleTypeName
-
floatTypeName
public java.lang.String floatTypeName
-
integerTypeName
public java.lang.String integerTypeName
-
javaObjectTypeName
public java.lang.String javaObjectTypeName
-
longVarbinaryTypeName
public java.lang.String longVarbinaryTypeName
-
longVarcharTypeName
public java.lang.String longVarcharTypeName
-
nullTypeName
public java.lang.String nullTypeName
-
numericTypeName
public java.lang.String numericTypeName
-
otherTypeName
public java.lang.String otherTypeName
-
realTypeName
public java.lang.String realTypeName
-
refTypeName
public java.lang.String refTypeName
-
smallintTypeName
public java.lang.String smallintTypeName
-
structTypeName
public java.lang.String structTypeName
-
timeTypeName
public java.lang.String timeTypeName
-
timestampTypeName
public java.lang.String timestampTypeName
-
timeWithZoneTypeName
public java.lang.String timeWithZoneTypeName
-
timestampWithZoneTypeName
public java.lang.String timestampWithZoneTypeName
-
tinyintTypeName
public java.lang.String tinyintTypeName
-
varbinaryTypeName
public java.lang.String varbinaryTypeName
-
varcharTypeName
public java.lang.String varcharTypeName
-
xmlTypeName
public java.lang.String xmlTypeName
-
xmlTypeEncoding
public java.lang.String xmlTypeEncoding
-
getStringVal
public java.lang.String getStringVal
-
useSchemaName
public boolean useSchemaName
-
tableTypes
public java.lang.String tableTypes
-
supportsSchemaForGetTables
public boolean supportsSchemaForGetTables
-
supportsSchemaForGetColumns
public boolean supportsSchemaForGetColumns
-
supportsNullTableForGetColumns
public boolean supportsNullTableForGetColumns
-
supportsNullTableForGetPrimaryKeys
public boolean supportsNullTableForGetPrimaryKeys
-
supportsNullTableForGetIndexInfo
public boolean supportsNullTableForGetIndexInfo
-
supportsNullTableForGetImportedKeys
public boolean supportsNullTableForGetImportedKeys
-
useGetBestRowIdentifierForPrimaryKeys
public boolean useGetBestRowIdentifierForPrimaryKeys
-
requiresAutoCommitForMetaData
public boolean requiresAutoCommitForMetaData
-
tableLengthIncludesSchema
public boolean tableLengthIncludesSchema
-
maxAutoAssignNameLength
public int maxAutoAssignNameLength
-
autoAssignClause
public java.lang.String autoAssignClause
-
autoAssignTypeName
public java.lang.String autoAssignTypeName
-
supportsAutoAssign
public boolean supportsAutoAssign
-
lastGeneratedKeyQuery
public java.lang.String lastGeneratedKeyQuery
-
nextSequenceQuery
public java.lang.String nextSequenceQuery
-
sequenceSQL
public java.lang.String sequenceSQL
-
sequenceSchemaSQL
public java.lang.String sequenceSchemaSQL
-
sequenceNameSQL
public java.lang.String sequenceNameSQL
-
nativeSequenceType
public int nativeSequenceType
-
invalidColumnWordSet
public java.util.Set<java.lang.String> invalidColumnWordSet
reservedWordSet subset that CANNOT be used as valid column names (i.e., without surrounding them with double-quotes).
-
useNativeSequenceCache
@Deprecated public boolean useNativeSequenceCache
Deprecated.This variable was used in 2.1.x and prior releases to indicate that OpenJPA should not use the CACHE clause when getting a native sequence; instead the INCREMENT BY clause gets its value equal to the allocationSize property. Post 2.1.x, code was added to allow said functionality by default (see OPENJPA-1376). For forward compatibility, this variable should not be removed.
-
conf
protected JDBCConfiguration conf
-
log
protected Log log
-
connected
protected boolean connected
-
isJDBC3
protected boolean isJDBC3
-
isJDBC4
protected boolean isJDBC4
-
reservedWordSet
protected final java.util.Set<java.lang.String> reservedWordSet
-
systemSchemaSet
protected final java.util.Set<java.lang.String> systemSchemaSet
-
systemTableSet
protected final java.util.Set<java.lang.String> systemTableSet
-
fixedSizeTypeNameSet
protected final java.util.Set<java.lang.String> fixedSizeTypeNameSet
-
fractionalTypeNameSet
public final java.util.Set<java.lang.String> fractionalTypeNameSet
set of types that might have an optional fraction (sub-second) part.
-
dateFractionDigits
public int dateFractionDigits
Default amount of digits for fractional Types. This is not supported/required by every database. This value is only being used if no explicit@Column(scale=n)
is set or n is zero. Use@Column(scale=-1)
to disable the explicit fraction part in the SQL generator.
-
typeModifierSet
protected final java.util.Set<java.lang.String> typeModifierSet
-
supportsDelimitedIdentifiers
public java.lang.Boolean supportsDelimitedIdentifiers
-
leadingDelimiter
public java.lang.String leadingDelimiter
-
trailingDelimiter
public java.lang.String trailingDelimiter
-
nameConcatenator
public java.lang.String nameConcatenator
-
delimitedCase
public java.lang.String delimitedCase
-
catalogSeparator
public java.lang.String catalogSeparator
-
defaultSchemaName
protected java.lang.String defaultSchemaName
-
selectWordSet
protected final java.util.Set<java.lang.String> selectWordSet
If a native query begins with any of the values found here then it will be treated as a select statement.
-
batchLimit
public int batchLimit
-
sqlStateCodes
public final java.util.Map<java.lang.Integer,java.util.Set<java.lang.String>> sqlStateCodes
-
_proxyManager
protected ProxyManager _proxyManager
-
_procs
protected java.util.Map<java.lang.String,StoredProcedure> _procs
-
-
Method Detail
-
connectedConfiguration
public void connectedConfiguration(java.sql.Connection conn) throws java.sql.SQLException
This method is called when the dictionary first sees any connection. It is used to initialize dictionary metadata if needed. If you override this method, be sure to callsuper.connectedConfiguration
.- Throws:
java.sql.SQLException
-
configureNamingRules
protected void configureNamingRules()
Configures the naming rules for this dictionary. Subclasses should override this method, providing their own naming rules.
-
getArray
public java.sql.Array getArray(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.- Throws:
java.sql.SQLException
-
getAsciiStream
public java.io.InputStream getAsciiStream(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.- Throws:
java.sql.SQLException
-
getBigDecimal
public java.math.BigDecimal getBigDecimal(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.- Throws:
java.sql.SQLException
-
getNumber
public java.lang.Number getNumber(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Returns the specified column value as an unknown numeric type; we try from the most generic to the least generic.- Throws:
java.sql.SQLException
-
getBigInteger
public java.math.BigInteger getBigInteger(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.- Throws:
java.sql.SQLException
-
getBinaryStream
public java.io.InputStream getBinaryStream(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.- Throws:
java.sql.SQLException
-
getLOBStream
public java.io.InputStream getLOBStream(JDBCStore store, java.sql.ResultSet rs, int column) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
getBlob
public java.sql.Blob getBlob(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.- Throws:
java.sql.SQLException
-
getBlobObject
public java.lang.Object getBlobObject(java.sql.ResultSet rs, int column, JDBCStore store) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.- Throws:
java.sql.SQLException
-
getBoolean
public boolean getBoolean(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.- Throws:
java.sql.SQLException
-
getByte
public byte getByte(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.- Throws:
java.sql.SQLException
-
getBytes
public byte[] getBytes(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.- Throws:
java.sql.SQLException
-
getCalendar
public java.util.Calendar getCalendar(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type. Converts the date from aTimestamp
by default.- Throws:
java.sql.SQLException
-
getLocalDate
public java.time.LocalDate getLocalDate(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Retrieve the specified column of the SQL ResultSet to the properLocalDate
java type.- Throws:
java.sql.SQLException
-
getLocalTime
public java.time.LocalTime getLocalTime(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Retrieve the specified column of the SQL ResultSet to the properLocalTime
java type.- Throws:
java.sql.SQLException
-
getLocalDateTime
public java.time.LocalDateTime getLocalDateTime(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Retrieve the specified column of the SQL ResultSet to the properLocalDateTime
java type.- Throws:
java.sql.SQLException
-
getOffsetTime
public java.time.OffsetTime getOffsetTime(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Retrieve the specified column of the SQL ResultSet to the properOffsetTime
java type.- Throws:
java.sql.SQLException
-
getOffsetDateTime
public java.time.OffsetDateTime getOffsetDateTime(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Retrieve the specified column of the SQL ResultSet to the properOffsetDateTime
java type.- Throws:
java.sql.SQLException
-
getChar
public char getChar(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.- Throws:
java.sql.SQLException
-
getCharacterStream
public java.io.Reader getCharacterStream(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.- Throws:
java.sql.SQLException
-
getClob
public java.sql.Clob getClob(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.- Throws:
java.sql.SQLException
-
getClobString
public java.lang.String getClobString(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.- Throws:
java.sql.SQLException
-
getDate
public java.util.Date getDate(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type. Converts the date from aTimestamp
by default.- Throws:
java.sql.SQLException
-
getDate
public java.sql.Date getDate(java.sql.ResultSet rs, int column, java.util.Calendar cal) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.- Throws:
java.sql.SQLException
-
getDouble
public double getDouble(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.- Throws:
java.sql.SQLException
-
getFloat
public float getFloat(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.- Throws:
java.sql.SQLException
-
getInt
public int getInt(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.- Throws:
java.sql.SQLException
-
getLocale
public java.util.Locale getLocale(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.- Throws:
java.sql.SQLException
-
getLong
public long getLong(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.- Throws:
java.sql.SQLException
-
getObject
public java.lang.Object getObject(java.sql.ResultSet rs, int column, java.util.Map map) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.- Throws:
java.sql.SQLException
-
getRef
public java.sql.Ref getRef(java.sql.ResultSet rs, int column, java.util.Map map) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.- Throws:
java.sql.SQLException
-
getShort
public short getShort(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.- Throws:
java.sql.SQLException
-
getString
public java.lang.String getString(java.sql.ResultSet rs, int column) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.- Throws:
java.sql.SQLException
-
getTime
public java.sql.Time getTime(java.sql.ResultSet rs, int column, java.util.Calendar cal) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.- Throws:
java.sql.SQLException
-
getTimestamp
public java.sql.Timestamp getTimestamp(java.sql.ResultSet rs, int column, java.util.Calendar cal) throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.- Throws:
java.sql.SQLException
-
setArray
public void setArray(java.sql.PreparedStatement stmnt, int idx, java.sql.Array val, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setAsciiStream
public void setAsciiStream(java.sql.PreparedStatement stmnt, int idx, java.io.InputStream val, int length, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setBigDecimal
public void setBigDecimal(java.sql.PreparedStatement stmnt, int idx, java.math.BigDecimal val, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setBigInteger
public void setBigInteger(java.sql.PreparedStatement stmnt, int idx, java.math.BigInteger val, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setBinaryStream
public void setBinaryStream(java.sql.PreparedStatement stmnt, int idx, java.io.InputStream val, int length, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setBlob
public void setBlob(java.sql.PreparedStatement stmnt, int idx, java.sql.Blob val, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setBlobObject
public void setBlobObject(java.sql.PreparedStatement stmnt, int idx, java.lang.Object val, Column col, JDBCStore store) throws java.sql.SQLException
Set the given value as a parameter to the statement. Uses theserialize(java.lang.Object, org.apache.openjpa.jdbc.kernel.JDBCStore)
method to serialize the value.- Throws:
java.sql.SQLException
-
setBoolean
public void setBoolean(java.sql.PreparedStatement stmnt, int idx, boolean val, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setByte
public void setByte(java.sql.PreparedStatement stmnt, int idx, byte val, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setBytes
public void setBytes(java.sql.PreparedStatement stmnt, int idx, byte[] val, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setChar
public void setChar(java.sql.PreparedStatement stmnt, int idx, char val, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setCharacterStream
public void setCharacterStream(java.sql.PreparedStatement stmnt, int idx, java.io.Reader val, int length, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setClob
public void setClob(java.sql.PreparedStatement stmnt, int idx, java.sql.Clob val, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setClobString
public void setClobString(java.sql.PreparedStatement stmnt, int idx, java.lang.String val, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setDate
public void setDate(java.sql.PreparedStatement stmnt, int idx, java.util.Date val, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setDate
public void setDate(java.sql.PreparedStatement stmnt, int idx, java.sql.Date val, java.util.Calendar cal, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setCalendar
public void setCalendar(java.sql.PreparedStatement stmnt, int idx, java.util.Calendar val, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setLocalDate
public void setLocalDate(java.sql.PreparedStatement stmnt, int idx, java.time.LocalDate val, Column col) throws java.sql.SQLException
Set the given LocalDate value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setLocalTime
public void setLocalTime(java.sql.PreparedStatement stmnt, int idx, java.time.LocalTime val, Column col) throws java.sql.SQLException
Set the given LocalTime value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setLocalDateTime
public void setLocalDateTime(java.sql.PreparedStatement stmnt, int idx, java.time.LocalDateTime val, Column col) throws java.sql.SQLException
Set the given LocalTime value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setOffsetTime
public void setOffsetTime(java.sql.PreparedStatement stmnt, int idx, java.time.OffsetTime val, Column col) throws java.sql.SQLException
Set the given LocalTime value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setOffsetDateTime
public void setOffsetDateTime(java.sql.PreparedStatement stmnt, int idx, java.time.OffsetDateTime val, Column col) throws java.sql.SQLException
Set the given LocalTime value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setDouble
public void setDouble(java.sql.PreparedStatement stmnt, int idx, double val, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setFloat
public void setFloat(java.sql.PreparedStatement stmnt, int idx, float val, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setInt
public void setInt(java.sql.PreparedStatement stmnt, int idx, int val, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setLong
public void setLong(java.sql.PreparedStatement stmnt, int idx, long val, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setLocale
public void setLocale(java.sql.PreparedStatement stmnt, int idx, java.util.Locale val, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setNull
public void setNull(java.sql.PreparedStatement stmnt, int idx, int colType, Column col) throws java.sql.SQLException
Set null as a parameter to the statement. The column type will come fromTypes
.- Throws:
java.sql.SQLException
-
setNumber
public void setNumber(java.sql.PreparedStatement stmnt, int idx, java.lang.Number num, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setObject
public void setObject(java.sql.PreparedStatement stmnt, int idx, java.lang.Object val, int colType, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement. The column type will come fromTypes
.- Throws:
java.sql.SQLException
-
setRef
public void setRef(java.sql.PreparedStatement stmnt, int idx, java.sql.Ref val, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setShort
public void setShort(java.sql.PreparedStatement stmnt, int idx, short val, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setString
public void setString(java.sql.PreparedStatement stmnt, int idx, java.lang.String val, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setTime
public void setTime(java.sql.PreparedStatement stmnt, int idx, java.sql.Time val, java.util.Calendar cal, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setTimestamp
public void setTimestamp(java.sql.PreparedStatement stmnt, int idx, java.sql.Timestamp val, java.util.Calendar cal, Column col) throws java.sql.SQLException
Set the given value as a parameter to the statement.- Throws:
java.sql.SQLException
-
setTyped
public void setTyped(java.sql.PreparedStatement stmnt, int idx, java.lang.Object val, Column col, int type, JDBCStore store) throws java.sql.SQLException
Set a column value into a prepared statement.- Parameters:
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- Throws:
java.sql.SQLException
-
setUnknown
public void setUnknown(java.sql.PreparedStatement stmt, int idx, java.lang.Object val, Column col) throws java.sql.SQLException
Set a completely unknown parameter into a prepared statement.- Throws:
java.sql.SQLException
-
setUnknown
public void setUnknown(java.sql.PreparedStatement stmnt, int idx, Column col, java.lang.Object val) throws java.sql.SQLException
Set a completely unknown parameter into a prepared statement.- Throws:
java.sql.SQLException
-
serialize
public byte[] serialize(java.lang.Object val, JDBCStore store) throws java.sql.SQLException
Return the serialized bytes for the given object.- Throws:
java.sql.SQLException
-
putBytes
public void putBytes(java.sql.Blob blob, byte[] data) throws java.sql.SQLException
Invoke the JDK 1.4setBytes
method on the given BLOB object.- Throws:
java.sql.SQLException
-
putString
public void putString(java.sql.Clob clob, java.lang.String data) throws java.sql.SQLException
Invoke the JDK 1.4setString
method on the given CLOB object.- Throws:
java.sql.SQLException
-
putChars
public void putChars(java.sql.Clob clob, char[] data) throws java.sql.SQLException
Invoke the JDK 1.4setCharacterStream
method on the given CLOB object.- Throws:
java.sql.SQLException
-
storageWarning
protected void storageWarning(java.lang.Object orig, java.lang.Object converted)
Warn that a particular value could not be stored precisely. After the first warning for a particular type, messages will be turned into trace messages.
-
getJDBCType
public int getJDBCType(int metaTypeCode, boolean lob)
-
getJDBCType
public int getJDBCType(int metaTypeCode, boolean lob, int precis, int scale, boolean xml)
-
getJDBCType
public int getJDBCType(int metaTypeCode, boolean lob, int precis, int scale)
-
getPreferredType
public int getPreferredType(int type)
Return the preferredTypes
type for the given one. Returns the given type by default.
-
getTypeName
public java.lang.String getTypeName(Column col)
Return the preferred database type name for the given column's type fromTypes
.
-
getTypeName
public java.lang.String getTypeName(int type)
Returns the type name for the specific constant as defined byTypes
.- Parameters:
type
- the type- Returns:
- the name for the type
-
appendSize
protected java.lang.String appendSize(Column col, java.lang.String typeName)
Helper method to add size properties to the specified type. If present, the string "{0}" will be replaced with the size definition; otherwise the size definition will be appended to the type name. If your database has column types that don't allow size definitions, override this method to return the unaltered type name for columns of those types (or add the type names to thefixedSizeTypeNameSet
).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.
-
getDateFractionDigits
protected int getDateFractionDigits(Column col, java.lang.String typeName)
Only get's used if no explicit scale is used (@{code @Column(scale=0)} which is the default). Attention! @{code @Column(scale=-1)} disables the scale of a column- Returns:
- the fraction length of types which have a fraction
- See Also:
fractionalTypeNameSet
-
insertSize
protected java.lang.String insertSize(java.lang.String typeName, java.lang.String size)
Helper method that inserts a size clause for a given SQL type.- Parameters:
typeName
- The SQL type e.g. INTsize
- The size clause e.g. (10)- Returns:
- The typeName + size clause. Usually the size clause will be appended to typeName. If the typeName contains a marker : {0} or if typeName contains a modifier the size clause will be inserted appropriately.
-
setJoinSyntax
public void setJoinSyntax(java.lang.String syntax)
Set the name of the join syntax to use: sql92, traditional, database.
-
isImplicitJoin
public boolean isImplicitJoin()
-
getPlaceholderValueString
public java.lang.String getPlaceholderValueString(Column col)
Return a SQL string to act as a placeholder for the given column.
-
toSelectCount
public SQLBuffer toSelectCount(Select sel)
Create a SELECT COUNT statement in the proper join syntax for the given instance.
-
toDelete
public SQLBuffer toDelete(ClassMapping mapping, Select sel, java.lang.Object[] params)
Create a DELETE statement for the specified Select. If the database does not support the bulk delete statement (such as cases where a subselect is required and the database doesn't support subselects), this method should return null.
-
toUpdate
public SQLBuffer toUpdate(ClassMapping mapping, Select sel, JDBCStore store, java.lang.Object[] params, java.util.Map updates)
-
toBulkOperation
protected SQLBuffer toBulkOperation(ClassMapping mapping, Select sel, JDBCStore store, java.lang.Object[] params, java.util.Map updateParams)
Returns the SQL for a bulk operation, either a DELETE or an UPDATE.- Parameters:
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- Returns:
- the SQLBuffer for the update, or null if it is not possible to perform the bulk update
-
getSelectTableAliases
protected java.util.Collection<java.lang.String> getSelectTableAliases(Select sel)
-
appendUpdates
protected void appendUpdates(Select sel, JDBCStore store, SQLBuffer sql, java.lang.Object[] params, java.util.Map updateParams, boolean allowAlias)
-
getDeleteTableContentsSQL
public java.lang.String[] getDeleteTableContentsSQL(Table[] tables, java.sql.Connection conn)
Create SQL to delete the contents of the specified tables. The default implementation drops all non-deferred RESTRICT foreign key constraints involving the specified tables, issues DELETE statements against the tables, and then adds the dropped constraints back in. Databases with more optimal ways of deleting the contents of several tables should override this method.
-
toSelect
public SQLBuffer toSelect(Select sel, boolean forUpdate, JDBCFetchConfiguration fetch)
Create a SELECT statement in the proper join syntax for the given instance.
-
getFrom
protected SQLBuffer getFrom(Select sel, boolean forUpdate)
Return the portion of the select statement between the FROM keyword and the WHERE keyword.
-
getFromSelect
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.
-
getWhere
protected SQLBuffer getWhere(Select sel, boolean forUpdate)
Return the WHERE portion of the select statement, or null if no where conditions.
-
toTraditionalJoin
public SQLBuffer toTraditionalJoin(Join join)
Use the given join instance to create SQL joining its tables in the traditional style.
-
toSQL92Join
public 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.
-
toNativeJoin
public SQLBuffer toNativeJoin(Join join)
Use the given join instance to create SQL joining its tables in the database's native syntax. Throws an exception by default.
-
canOuterJoin
public boolean canOuterJoin(int syntax, ForeignKey fk)
Returns if the given foreign key can be eagerly loaded using other joins.
-
toSelect
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)
Combine the given components into a SELECT statement.
-
toSelect
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.
-
toSelect
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)
-
toSelect
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.
-
getForUpdateClause
protected java.lang.String getForUpdateClause(JDBCFetchConfiguration fetch, boolean isForUpdate, Select sel)
Get the update clause for the query based on the updateClause and isolationLevel hints
-
supportsIsolationForUpdate
public boolean supportsIsolationForUpdate()
Return true if the dictionary uses isolation level to compute the returned getForUpdateClause() SQL clause.
-
getSelectOperation
public java.lang.String getSelectOperation(JDBCFetchConfiguration fetch)
Return the "SELECT" operation clause, adding any available hints, etc.
-
toOperation
public SQLBuffer toOperation(java.lang.String op, SQLBuffer selects, SQLBuffer from, SQLBuffer where, SQLBuffer group, SQLBuffer having, SQLBuffer order, boolean distinct, long start, long end, java.lang.String forUpdateClause)
Return the SQL for the given selecting operation.
-
toOperation
public SQLBuffer toOperation(java.lang.String op, SQLBuffer selects, SQLBuffer from, SQLBuffer where, SQLBuffer group, SQLBuffer having, SQLBuffer order, boolean distinct, long start, long end, java.lang.String forUpdateClause, boolean subselect)
Return the SQL for the given selecting operation.
-
appendSelectRange
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.
-
getSelects
protected SQLBuffer getSelects(Select sel, boolean distinctIdentifiers, boolean forUpdate)
Return the portion of the select statement between the SELECT keyword and the FROM keyword.
-
appendSelect
protected void appendSelect(SQLBuffer selectSQL, java.lang.Object elem, Select sel, int idx)
Appendelem
toselectSQL
.- Parameters:
selectSQL
- The SQLBuffer to append to.elem
- ASQLBuffer
or aString
to append.- Since:
- 1.1.0
-
supportsLocking
public boolean supportsLocking(Select sel)
Returns true if a "FOR UPDATE" clause can be used for the specified Select object.
-
supportsRandomAccessResultSet
public boolean supportsRandomAccessResultSet(Select sel, boolean forUpdate)
Return false if the given select requires a forward-only result set.
-
assertSupport
public void assertSupport(boolean feature, java.lang.String property)
Assert that the given dictionary flag is true. If it is not true, throw an error saying that the given setting needs to return true for the current operation to work.
-
substring
public void substring(SQLBuffer buf, FilterValue str, FilterValue start, FilterValue length)
Invoke this database's substring function. Numeric parameters are inlined if possible. This is to handle grouping by SUBSTRING - most databases do not allow parameter binding in this case.- Parameters:
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 none
-
indexOf
public void indexOf(SQLBuffer buf, FilterValue str, FilterValue find, FilterValue start)
Invoke this database's indexOf function.- Parameters:
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 beginning
-
mathFunction
public void mathFunction(SQLBuffer buf, java.lang.String op, FilterValue lhs, FilterValue rhs)
Append the numeric parts of a mathematical function.- Parameters:
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 function
-
comparison
public void comparison(SQLBuffer buf, java.lang.String op, FilterValue lhs, FilterValue rhs)
Append a comparison.- Parameters:
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 comparison
-
appendXmlComparison
public void appendXmlComparison(SQLBuffer buf, java.lang.String op, FilterValue lhs, FilterValue rhs, boolean lhsxml, boolean rhsxml)
If this dictionary supports XML type, use this method to append xml predicate.
-
appendNumericCast
protected void appendNumericCast(SQLBuffer buf, FilterValue val)
Append SQL for the given numeric value to the buffer, casting as needed.
-
appendCast
public void appendCast(SQLBuffer buf, java.lang.Object val, int type)
Cast the specified value to the specified type.- Parameters:
buf
- the buffer to append the cast toval
- the value to casttype
- the type of the case, e.g.Types.NUMERIC
-
appendLength
protected void appendLength(SQLBuffer buf, int type)
-
addCastAsType
public java.lang.String addCastAsType(java.lang.String func, Val val)
add CAST for a function operator where operand is a param- Parameters:
func
- function nameval
-- Returns:
- updated func
-
refSchemaComponents
public void refSchemaComponents(Table table)
Increment the reference count of any table components that this dictionary adds that are not used by mappings. Does nothing by default.
-
getColumnIdentifier
public DBIdentifier getColumnIdentifier(Column column)
Returns the name of the column using database specific delimiters.
-
getColumnDBName
public java.lang.String getColumnDBName(Column column)
-
toSnakeCase
public java.lang.String toSnakeCase(java.lang.String name)
-
getFullIdentifier
public DBIdentifier getFullIdentifier(Table table, boolean logical)
Returns the full name of the table, including the schema (delimited bycatalogSeparator
).
-
getFullName
public java.lang.String getFullName(Table table, boolean logical)
-
getFullName
public java.lang.String getFullName(Index index)
Returns the full name of the index, including the schema (delimited by the result ofcatalogSeparator
).
-
getFullName
public java.lang.String getFullName(Sequence seq)
Returns the full name of the sequence, including the schema (delimited by the result ofcatalogSeparator
).
-
getInvalidColumnWordSet
public final java.util.Set<java.lang.String> getInvalidColumnWordSet()
Return the subset of the words in reservedWordSet that cannot be used as valid column names for the current DB. If the column name is invalid the getValidColumnName method of the DB dictionary should be invoked to make it valid.
-
getValidTableName
@Deprecated public java.lang.String getValidTableName(java.lang.String name, Schema schema)
Deprecated.Make any necessary changes to the given table name to make it valid for the current DB.
-
getValidTableName
public DBIdentifier getValidTableName(DBIdentifier name, Schema schema)
Make any necessary changes to the given table name to make it valid for the current DB.
-
getValidSequenceName
@Deprecated public java.lang.String getValidSequenceName(java.lang.String name, Schema schema)
Deprecated.Make any necessary changes to the given sequence name to make it valid for the current DB.
-
getValidSequenceName
public DBIdentifier getValidSequenceName(DBIdentifier name, Schema schema)
Make any necessary changes to the given sequence name to make it valid for the current DB.
-
getValidColumnName
@Deprecated public java.lang.String getValidColumnName(java.lang.String name, Table table)
Deprecated.Make any necessary changes to the given column name to make it valid for the current DB. The column name will be made unique for the specified table.
-
processDBColumnName
public DBIdentifier processDBColumnName(DBIdentifier name)
-
getValidColumnName
public DBIdentifier getValidColumnName(DBIdentifier name, Table table)
Make any necessary changes to the given column name to make it valid for the current DB. The column name will be made unique for the specified table.
-
getValidColumnName
@Deprecated public java.lang.String getValidColumnName(java.lang.String name, Table table, boolean checkForUniqueness)
Deprecated.Make any necessary changes to the given column name to make it valid for the current DB. If checkForUniqueness is true, the column name will be made unique for the specified table.
-
getValidColumnName
public 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. If checkForUniqueness is true, the column name will be made unique for the specified table.
-
getValidPrimaryKeyName
public java.lang.String getValidPrimaryKeyName(java.lang.String name, Table table)
Make any necessary changes to the given primary key name to make it valid for the current DB.
-
getValidForeignKeyName
@Deprecated public java.lang.String getValidForeignKeyName(java.lang.String name, Table table, Table toTable)
Deprecated.Make any necessary changes to the given foreign key name to make it valid for the current DB.
-
getValidForeignKeyName
public 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.
-
getValidIndexName
@Deprecated public java.lang.String getValidIndexName(java.lang.String name, Table table)
Deprecated.Make any necessary changes to the given index name to make it valid for the current DB.
-
getValidIndexName
public DBIdentifier getValidIndexName(DBIdentifier name, Table table)
Make any necessary changes to the given index name to make it valid for the current DB.
-
getValidUniqueName
@Deprecated public java.lang.String getValidUniqueName(java.lang.String name, Table table)
Deprecated.Make any necessary changes to the given unique constraint name to make it valid for the current DB.
-
getValidUniqueName
public DBIdentifier getValidUniqueName(DBIdentifier name, Table table)
Make any necessary changes to the given unique constraint name to make it valid for the current DB.
-
shorten
public static java.lang.String shorten(java.lang.String name, int targetLength)
Shorten the specified name to the specified target name. This will be done by first stripping out the vowels, and then removing characters from the middle of the word until it reaches the target length.
-
makeNameValid
@Deprecated protected java.lang.String makeNameValid(java.lang.String name, NameSet set, int maxLen, int nameType)
Deprecated.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, 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.
-
makeNameValid
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. If it is reserved, appends a "0". If the name conflicts with an existing schema component, 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.
-
makeNameValid
protected java.lang.String makeNameValid(java.lang.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.
-
makeNameValid
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. 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.
-
getCreateTableSQL
public java.lang.String[] getCreateTableSQL(Table table, SchemaGroup group)
Return a series of SQL statements to create the given table, complete with columns. Indexes and constraints will be created separately.
-
getCreateTableSQL
public java.lang.String[] getCreateTableSQL(Table table)
Return a series of SQL statements to create the given table, complete with columns. Indexes and constraints will be created separately.
-
getBatchFetchSize
public int getBatchFetchSize(int batchFetchSize)
-
comment
protected java.lang.StringBuilder comment(java.lang.StringBuilder buf, java.lang.String comment)
-
getDropTableSQL
public java.lang.String[] getDropTableSQL(Table table)
Return a series of SQL statements to drop the given table. Indexes will be dropped separately. ReturnsDROP TABLE <table name>
by default.
-
getCreateSequenceSQL
public java.lang.String[] getCreateSequenceSQL(Sequence seq)
Return a series of SQL statements to create the given sequence. ReturnsCREATE SEQUENCE <sequence name>[ START WITH <start>] [ INCREMENT BY <increment>]
by default.
-
getAlterSequenceSQL
public java.lang.String getAlterSequenceSQL(Sequence seq)
-
getDropSequenceSQL
public java.lang.String[] getDropSequenceSQL(Sequence seq)
Return a series of SQL statements to drop the given sequence. ReturnsDROP SEQUENCE <sequence name>
by default.
-
getCreateIndexSQL
public java.lang.String[] getCreateIndexSQL(Index index)
Return a series of SQL statements to create the given index. ReturnsCREATE [UNIQUE] INDEX <index name> ON <table name> (<col list>)
by default.
-
getDropIndexSQL
public java.lang.String[] getDropIndexSQL(Index index)
Return a series of SQL statements to drop the given index. ReturnsDROP INDEX <index name>
by default.
-
getAddColumnSQL
public java.lang.String[] getAddColumnSQL(Column column)
Return a series of SQL statements to add the given column to its table. Return an empty array if operation not supported. ReturnsALTER TABLE <table name> ADD (<col dec>)
by default.
-
getDropColumnSQL
public java.lang.String[] getDropColumnSQL(Column column)
Return a series of SQL statements to drop the given column from its table. Return an empty array if operation not supported. ReturnsALTER TABLE <table name> DROP COLUMN <col name>
by default.
-
getAddPrimaryKeySQL
public java.lang.String[] getAddPrimaryKeySQL(PrimaryKey pk)
Return a series of SQL statements to add the given primary key to its table. Return an empty array if operation not supported. ReturnsALTER TABLE <table name> ADD <pk cons sql >
by default.
-
getDropPrimaryKeySQL
public java.lang.String[] getDropPrimaryKeySQL(PrimaryKey pk)
Return a series of SQL statements to drop the given primary key from its table. Return an empty array if operation not supported. ReturnsALTER TABLE <table name> DROP CONSTRAINT <pk name>
by default.
-
getAddForeignKeySQL
public java.lang.String[] getAddForeignKeySQL(ForeignKey fk)
Return a series of SQL statements to add the given foreign key to its table. Return an empty array if operation not supported. ReturnsALTER TABLE <table name> ADD <fk cons sql >
by default.
-
getDropForeignKeySQL
public java.lang.String[] getDropForeignKeySQL(ForeignKey fk, java.sql.Connection conn)
Return a series of SQL statements to drop the given foreign key from its table. Return an empty array if operation not supported. ReturnsALTER TABLE <table name> DROP CONSTRAINT <fk name>
by default.
-
getDeclareColumnSQL
protected java.lang.String getDeclareColumnSQL(Column col, boolean alter)
Return the declaration SQL for the given column. This method is used for each column from withingetCreateTableSQL(org.apache.openjpa.jdbc.schema.Table, org.apache.openjpa.jdbc.schema.SchemaGroup)
andgetAddColumnSQL(org.apache.openjpa.jdbc.schema.Column)
.
-
getPrimaryKeyConstraintSQL
protected java.lang.String getPrimaryKeyConstraintSQL(PrimaryKey pk)
Return the declaration SQL for the given primary key. This method is used from withingetCreateTableSQL(org.apache.openjpa.jdbc.schema.Table, org.apache.openjpa.jdbc.schema.SchemaGroup)
andgetAddPrimaryKeySQL(org.apache.openjpa.jdbc.schema.PrimaryKey)
. ReturnsCONSTRAINT <pk name> PRIMARY KEY (<col list>)
by default.
-
getForeignKeyConstraintSQL
protected java.lang.String getForeignKeyConstraintSQL(ForeignKey fk)
Return the declaration SQL for the given foreign key, or null if it is not supported. This method is used from withingetCreateTableSQL(org.apache.openjpa.jdbc.schema.Table, org.apache.openjpa.jdbc.schema.SchemaGroup)
andgetAddForeignKeySQL(org.apache.openjpa.jdbc.schema.ForeignKey)
. ReturnsCONSTRAINT <cons name> FOREIGN KEY (<col list>) REFERENCES <foreign table> (<col list>) [ON DELETE <action>] [ON UPDATE <action>]
by default.
-
supportsDeferredForeignKeyConstraints
protected boolean supportsDeferredForeignKeyConstraints()
Whether or not this dictionary supports deferred foreign key constraints. This implementation returnssupportsUniqueConstraints
.- Since:
- 1.1.0
-
supportsDeleteAction
public boolean supportsDeleteAction(int action)
Whether this database supports the given foreign key delete action.
-
supportsUpdateAction
public boolean supportsUpdateAction(int action)
Whether this database supports the given foreign key update action.
-
getUniqueConstraintSQL
protected java.lang.String getUniqueConstraintSQL(Unique unq)
Return the declaration SQL for the given unique constraint. This method is used from withingetCreateTableSQL(org.apache.openjpa.jdbc.schema.Table, org.apache.openjpa.jdbc.schema.SchemaGroup)
. ReturnsCONSTRAINT <name> UNIQUE (<col list>)
by default.
-
supportsDeferredUniqueConstraints
protected boolean supportsDeferredUniqueConstraints()
Whether or not this dictionary supports deferred unique constraints. This implementation returnssupportsUniqueConstraints
.- Since:
- 1.1.0
-
isSystemTable
@Deprecated public boolean isSystemTable(java.lang.String name, java.lang.String schema, boolean targetSchema)
Deprecated.This method is used to filter system tables from database metadata. Return true if the given table name represents a system table that should not appear in the schema definition. By default, returns true only if the given table is in the internal list of system tables, or if the given schema is in the list of system schemas and is not the target schema.- Parameters:
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 schemas
-
isSystemTable
public boolean isSystemTable(DBIdentifier name, DBIdentifier schema, boolean targetSchema)
This method is used to filter system tables from database metadata. Return true if the given table name represents a system table that should not appear in the schema definition. By default, returns true only if the given table is in the internal list of system tables, or if the given schema is in the list of system schemas and is not the target schema.- Parameters:
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 schemas
-
isSystemIndex
@Deprecated public boolean isSystemIndex(java.lang.String name, Table table)
Deprecated.This method is used to filter system indexes from database metadata. Return true if the given index name represents a system index that should not appear in the schema definition. Returns false by default.- Parameters:
name
- the index nametable
- the index table
-
isSystemIndex
public boolean isSystemIndex(DBIdentifier name, Table table)
This method is used to filter system indexes from database metadata. Return true if the given index name represents a system index that should not appear in the schema definition. Returns false by default.- Parameters:
name
- the index nametable
- the index table
-
isSystemSequence
@Deprecated public boolean isSystemSequence(java.lang.String name, java.lang.String schema, boolean targetSchema)
Deprecated.This method is used to filter system sequences from database metadata. Return true if the given sequence represents a system sequence that should not appear in the schema definition. Returns true if system schema by default.- Parameters:
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 schemas
-
isSystemSequence
public boolean isSystemSequence(DBIdentifier name, DBIdentifier schema, boolean targetSchema)
This method is used to filter system sequences from database metadata. Return true if the given sequence represents a system sequence that should not appear in the schema definition. Returns true if system schema by default.- Parameters:
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 schemas
-
isSystemSequence
public boolean isSystemSequence(DBIdentifier name, DBIdentifier schema, boolean targetSchema, java.sql.Connection conn)
This method is used to filter system sequences from database metadata. Return true if the given sequence represents a system sequence that should not appear in the schema definition. Returns true if system schema by default.- Parameters:
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 database
-
getTables
@Deprecated public Table[] getTables(java.sql.DatabaseMetaData meta, java.lang.String catalog, java.lang.String schemaName, java.lang.String tableName, java.sql.Connection conn) throws java.sql.SQLException
Deprecated.not used by openjpa internally anymoreReflect on the schema to find tables matching the given name pattern.- Throws:
java.sql.SQLException
- See Also:
getTables(DatabaseMetaData, DBIdentifier, DBIdentifier, DBIdentifier, Connection)
-
getTables
public Table[] getTables(java.sql.DatabaseMetaData meta, DBIdentifier sqlCatalog, DBIdentifier sqlSchemaName, DBIdentifier sqlTableName, java.sql.Connection conn) throws java.sql.SQLException
Reflect on the schema to find tables matching the given name pattern.- Throws:
java.sql.SQLException
-
newTable
protected Table newTable(java.sql.ResultSet tableMeta) throws java.sql.SQLException
Create a new table from the information in the schema metadata.- Throws:
java.sql.SQLException
-
getSequences
@Deprecated public Sequence[] getSequences(java.sql.DatabaseMetaData meta, java.lang.String catalog, java.lang.String schemaName, java.lang.String sequenceName, java.sql.Connection conn) throws java.sql.SQLException
Deprecated.Reflect on the schema to find sequences matching the given name pattern. Returns an empty array by default, as there is no standard way to retrieve a list of sequences.- Throws:
java.sql.SQLException
-
getSequences
public Sequence[] getSequences(java.sql.DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier sequenceName, java.sql.Connection conn) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
newSequence
protected Sequence newSequence(java.sql.ResultSet sequenceMeta) throws java.sql.SQLException
Create a new sequence from the information in the schema metadata.- Throws:
java.sql.SQLException
-
getSequencesSQL
@Deprecated protected java.lang.String getSequencesSQL(java.lang.String schemaName, java.lang.String sequenceName)
Deprecated.Return the SQL needed to select the list of sequences.
-
getSequencesSQL
protected java.lang.String getSequencesSQL(DBIdentifier schemaName, DBIdentifier sequenceName)
-
getColumns
@Deprecated public Column[] getColumns(java.sql.DatabaseMetaData meta, java.lang.String catalog, java.lang.String schemaName, java.lang.String tableName, java.lang.String columnName, java.sql.Connection conn) throws java.sql.SQLException
Deprecated.Reflect on the schema to find columns matching the given table and column patterns.- Throws:
java.sql.SQLException
-
getColumns
public Column[] getColumns(java.sql.DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, DBIdentifier columnName, java.sql.Connection conn) throws java.sql.SQLException
Reflect on the schema to find columns matching the given table and column patterns.- Throws:
java.sql.SQLException
-
newColumn
protected Column newColumn(java.sql.ResultSet colMeta) throws java.sql.SQLException
Create a new column from the information in the schema metadata.- Throws:
java.sql.SQLException
-
getPrimaryKeys
@Deprecated public PrimaryKey[] getPrimaryKeys(java.sql.DatabaseMetaData meta, java.lang.String catalog, java.lang.String schemaName, java.lang.String tableName, java.sql.Connection conn) throws java.sql.SQLException
Deprecated.Reflect on the schema to find primary keys for the given table pattern.- Throws:
java.sql.SQLException
-
getPrimaryKeys
public PrimaryKey[] getPrimaryKeys(java.sql.DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, java.sql.Connection conn) throws java.sql.SQLException
Reflect on the schema to find primary keys for the given table pattern.- Throws:
java.sql.SQLException
-
getPrimaryKeysFromGetPrimaryKeys
@Deprecated protected PrimaryKey[] getPrimaryKeysFromGetPrimaryKeys(java.sql.DatabaseMetaData meta, java.lang.String catalog, java.lang.String schemaName, java.lang.String tableName, java.sql.Connection conn) throws java.sql.SQLException
Deprecated.Reflect on the schema to find primary keys for the given table pattern.- Throws:
java.sql.SQLException
-
getPrimaryKeysFromGetPrimaryKeys
protected PrimaryKey[] getPrimaryKeysFromGetPrimaryKeys(java.sql.DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, java.sql.Connection conn) throws java.sql.SQLException
Reflect on the schema to find primary keys for the given table pattern.- Throws:
java.sql.SQLException
-
newPrimaryKey
protected PrimaryKey newPrimaryKey(java.sql.ResultSet pkMeta) throws java.sql.SQLException
Create a new primary key from the information in the schema metadata.- Throws:
java.sql.SQLException
-
getPrimaryKeysFromBestRowIdentifier
@Deprecated protected PrimaryKey[] getPrimaryKeysFromBestRowIdentifier(java.sql.DatabaseMetaData meta, java.lang.String catalog, java.lang.String schemaName, java.lang.String tableName, java.sql.Connection conn) throws java.sql.SQLException
Deprecated.Reflect on the schema to find primary keys for the given table pattern.- Throws:
java.sql.SQLException
-
getPrimaryKeysFromBestRowIdentifier
protected PrimaryKey[] getPrimaryKeysFromBestRowIdentifier(java.sql.DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, java.sql.Connection conn) throws java.sql.SQLException
Reflect on the schema to find primary keys for the given table pattern.- Throws:
java.sql.SQLException
-
getIndexInfo
@Deprecated public Index[] getIndexInfo(java.sql.DatabaseMetaData meta, java.lang.String catalog, java.lang.String schemaName, java.lang.String tableName, boolean unique, boolean approx, java.sql.Connection conn) throws java.sql.SQLException
Deprecated.Reflect on the schema to find indexes matching the given table pattern.- Throws:
java.sql.SQLException
-
getIndexInfo
public Index[] getIndexInfo(java.sql.DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, boolean unique, boolean approx, java.sql.Connection conn) throws java.sql.SQLException
Reflect on the schema to find indexes matching the given table pattern.- Throws:
java.sql.SQLException
-
newIndex
protected Index newIndex(java.sql.ResultSet idxMeta) throws java.sql.SQLException
Create a new index from the information in the schema metadata.- Throws:
java.sql.SQLException
-
getImportedKeys
@Deprecated public ForeignKey[] getImportedKeys(java.sql.DatabaseMetaData meta, java.lang.String catalog, java.lang.String schemaName, java.lang.String tableName, java.sql.Connection conn) throws java.sql.SQLException
Deprecated.Reflect on the schema to return foreign keys imported by the given table pattern.- Throws:
java.sql.SQLException
-
getImportedKeys
public ForeignKey[] getImportedKeys(java.sql.DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, java.sql.Connection conn) throws java.sql.SQLException
Reflect on the schema to return foreign keys imported by the given table pattern.- Throws:
java.sql.SQLException
-
getImportedKeys
@Deprecated public ForeignKey[] getImportedKeys(java.sql.DatabaseMetaData meta, java.lang.String catalog, java.lang.String schemaName, java.lang.String tableName, java.sql.Connection conn, boolean partialKeys) throws java.sql.SQLException
Deprecated.Reflect on the schema to return full foreign keys imported by the given table pattern.- Throws:
java.sql.SQLException
-
getImportedKeys
public ForeignKey[] getImportedKeys(java.sql.DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, java.sql.Connection conn, boolean partialKeys) throws java.sql.SQLException
Reflect on the schema to return full foreign keys imported by the given table pattern.- Throws:
java.sql.SQLException
-
combineForeignKey
protected ForeignKey combineForeignKey(java.util.Map<ForeignKey.FKMapKey,ForeignKey> fkMap, ForeignKey fk)
Combines partial foreign keys into singular key
-
newForeignKey
protected ForeignKey newForeignKey(java.sql.ResultSet fkMeta) throws java.sql.SQLException
Create a new foreign key from the information in the schema metadata.- Throws:
java.sql.SQLException
-
getTableNameForMetadata
protected java.lang.String getTableNameForMetadata(java.lang.String tableName)
Returns the table name that will be used for obtaining information fromDatabaseMetaData
.
-
getTableNameForMetadata
protected java.lang.String getTableNameForMetadata(DBIdentifier tableName)
Returns the table name that will be used for obtaining information fromDatabaseMetaData
.
-
getSchemaNameForMetadata
protected java.lang.String getSchemaNameForMetadata(java.lang.String schemaName)
Returns the schema name that will be used for obtaining information fromDatabaseMetaData
.
-
getSchemaNameForMetadata
protected java.lang.String getSchemaNameForMetadata(DBIdentifier schemaName)
Returns the schema name that will be used for obtaining information fromDatabaseMetaData
.
-
getCatalogNameForMetadata
protected java.lang.String getCatalogNameForMetadata(java.lang.String catalogName)
Returns the catalog name that will be used for obtaining information fromDatabaseMetaData
.
-
getCatalogNameForMetadata
protected java.lang.String getCatalogNameForMetadata(DBIdentifier catalogName)
Returns the catalog name that will be used for obtaining information fromDatabaseMetaData
.
-
getColumnNameForMetadata
protected java.lang.String getColumnNameForMetadata(java.lang.String columnName)
Returns the column name that will be used for obtaining information fromDatabaseMetaData
.
-
getColumnNameForMetadata
protected java.lang.String getColumnNameForMetadata(DBIdentifier columnName)
Returns the column name that will be used for obtaining information fromDatabaseMetaData
.
-
convertSchemaCase
public java.lang.String convertSchemaCase(java.lang.String objectName)
Convert the specified schema name to a name that the database will be able to understand.
-
convertSchemaCase
public java.lang.String convertSchemaCase(DBIdentifier objectName)
Convert the specified schema name to a name that the database will be able to understand.
-
getSchemaCase
public java.lang.String getSchemaCase()
Return DB specific schemaCase- Specified by:
getSchemaCase
in interfaceIdentifierConfiguration
- Returns:
- upper, lower, or preserve
-
getGeneratedKey
public java.lang.Object getGeneratedKey(Column col, java.sql.Connection conn) throws java.sql.SQLException
Return the last generated value for the given column. Throws an exception by default iflastGeneratedKeyQuery
is null.- Throws:
java.sql.SQLException
-
getGenKeySeqName
protected java.lang.String getGenKeySeqName(java.lang.String query, Column col)
-
getGeneratedKeySequenceName
protected java.lang.String getGeneratedKeySequenceName(Column col)
Return the sequence name used by databases for the given autoassigned column. This is only used by databases that require an explicit name to be used for auto-assign support.
-
getStoredProcedure
public StoredProcedure getStoredProcedure(java.sql.DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schema, java.lang.String procedure) throws java.sql.SQLException
Gets the metadata of the stored procedure by the given name either from the cached version or by enquiring the database.- Parameters:
meta
- the database meta datacatalog
- the catalog name or nullschema
- the schema name or nullprocedure
- the procedure name- Returns:
- metadata about the named procedure or null
- Throws:
java.sql.SQLException
- when metadata query goes wrong
-
setConfiguration
public void setConfiguration(Configuration conf)
Description copied from interface:Configurable
Invoked prior to setting bean properties.- Specified by:
setConfiguration
in interfaceConfigurable
-
startConfiguration
public void startConfiguration()
Description copied from interface:Configurable
Invoked before bean property configuration is begun on this object.- Specified by:
startConfiguration
in interfaceConfigurable
-
endConfiguration
public void endConfiguration()
Description copied from interface:Configurable
Invoked upon completion of bean property configuration for this object.- Specified by:
endConfiguration
in interfaceConfigurable
-
addErrorCode
public void addErrorCode(int errorType, java.lang.String errorCode)
-
setTimeouts
public void setTimeouts(java.sql.PreparedStatement stmnt, JDBCFetchConfiguration fetch, boolean forUpdate) throws java.sql.SQLException
FIXME - OPENJPA-957 - lockTimeout is a server-side function and shouldn't be using client-side setQueryTimeout for lock timeouts. This method is to provide override for non-JDBC or JDBC-like implementation of setting query and lock timeouts.- Parameters:
stmnt
-fetch
- - optional lock and query timeouts in millisecondsforUpdate
- - true if we should also try setting a lock timeout- Throws:
java.sql.SQLException
-
setTimeouts
public void setTimeouts(java.sql.PreparedStatement stmnt, JDBCConfiguration conf, boolean forUpdate) throws java.sql.SQLException
FIXME - OPENJPA-957 - lockTimeout is a server-side function and shouldn't be using client-side setQueryTimeout for lock timeouts. This method is to provide override for non-JDBC or JDBC-like implementation of setting query and lock timeouts.- Parameters:
stmnt
-conf
- - optional lock and query timeouts in millisecondsforUpdate
- - true if we should also try setting a lock timeout- Throws:
java.sql.SQLException
-
setQueryTimeout
public void setQueryTimeout(java.sql.PreparedStatement stmnt, int timeout) throws java.sql.SQLException
Provides the default validation handling of setting a query timeout.- Parameters:
stmnt
-timeout
- in milliseconds- Throws:
java.sql.SQLException
-
setStatementQueryTimeout
protected void setStatementQueryTimeout(java.sql.PreparedStatement stmnt, int timeout) throws java.sql.SQLException
Allow subclasses to provide DB unique override implementations of setting query timeouts, while preserving the default timeout logic in the public setQueryTimeout method.- Parameters:
stmnt
-timeout
- in milliseconds- Throws:
java.sql.SQLException
-
decorate
public java.sql.Connection decorate(java.sql.Connection conn) throws java.sql.SQLException
Decorate the given connection if needed. Some databases require special handling for JDBC bugs. This implementation issues anyinitializationSQL
that has been set for the dictionary but does not decorate the connection.- Specified by:
decorate
in interfaceConnectionDecorator
- Throws:
java.sql.SQLException
-
handleWarning
public void handleWarning(java.sql.SQLWarning warning) throws java.sql.SQLException
Implementation of theLoggingConnectionDecorator.SQLWarningHandler
interface that allows customization of the actions to perform when aSQLWarning
occurs at any point on aConnection
,Statement
, orResultSet
. 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.- Specified by:
handleWarning
in interfaceLoggingConnectionDecorator.SQLWarningHandler
- Throws:
java.sql.SQLException
- See Also:
LoggingConnectionDecorator.setWarningAction(java.lang.String)
,LoggingConnectionDecorator.setWarningHandler(org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.SQLWarningHandler)
-
newStoreException
public OpenJPAException newStoreException(java.lang.String msg, java.sql.SQLException[] causes, java.lang.Object failed)
Return a new exception that wrapscauses
. 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 incauses
.
-
matchErrorState
protected int matchErrorState(java.util.Map<java.lang.Integer,java.util.Set<java.lang.String>> errorStates, java.sql.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. Dictionary subclass can override this method and extract SQLException data to figure out if the exception is recoverable.- Parameters:
errorStates
- classification of SQL error states by their specific nature. The keys of the map represent one of the constants defined inStoreException
. The value corresponding to a key represent the set of SQL Error States representing specific category of database error. This supplied map is sourced fromsql-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
.
-
isFatalException
public boolean isFatalException(int subtype, java.sql.SQLException ex)
Determine if the given SQL Exception is fatal or recoverable (such as a timeout). This implementation always returns true (i.e. all exceptions are fatal). The current dictionary implementation can overwrite this method to mark certain exception conditions as recoverable error.- Parameters:
subtype
- A constant indicating the category of error as defined inStoreException
.ex
- original SQL Exception as raised by the database driver.- Returns:
- false if the error is fatal.
-
closeDataSource
public void closeDataSource(javax.sql.DataSource dataSource)
Closes the specifiedDataSource
and releases any resources associated with it.- Parameters:
dataSource
- the DataSource to close
-
getVersionColumn
public java.lang.String getVersionColumn(Column column, java.lang.String tableAlias)
Return version column name- Parameters:
column
-tableAlias
- : this is needed for platform specific version column
-
getVersionColumn
public DBIdentifier getVersionColumn(Column column, DBIdentifier tableAlias)
-
insertBlobForStreamingLoad
public void insertBlobForStreamingLoad(Row row, Column col, JDBCStore store, java.lang.Object ob, Select sel) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
insertClobForStreamingLoad
public void insertClobForStreamingLoad(Row row, Column col, java.lang.Object ob) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
updateBlob
public void updateBlob(Select sel, JDBCStore store, java.io.InputStream is) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
updateClob
public void updateClob(Select sel, JDBCStore store, java.io.Reader reader) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
copy
protected long copy(java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException
- Throws:
java.io.IOException
-
copy
protected long copy(java.io.Reader reader, java.io.Writer writer) throws java.io.IOException
- Throws:
java.io.IOException
-
getCastFunction
public java.lang.String getCastFunction(Val val, java.lang.String func)
Attach CAST to the current function if necessary- Parameters:
val
- operand value- Returns:
- a String with the correct CAST function syntax
-
getCastFunction
public java.lang.String getCastFunction(Val val, java.lang.String func, Column col)
Return the correct CAST function syntax. This should be overriden by subclasses that need access to the Column information.- Parameters:
val
- operand of castfunc
- original stringcol
- database column- Returns:
- a String with the correct CAST function syntax
-
createIndexIfNecessary
@Deprecated public void createIndexIfNecessary(Schema schema, java.lang.String table, Column pkColumn)
Deprecated.Create an index if necessary for some database tables
-
createIndexIfNecessary
public void createIndexIfNecessary(Schema schema, DBIdentifier table, Column pkColumn)
-
getBatchLimit
public int getBatchLimit()
Return the batchLimit
-
setBatchLimit
public void setBatchLimit(int limit)
Set the batchLimit value
-
validateBatchProcess
public boolean validateBatchProcess(RowImpl row, Column[] autoAssign, OpenJPAStateManager sm, ClassMapping cmd)
Validate the batch process. In some cases, we can't batch the statements due to some restrictions. For example, if the GeneratedType=IDENTITY, we have to disable the batch process because we need to get the ID value right away for the in-memory entity to use.
-
validateDBSpecificBatchProcess
public boolean validateDBSpecificBatchProcess(boolean disableBatch, RowImpl row, Column[] autoAssign, OpenJPAStateManager sm, ClassMapping cmd)
Allow each Dictionary to validate its own batch process.
-
executeQuery
protected java.sql.ResultSet executeQuery(java.sql.Connection conn, java.sql.PreparedStatement stmnt, java.lang.String sql) throws java.sql.SQLException
This method is to provide override for non-JDBC or JDBC-like implementation of executing query.- Throws:
java.sql.SQLException
-
prepareStatement
protected java.sql.PreparedStatement prepareStatement(java.sql.Connection conn, java.lang.String sql) throws java.sql.SQLException
This method is to provide override for non-JDBC or JDBC-like implementation of preparing statement.- Throws:
java.sql.SQLException
-
getSequence
protected Sequence[] getSequence(java.sql.ResultSet rs) throws java.sql.SQLException
This method is to provide override for non-JDBC or JDBC-like implementation of getting sequence from the result set.- Throws:
java.sql.SQLException
-
getKey
protected java.lang.Object getKey(java.sql.ResultSet rs, Column col) throws java.sql.SQLException
This method is to provide override for non-JDBC or JDBC-like implementation of getting key from the result set.- Throws:
java.sql.SQLException
-
calculateValue
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.
-
isSelect
public boolean isSelect(java.lang.String sql)
Determine whether the providedsql
may be treated as a select statement on this database.- Parameters:
sql
- A sql statement.- Returns:
- true if
sql
represents a select statement.
-
getBatchUpdateCount
public int getBatchUpdateCount(java.sql.PreparedStatement ps) throws java.sql.SQLException
Return batched statements update success count- Parameters:
ps
- A PreparedStatement- Returns:
- return update count
- Throws:
java.sql.SQLException
-
getTrimSchemaName
public boolean getTrimSchemaName()
-
setTrimSchemaName
public void setTrimSchemaName(boolean trimSchemaName)
-
deleteStream
public void deleteStream(JDBCStore store, Select sel) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
setDelimitedCase
protected void setDelimitedCase(java.sql.DatabaseMetaData metaData)
-
getSupportsDelimitedIdentifiers
public boolean getSupportsDelimitedIdentifiers()
Description copied from interface:IdentifierConfiguration
Returns true if delimiting is supported- Specified by:
getSupportsDelimitedIdentifiers
in interfaceIdentifierConfiguration
- Returns:
- the supportsDelimitedIds
-
setSupportsDelimitedIdentifiers
public void setSupportsDelimitedIdentifiers(boolean supportsDelimitedIds)
- Parameters:
supportsDelimitedIds
- the supportsDelimitedIds to set
-
getDelimitIdentifiers
public boolean getDelimitIdentifiers()
- Returns:
- the delimitIds
-
setDelimitIdentifiers
public void setDelimitIdentifiers(boolean delimitIds)
- Parameters:
delimitIds
- the delimitIds to set
-
getSupportsXMLColumn
public boolean getSupportsXMLColumn()
- Returns:
- supportsXMLColumn
-
setSupportsXMLColumn
public void setSupportsXMLColumn(boolean b)
- Parameters:
b
- boolean representing if XML columns are supported
-
getXMLTypeEncoding
public java.lang.String getXMLTypeEncoding()
- Returns:
- xmlTypeEncoding
-
setXMLTypeEncoding
public void setXMLTypeEncoding(java.lang.String encoding)
- Parameters:
encoding
- database required JAXB encoding for the XML value
-
getLog
public Log getLog()
-
delimitAll
public boolean delimitAll()
Description copied from interface:IdentifierConfiguration
Returns true if global name delimiting is enabled.- Specified by:
delimitAll
in interfaceIdentifierConfiguration
-
getLeadingDelimiter
public java.lang.String getLeadingDelimiter()
Description copied from interface:IdentifierConfiguration
Returns the leading delimiter value to use when delimiting a name.- Specified by:
getLeadingDelimiter
in interfaceIdentifierConfiguration
-
setLeadingDelimiter
public void setLeadingDelimiter(java.lang.String delim)
-
getIdentifierDelimiter
public java.lang.String getIdentifierDelimiter()
Description copied from interface:IdentifierConfiguration
Returns the value used to delimit between individual names. For example: "." used in MYSCHEMA.MYTABLE- Specified by:
getIdentifierDelimiter
in interfaceIdentifierConfiguration
-
getIdentifierConcatenator
public java.lang.String getIdentifierConcatenator()
Description copied from interface:IdentifierConfiguration
Returns the value used to concatenate multiple names together. For example: "_" used in TABLE1_TABLE2- Specified by:
getIdentifierConcatenator
in interfaceIdentifierConfiguration
-
getTrailingDelimiter
public java.lang.String getTrailingDelimiter()
Description copied from interface:IdentifierConfiguration
Returns the trailing delimiter value to use when delimiting a name.- Specified by:
getTrailingDelimiter
in interfaceIdentifierConfiguration
-
setTrailingDelimiter
public void setTrailingDelimiter(java.lang.String delim)
-
getDefaultIdentifierRule
public IdentifierRule getDefaultIdentifierRule()
Description copied from interface:IdentifierConfiguration
Gets the default naming rule- Specified by:
getDefaultIdentifierRule
in interfaceIdentifierConfiguration
-
getIdentifierRule
public <T> IdentifierRule getIdentifierRule(T t)
Description copied from interface:IdentifierConfiguration
Returns a naming rule or null if the rule is not found.- Specified by:
getIdentifierRule
in interfaceIdentifierConfiguration
-
getIdentifierRules
public java.util.Map<java.lang.String,IdentifierRule> getIdentifierRules()
Description copied from interface:IdentifierConfiguration
Returns all naming rules- Specified by:
getIdentifierRules
in interfaceIdentifierConfiguration
-
getNamingUtil
public DBIdentifierUtil getNamingUtil()
Returns the naming utility used by this dictionary instance
-
getDelimitedCase
public java.lang.String getDelimitedCase()
Description copied from interface:IdentifierConfiguration
Returns the case that is used when delimiting.- Specified by:
getDelimitedCase
in interfaceIdentifierConfiguration
- Returns:
- upper, lower, or preserve
-
toDBName
public java.lang.String toDBName(DBIdentifier name)
-
toDBName
public java.lang.String toDBName(DBIdentifier name, boolean delimit)
-
fromDBName
public DBIdentifier fromDBName(java.lang.String name, DBIdentifier.DBIdentifierType id)
-
setDefaultSchemaName
public void setDefaultSchemaName(java.lang.String defaultSchemaName)
-
getDefaultSchemaName
public java.lang.String getDefaultSchemaName()
-
getConversionKey
public java.lang.String getConversionKey()
Description copied from interface:IdentifierConfiguration
Returns a key that can be used to determine whether conversion should take place. Id configurations should create a key unique to their configuration. The typical key is: leading delimiter (") + name separator(.) + trailing delimiter(")- Specified by:
getConversionKey
in interfaceIdentifierConfiguration
-
getMarkerForInsertUpdate
public java.lang.String getMarkerForInsertUpdate(Column col, java.lang.Object val)
Return parameter marker for INSERT and UPDATE statements. Usually it is?
but some database-specific types might require customization.- Parameters:
col
- column definitionval
- value to be inserted/updated- Returns:
- parameter marker
-
getIsNullSQL
public java.lang.String getIsNullSQL(java.lang.String colAlias, int colType)
-
getIsNotNullSQL
public java.lang.String getIsNotNullSQL(java.lang.String colAlias, int colType)
-
getIdentityColumnName
public java.lang.String getIdentityColumnName()
-
getMillisecondBehavior
public DBDictionary.DateMillisecondBehaviors getMillisecondBehavior()
Default behavior is ROUND
-
setDateMillisecondBehavior
public void setDateMillisecondBehavior(java.lang.String str)
-
getBooleanRepresentation
public BooleanRepresentation getBooleanRepresentation()
-
setBooleanRepresentation
public void setBooleanRepresentation(java.lang.String booleanRepresentationKey)
-
isUsingRange
protected boolean isUsingRange(long start, long end)
-
isUsingOffset
protected boolean isUsingOffset(long start)
-
isUsingLimit
protected boolean isUsingLimit(long end)
-
isUsingOrderBy
protected boolean isUsingOrderBy(SQLBuffer sql)
-
versionEqualOrLaterThan
protected boolean versionEqualOrLaterThan(int maj, int min)
-
versionEqualOrEarlierThan
protected boolean versionEqualOrEarlierThan(int maj, int min)
-
versionLaterThan
protected boolean versionLaterThan(int maj)
-
getMajorVersion
public final int getMajorVersion()
Gets major version of the database server.
-
setMajorVersion
public void setMajorVersion(int maj)
Sets major version of the database server.
-
getMinorVersion
public final int getMinorVersion()
Gets minor version of the database server.
-
setMinorVersion
public void setMinorVersion(int min)
Sets minor version of the database server.
-
applyRange
public int applyRange(Select select, int count)
-
-