org.apache.openjpa.jdbc.sql
Class DBDictionary

java.lang.Object
  extended by org.apache.openjpa.jdbc.sql.DBDictionary
All Implemented Interfaces:
JoinSyntaxes, org.apache.openjpa.lib.conf.Configurable, org.apache.openjpa.lib.jdbc.ConnectionDecorator, org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.SQLWarningHandler
Direct Known Subclasses:
AbstractDB2Dictionary, AbstractSQLServerDictionary, AccessDictionary, CacheDictionary, EmpressDictionary, FoxProDictionary, HSQLDictionary, InformixDictionary, InterbaseDictionary, JDataStoreDictionary, MySQLDictionary, OracleDictionary, PointbaseDictionary, PostgresDictionary

public class DBDictionary
extends java.lang.Object
implements org.apache.openjpa.lib.conf.Configurable, org.apache.openjpa.lib.jdbc.ConnectionDecorator, JoinSyntaxes, org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.SQLWarningHandler

Class which allows the creation of SQL dynamically, in a database agnostic fashion. Subclass for the nuances of different data stores.


Nested Class Summary
static class DBDictionary.SerializedData
          Used by some mappings to represent data that has already been serialized so that we don't have to serialize multiple times.
 
Field Summary
 boolean allowsAliasInBulkClause
           
 java.lang.String arrayTypeName
           
 java.lang.String autoAssignClause
           
 java.lang.String autoAssignTypeName
           
 java.lang.String bigintTypeName
           
 java.lang.String binaryTypeName
           
 java.lang.String bitLengthFunction
           
 java.lang.String bitTypeName
           
 java.lang.String blobTypeName
           
 java.lang.String booleanTypeName
           
 java.lang.String castFunction
           
 java.lang.String catalogSeparator
           
protected static int CENTI
           
 int characterColumnSize
           
 java.lang.String charTypeName
           
 java.lang.String clobTypeName
           
 java.lang.String closePoolSQL
           
 java.lang.String concatenateDelimiter
           
 java.lang.String concatenateFunction
           
protected  JDBCConfiguration conf
           
protected  boolean connected
           
static java.lang.String CONS_NAME_AFTER
           
static java.lang.String CONS_NAME_BEFORE
           
static java.lang.String CONS_NAME_MID
           
 java.lang.String constraintNameMode
           
 boolean createPrimaryKeys
           
 java.lang.String crossJoinClause
           
 java.lang.String currentDateFunction
           
 java.lang.String currentTimeFunction
           
 java.lang.String currentTimestampFunction
           
 int datePrecision
           
 java.lang.String dateTypeName
           
protected static int DECI
           
 java.lang.String decimalTypeName
           
 java.lang.String distinctCountColumnSeparator
           
 java.lang.String distinctTypeName
           
 java.lang.String doubleTypeName
           
 java.lang.String driverVendor
           
 java.lang.String dropTableSQL
           
 java.lang.String fixedSizeTypeNames
           
protected  java.util.Set fixedSizeTypeNameSet
           
 java.lang.String floatTypeName
           
 java.lang.String forUpdateClause
           
 java.lang.String initializationSQL
           
 java.lang.String innerJoinClause
           
 java.lang.String integerTypeName
           
 java.lang.String javaObjectTypeName
           
 int joinSyntax
           
 java.lang.String lastGeneratedKeyQuery
           
protected  org.apache.openjpa.lib.log.Log log
           
 java.lang.String longVarbinaryTypeName
           
 java.lang.String longVarcharTypeName
           
 int maxAutoAssignNameLength
           
 int maxColumnNameLength
           
 int maxConstraintNameLength
           
 int maxEmbeddedBlobSize
           
 int maxEmbeddedClobSize
           
 int maxIndexesPerTable
           
 int maxIndexNameLength
           
 int maxTableNameLength
           
protected static int MICRO
           
protected static int MILLI
           
protected static int NAME_ANY
           
protected static int NAME_SEQUENCE
           
protected static int NAME_TABLE
           
protected static int NANO
           
 java.lang.String nextSequenceQuery
           
 java.lang.String nullTypeName
           
 java.lang.String numericTypeName
           
 java.lang.String otherTypeName
           
 java.lang.String outerJoinClause
           
 java.lang.String platform
           
protected static int RANGE_POST_DISTINCT
           
protected static int RANGE_POST_SELECT
           
protected static int RANGE_PRE_DISTINCT
           
 int rangePosition
           
 java.lang.String realTypeName
           
 java.lang.String refTypeName
           
 boolean requiresAliasForSubselect
           
 boolean requiresAutoCommitForMetaData
           
 boolean requiresCastForComparisons
           
 boolean requiresCastForMathFunctions
           
 boolean requiresConditionForCrossJoin
           
 java.lang.String reservedWords
           
protected  java.util.Set reservedWordSet
           
static java.lang.String SCHEMA_CASE_LOWER
           
static java.lang.String SCHEMA_CASE_PRESERVE
           
static java.lang.String SCHEMA_CASE_UPPER
           
 java.lang.String schemaCase
           
 java.lang.String searchStringEscape
           
protected static int SEC
           
 boolean simulateLocking
           
 java.lang.String smallintTypeName
           
 boolean storageLimitationsFatal
           
 boolean storeCharsAsNumbers
           
 boolean storeLargeNumbersAsStrings
           
 java.lang.String stringLengthFunction
           
 java.lang.String structTypeName
           
 java.lang.String substringFunctionName
           
 boolean supportsAlterTableWithAddColumn
           
 boolean supportsAlterTableWithDropColumn
           
 boolean supportsAutoAssign
           
 boolean supportsCascadeDeleteAction
           
 boolean supportsCascadeUpdateAction
           
 boolean supportsCorrelatedSubselect
           
 boolean supportsDefaultDeleteAction
           
 boolean supportsDefaultUpdateAction
           
 boolean supportsDeferredConstraints
           
 boolean supportsForeignKeys
           
 boolean supportsHaving
           
 boolean supportsLockingWithDistinctClause
           
 boolean supportsLockingWithInnerJoin
           
 boolean supportsLockingWithMultipleTables
           
 boolean supportsLockingWithOrderClause
           
 boolean supportsLockingWithOuterJoin
           
 boolean supportsLockingWithSelectRange
           
 boolean supportsModOperator
           
 boolean supportsMultipleNontransactionalResultSets
           
 boolean supportsNullDeleteAction
           
 boolean supportsNullTableForGetColumns
           
 boolean supportsNullTableForGetImportedKeys
           
 boolean supportsNullTableForGetIndexInfo
           
 boolean supportsNullTableForGetPrimaryKeys
           
 boolean supportsNullUpdateAction
           
 boolean supportsQueryTimeout
           
 boolean supportsRestrictDeleteAction
           
 boolean supportsRestrictUpdateAction
           
 boolean supportsSchemaForGetColumns
           
 boolean supportsSchemaForGetTables
           
 boolean supportsSelectEndIndex
           
 boolean supportsSelectForUpdate
           
 boolean supportsSelectStartIndex
           
 boolean supportsSubselect
           
 boolean supportsUniqueConstraints
           
 java.lang.String systemSchemas
           
protected  java.util.Set systemSchemaSet
           
 java.lang.String systemTables
           
protected  java.util.Set systemTableSet
           
 java.lang.String tableForUpdateClause
           
 java.lang.String tableTypes
           
 java.lang.String timestampTypeName
           
 java.lang.String timeTypeName
           
 java.lang.String tinyintTypeName
           
 java.lang.String toLowerCaseFunction
           
 java.lang.String toUpperCaseFunction
           
 java.lang.String trimBothFunction
           
 java.lang.String trimLeadingFunction
           
 java.lang.String trimTrailingFunction
           
 boolean useGetBestRowIdentifierForPrimaryKeys
           
 boolean useGetBytesForBlobs
           
 boolean useGetObjectForBlobs
           
 boolean useGetStringForClobs
           
 boolean useSchemaName
           
 boolean useSetBytesForBlobs
           
 boolean useSetStringForClobs
           
 java.lang.String validationSQL
           
 java.lang.String varbinaryTypeName
           
 java.lang.String varcharTypeName
           
static java.lang.String VENDOR_DATADIRECT
           
static java.lang.String VENDOR_OTHER
           
 
Fields inherited from interface org.apache.openjpa.jdbc.sql.JoinSyntaxes
SYNTAX_DATABASE, SYNTAX_SQL92, SYNTAX_TRADITIONAL
 
Constructor Summary
DBDictionary()
           
 
Method Summary
 void appendCast(SQLBuffer buf, FilterValue val, int type)
          Cast the specified value to the specified type.
protected  void appendNumericCast(SQLBuffer buf, FilterValue val)
          Append SQL for the given numeric value to the buffer, casting as needed.
protected  void appendSelectRange(SQLBuffer buf, long start, long end)
          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 assertSupport(boolean feature, java.lang.String property)
          Assert that the given dictionary flag is true.
 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 specified DataSource and releases any resources associated with it.
 void comparison(SQLBuffer buf, java.lang.String op, FilterValue lhs, FilterValue rhs)
          Append a comparison.
 void connectedConfiguration(java.sql.Connection conn)
          This method is called when the dictionary first sees any connection.
protected  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.sql.Connection decorate(java.sql.Connection conn)
          Decorate the given connection if needed.
 void endConfiguration()
           
 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.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.
 java.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.
 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.
protected  java.lang.String getCatalogNameForMetadata(java.lang.String catalogName)
          Returns the catalog name that will be used for obtaining information from DatabaseMetaData.
 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.
protected  java.lang.String getColumnNameForMetadata(java.lang.String columnName)
          Returns the column name that will be used for obtaining information from DatabaseMetaData.
 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)
          Reflect on the schema to find columns matching the given table and column patterns.
 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.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  java.lang.String getDeclareColumnSQL(Column col, boolean alter)
          Return the declaration SQL for the given column.
 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)
          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  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.
 java.lang.String getFullName(Index index)
          Returns the full name of the index, including the schema (delimited by the result of catalogSeparator).
 java.lang.String getFullName(Sequence seq)
          Returns the full name of the sequence, including the schema (delimited by the result of catalogSeparator).
 java.lang.String getFullName(Table table, boolean logical)
          Returns the full name of the table, including the schema (delimited by catalogSeparator).
 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.
 ForeignKey[] getImportedKeys(java.sql.DatabaseMetaData meta, java.lang.String catalog, java.lang.String schemaName, java.lang.String tableName, java.sql.Connection conn)
          Reflect on the schema to return 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)
          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.
 int getJDBCType(int metaTypeCode, boolean lob)
          Return the preferred Types constant for the given JavaTypes or JavaSQLTypes constant.
 java.util.Locale getLocale(java.sql.ResultSet rs, int column)
          Convert the specified column of the SQL ResultSet to the proper java type.
 long getLong(java.sql.ResultSet rs, int column)
          Convert the specified column of the SQL ResultSet to the proper java type.
 java.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.lang.String getPlaceholderValueString(Column col)
          Return a SQL string to act as a placeholder for the given column.
 int getPreferredType(int type)
          Return the preferred Types type for the given one.
protected  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)
          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)
          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)
          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.
protected  java.lang.String getSchemaNameForMetadata(java.lang.String schemaName)
          Returns the schema name that will be used for obtaining information from DatabaseMetaData.
 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.
 Sequence[] getSequences(java.sql.DatabaseMetaData meta, java.lang.String catalog, java.lang.String schemaName, java.lang.String sequenceName, java.sql.Connection conn)
          Reflect on the schema to find sequences matching the given name pattern.
protected  java.lang.String getSequencesSQL(java.lang.String schemaName, java.lang.String sequenceName)
          Return the SQL needed to select the list of sequences.
 short getShort(java.sql.ResultSet rs, int column)
          Convert the specified column of the SQL ResultSet to the proper java type.
 java.lang.String getString(java.sql.ResultSet rs, int column)
          Convert the specified column of the SQL ResultSet to the proper java type.
protected  java.lang.String getTableNameForMetadata(java.lang.String tableName)
          Returns the table name that will be used for obtaining information from DatabaseMetaData.
 Table[] getTables(java.sql.DatabaseMetaData meta, java.lang.String catalog, java.lang.String schemaName, java.lang.String tableName, 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 getTypeName(Column col)
          Return the preferred database type name for the given column's type from Types.
 java.lang.String getTypeName(int type)
          Returns the type name for the specific constant as defined by Types.
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)
          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)
          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)
          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)
          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)
          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)
          Make any necessary changes to the given unique constraint name to make it valid for the current DB.
protected  SQLBuffer getWhere(Select sel, boolean forUpdate)
          Return the WHERE portion of the select statement, or null if no where conditions.
 void handleWarning(java.sql.SQLWarning warning)
          Implementation of the LoggingConnectionDecorator.SQLWarningHandler interface that allows customization of the actions to perform when a SQLWarning occurs at any point on a Connection, Statement, or ResultSet.
 void indexOf(SQLBuffer buf, FilterValue str, FilterValue find, FilterValue start)
          Invoke this database's indexOf function.
 boolean isSystemIndex(java.lang.String 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)
          This method is used to filter system sequences from database metadata.
 boolean isSystemTable(java.lang.String name, java.lang.String schema, boolean targetSchema)
          This method is used to filter system tables from database metadata.
protected  java.lang.String makeNameValid(java.lang.String 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.
 void mathFunction(SQLBuffer buf, java.lang.String op, FilterValue lhs, FilterValue rhs)
          Append the numeric parts of a mathematical function.
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.
 org.apache.openjpa.util.OpenJPAException newStoreException(java.lang.String msg, java.sql.SQLException[] causes, java.lang.Object failed)
          Return a new exception that wraps causes.
protected  Table newTable(java.sql.ResultSet tableMeta)
          Create a new table from the information in the schema metadata.
 void putBytes(java.lang.Object blob, byte[] data)
          Invoke the JDK 1.4 setBytes method on the given BLOB object.
 void putChars(java.lang.Object clob, char[] data)
          Invoke the JDK 1.4 setCharacterStream method on the given CLOB object.
 void putString(java.lang.Object clob, java.lang.String data)
          Invoke the JDK 1.4 setString method on the given CLOB object.
 void refSchemaComponents(Table table)
          Increment the reference count of any table components that this dictionary adds that are not used by mappings.
 byte[] serialize(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 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 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(org.apache.openjpa.lib.conf.Configuration conf)
           
 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 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 setLocale(java.sql.PreparedStatement stmnt, int idx, java.util.Locale val, Column col)
          Set the given 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 setNull(java.sql.PreparedStatement stmnt, int idx, int colType, Column col)
          Set the given value as a parameters 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 parameters to the statement.
 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.
 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 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 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 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 stmnt, int idx, java.lang.Object val, Column col)
          Set a completely unknown parameter into a prepared statement.
protected static java.lang.String shorten(java.lang.String name, int targetLength)
          Shorten the specified name to the specified target name.
 void startConfiguration()
           
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 end)
          Invoke this database's substring function.
 boolean supportsDeleteAction(int action)
          Whether this database supports the given foreign key delete action.
 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.
 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.
 SQLBuffer toDelete(ClassMapping mapping, Select sel, JDBCStore store, 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.
protected  SQLBuffer toOperation(java.lang.String op, SQLBuffer selects, SQLBuffer from, SQLBuffer where, SQLBuffer group, SQLBuffer having, SQLBuffer order, boolean distinct, boolean forUpdate, long start, long end)
          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 toSelectCount(Select sel)
          Create a SELECT COUNT statement in the proper join syntax for the given instance.
 SQLBuffer toSQL92Join(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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

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

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

platform

public java.lang.String platform

driverVendor

public java.lang.String driverVendor

catalogSeparator

public java.lang.String catalogSeparator

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

supportsUniqueConstraints

public boolean supportsUniqueConstraints

supportsDeferredConstraints

public boolean supportsDeferredConstraints

supportsRestrictDeleteAction

public boolean supportsRestrictDeleteAction

supportsCascadeDeleteAction

public boolean supportsCascadeDeleteAction

supportsNullDeleteAction

public boolean supportsNullDeleteAction

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

reservedWords

public java.lang.String reservedWords

systemSchemas

public java.lang.String systemSchemas

systemTables

public java.lang.String systemTables

fixedSizeTypeNames

public java.lang.String fixedSizeTypeNames

schemaCase

public java.lang.String schemaCase

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

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

allowsAliasInBulkClause

public boolean allowsAliasInBulkClause

supportsMultipleNontransactionalResultSets

public boolean supportsMultipleNontransactionalResultSets

searchStringEscape

public java.lang.String searchStringEscape

requiresCastForMathFunctions

public boolean requiresCastForMathFunctions

requiresCastForComparisons

public boolean requiresCastForComparisons

supportsModOperator

public boolean supportsModOperator

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

useGetBytesForBlobs

public boolean useGetBytesForBlobs

useSetBytesForBlobs

public boolean useSetBytesForBlobs

useGetObjectForBlobs

public boolean useGetObjectForBlobs

useGetStringForClobs

public boolean useGetStringForClobs

useSetStringForClobs

public boolean useSetStringForClobs

maxEmbeddedBlobSize

public int maxEmbeddedBlobSize

maxEmbeddedClobSize

public int maxEmbeddedClobSize

datePrecision

public int datePrecision

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

tinyintTypeName

public java.lang.String tinyintTypeName

varbinaryTypeName

public java.lang.String varbinaryTypeName

varcharTypeName

public java.lang.String varcharTypeName

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

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

conf

protected JDBCConfiguration conf

log

protected org.apache.openjpa.lib.log.Log log

connected

protected boolean connected

reservedWordSet

protected final java.util.Set reservedWordSet

systemSchemaSet

protected final java.util.Set systemSchemaSet

systemTableSet

protected final java.util.Set systemTableSet

fixedSizeTypeNameSet

protected final java.util.Set fixedSizeTypeNameSet
Constructor Detail

DBDictionary

public DBDictionary()
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 call super.connectedConfiguration.

Throws:
java.sql.SQLException

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

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 a Timestamp by default.

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 a Timestamp 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 the serialize(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

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 the given value as a parameters to the statement. The column type will come from Types.

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 parameters to the statement. The column type will come from Types.

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 parameterize
idx - the index of the parameter in the prepared statement
val - the value of the column
col - the column being set
type - the field mapping type code for the value
store - the store manager for the current context
Throws:
java.sql.SQLException

setUnknown

public void setUnknown(java.sql.PreparedStatement stmnt,
                       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

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.lang.Object blob,
                     byte[] data)
              throws java.sql.SQLException
Invoke the JDK 1.4 setBytes method on the given BLOB object.

Throws:
java.sql.SQLException

putString

public void putString(java.lang.Object clob,
                      java.lang.String data)
               throws java.sql.SQLException
Invoke the JDK 1.4 setString method on the given CLOB object.

Throws:
java.sql.SQLException

putChars

public void putChars(java.lang.Object clob,
                     char[] data)
              throws java.sql.SQLException
Invoke the JDK 1.4 setCharacterStream 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)
Return the preferred Types constant for the given JavaTypes or JavaSQLTypes constant.


getPreferredType

public int getPreferredType(int type)
Return the preferred Types 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 from Types.


getTypeName

public java.lang.String getTypeName(int type)
Returns the type name for the specific constant as defined by Types.

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 the fixedSizeTypeNameSet).


setJoinSyntax

public void setJoinSyntax(java.lang.String syntax)
Set the name of the join syntax to use: sql92, traditional, database


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,
                          JDBCStore store,
                          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

public 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 mappng against which we are operating
sel - the Select that will constitute the WHERE clause
store - the current store
updateParams - 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

appendUpdates

protected void appendUpdates(Select sel,
                             JDBCStore store,
                             SQLBuffer sql,
                             java.lang.Object[] params,
                             java.util.Map updateParams,
                             boolean allowAlias)

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(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.


getSelectOperation

public java.lang.String getSelectOperation(JDBCFetchConfiguration fetch)
Return the "SELECT" operation clause, adding any available hints, etc.


toOperation

protected SQLBuffer toOperation(java.lang.String op,
                                SQLBuffer selects,
                                SQLBuffer from,
                                SQLBuffer where,
                                SQLBuffer group,
                                SQLBuffer having,
                                SQLBuffer order,
                                boolean distinct,
                                boolean forUpdate,
                                long start,
                                long end)
Return the SQL for the given selecting operation.


appendSelectRange

protected void appendSelectRange(SQLBuffer buf,
                                 long start,
                                 long end)
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.


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 end)
Invoke this database's substring function.

Parameters:
buf - the SQL buffer to write the substring invocation to
str - a query value representing the target string
start - a query value representing the start index
end - a query value representing the end index, 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 to
str - a query value representing the target string
find - a query value representing the search string
start - 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 function
op - the mathematical operation to perform
lhs - the left hand side of the math function
rhs - 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 comparison
op - the comparison operation to perform
lhs - the left hand side of the comparison
rhs - the right hand side of the comparison

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,
                       FilterValue val,
                       int type)
Cast the specified value to the specified type.

Parameters:
buf - the buffer to append the cast to
val - the value to cast
type - the type of the case, e.g. Types.NUMERIC

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.


getFullName

public java.lang.String getFullName(Table table,
                                    boolean logical)
Returns the full name of the table, including the schema (delimited by catalogSeparator).


getFullName

public java.lang.String getFullName(Index index)
Returns the full name of the index, including the schema (delimited by the result of catalogSeparator).


getFullName

public java.lang.String getFullName(Sequence seq)
Returns the full name of the sequence, including the schema (delimited by the result of catalogSeparator).


getValidTableName

public java.lang.String getValidTableName(java.lang.String name,
                                          Schema schema)
Make any necessary changes to the given table name to make it valid for the current DB.


getValidSequenceName

public java.lang.String getValidSequenceName(java.lang.String name,
                                             Schema schema)
Make any necessary changes to the given sequence name to make it valid for the current DB.


getValidColumnName

public java.lang.String getValidColumnName(java.lang.String name,
                                           Table table)
Make any necessary changes to the given column name to make it valid for the current DB.


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

public java.lang.String getValidForeignKeyName(java.lang.String name,
                                               Table table,
                                               Table toTable)
Make any necessary changes to the given foreign key name to make it valid for the current DB.


getValidIndexName

public java.lang.String getValidIndexName(java.lang.String name,
                                          Table table)
Make any necessary changes to the given index name to make it valid for the current DB.


getValidUniqueName

public java.lang.String getValidUniqueName(java.lang.String name,
                                           Table table)
Make any necessary changes to the given unique constraint name to make it valid for the current DB.


shorten

protected 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

protected java.lang.String makeNameValid(java.lang.String 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.


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.


getDropTableSQL

public java.lang.String[] getDropTableSQL(Table table)
Return a series of SQL statements to drop the given table. Indexes will be dropped separately. Returns DROP TABLE <table name> by default.


getCreateSequenceSQL

public java.lang.String[] getCreateSequenceSQL(Sequence seq)
Return a series of SQL statements to create the given sequence. Returns CREATE SEQUENCE <sequence name>[ START WITH <start>] [ INCREMENT BY <increment>] by default.


getDropSequenceSQL

public java.lang.String[] getDropSequenceSQL(Sequence seq)
Return a series of SQL statements to drop the given sequence. Returns DROP SEQUENCE <sequence name> by default.


getCreateIndexSQL

public java.lang.String[] getCreateIndexSQL(Index index)
Return a series of SQL statements to create the given index. Returns CREATE [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. Returns DROP 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. Returns ALTER 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. Returns ALTER 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. Returns ALTER 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. Returns ALTER 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. Returns ALTER TABLE <table name> ADD <fk cons sql > by default.


getDropForeignKeySQL

public java.lang.String[] getDropForeignKeySQL(ForeignKey fk)
Return a series of SQL statements to drop the given foreign key from its table. Return an empty array if operation not supported. Returns ALTER 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 within getCreateTableSQL(org.apache.openjpa.jdbc.schema.Table) and getAddColumnSQL(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 within getCreateTableSQL(org.apache.openjpa.jdbc.schema.Table) and getAddPrimaryKeySQL(org.apache.openjpa.jdbc.schema.PrimaryKey). Returns CONSTRAINT <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 within getCreateTableSQL(org.apache.openjpa.jdbc.schema.Table) and getAddForeignKeySQL(org.apache.openjpa.jdbc.schema.ForeignKey). Returns CONSTRAINT <cons name> FOREIGN KEY (<col list>) REFERENCES <foreign table> (<col list>) [ON DELETE <action>] [ON UPDATE <action>] by default.


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 within getCreateTableSQL(org.apache.openjpa.jdbc.schema.Table). Returns CONSTRAINT <name> UNIQUE (<col list>) by default.


isSystemTable

public boolean isSystemTable(java.lang.String name,
                             java.lang.String 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 name
schema - the table schema; may be null
targetSchema - if true, then the given schema was listed by the user as one of his schemas

isSystemIndex

public boolean isSystemIndex(java.lang.String 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 name
table - the index table

isSystemSequence

public boolean isSystemSequence(java.lang.String name,
                                java.lang.String 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 name
schema - the table schema; may be null
targetSchema - if true, then the given schema was listed by the user as one of his schemas

getTables

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

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

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

protected java.lang.String getSequencesSQL(java.lang.String schemaName,
                                           java.lang.String sequenceName)
Return the SQL needed to select the list of sequences.


getColumns

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

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
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,
                                                        java.lang.String catalog,
                                                        java.lang.String schemaName,
                                                        java.lang.String 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

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
Reflect on the schema to find primary keys for the given table pattern.

Throws:
java.sql.SQLException

getIndexInfo

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

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
Reflect on the schema to return foreign keys imported by the given table pattern.

Throws:
java.sql.SQLException

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 from DatabaseMetaData.


getSchemaNameForMetadata

protected java.lang.String getSchemaNameForMetadata(java.lang.String schemaName)
Returns the schema name that will be used for obtaining information from DatabaseMetaData.


getCatalogNameForMetadata

protected java.lang.String getCatalogNameForMetadata(java.lang.String catalogName)
Returns the catalog name that will be used for obtaining information from DatabaseMetaData.


getColumnNameForMetadata

protected java.lang.String getColumnNameForMetadata(java.lang.String columnName)
Returns the column name that will be used for obtaining information from DatabaseMetaData.


convertSchemaCase

protected java.lang.String convertSchemaCase(java.lang.String objectName)
Convert the specified schema name to a name that the database will be able to understand.


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 if lastGeneratedKeyQuery is null.

Throws:
java.sql.SQLException

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.


setConfiguration

public void setConfiguration(org.apache.openjpa.lib.conf.Configuration conf)
Specified by:
setConfiguration in interface org.apache.openjpa.lib.conf.Configurable

startConfiguration

public void startConfiguration()
Specified by:
startConfiguration in interface org.apache.openjpa.lib.conf.Configurable

endConfiguration

public void endConfiguration()
Specified by:
endConfiguration in interface org.apache.openjpa.lib.conf.Configurable

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 any initializationSQL that has been set for the dictionary but does not decoreate the connection.

Specified by:
decorate in interface org.apache.openjpa.lib.jdbc.ConnectionDecorator
Throws:
java.sql.SQLException

handleWarning

public void handleWarning(java.sql.SQLWarning warning)
                   throws java.sql.SQLException
Implementation of the LoggingConnectionDecorator.SQLWarningHandler interface that allows customization of the actions to perform when a SQLWarning occurs at any point on a Connection, Statement, or ResultSet. 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 interface org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.SQLWarningHandler
Throws:
java.sql.SQLException
See Also:
LoggingConnectionDecorator.setWarningAction(java.lang.String), LoggingConnectionDecorator.setWarningHandler(org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.SQLWarningHandler)

newStoreException

public org.apache.openjpa.util.OpenJPAException newStoreException(java.lang.String msg,
                                                                  java.sql.SQLException[] causes,
                                                                  java.lang.Object failed)
Return a new exception that wraps causes. However, the details of exactly what type of exception is returned can be determined by the implementation. This may take into account DB-specific exception information in causes.


closeDataSource

public void closeDataSource(javax.sql.DataSource dataSource)
Closes the specified DataSource and releases any resources associated with it.

Parameters:
dataSource - the DataSource to close


Copyright © 2006 Apache Software Foundation. All Rights Reserved.