SolarMetric Kodo JDO 3.0.3 generated on February 20 2004

kodo.jdbc.sql
Class SybaseDictionary

java.lang.Object
  |
  +--kodo.jdbc.sql.DBDictionary
        |
        +--kodo.jdbc.sql.AbstractSQLServerDictionary
              |
              +--kodo.jdbc.sql.SybaseDictionary
All Implemented Interfaces:
Configurable, ConnectionDecorator

public class SybaseDictionary
extends AbstractSQLServerDictionary

Dictionary for Sybase.

The main point of interest is that by default, every table that is created will have a unique column named "UNQ_INDEX" of the "IDENTITY" type. Kodo will not ever utilize this column. However, due to internal Sybase restrictions, this column is required in order to support pessimistic (datastore) locking, since Sybase requires that any tables in a "SELECT ... FOR UPDATE" clause have a unique index that is not included in the list of columns, as described in the Sybase documentation. This behavior can be surpressed by setting the dictionary property CreateIdentityColumn=false. The name of the unique column can be changed by setting the property IdentityColumnName=COLUMN_NAME.

A good Sybase type reference is can be found here.


Fields inherited from class kodo.jdbc.sql.DBDictionary
CENTI, DECI, MICRO, MILLI, NANO, SCHEMA_CASE_DEFAULT, SCHEMA_CASE_LOWER, SCHEMA_CASE_PRESERVE, SCHEMA_CASE_UPPER, SEC
 
Constructor Summary
SybaseDictionary()
           
 
Method Summary
 Connection decorate(Connection conn)
          Decorate all connections with one that handles some Sybase autocommit bugs.
 void endConfiguration()
          Invoked upon completion of bean property configuration for this object.
 ColumnInfo[] getColumns(DatabaseMetaData meta, String catalog, String schemaName, String tableName, String columnName, Connection conn)
          Sybase requires that autocommit be true for any schema interrogation.
 boolean getCreateIdentityColumn()
          If true, then whenever the schematool creates a table, it will append an additional IDENTITY column to the table's creation SQL.
 String[] getCreateTableSQL(Table table)
          Return a series of SQL statements to create the given table, complete with columns.
protected  String getDeclareColumnSQL(Column col, boolean alter)
          Return the declaration SQL for the given column.
 String[] getDropColumnSQL(Column column)
          Return a series of SQL statements to drop the given column from its table.
 String getIdentityColumnName()
          If getCreateIdentityColumn() is true, then the identityColumnName will be the name of the additional unique column that will be created.
 ForeignKeyInfo[] getImportedKeys(DatabaseMetaData meta, String catalog, String schemaName, String tableName, Connection conn)
          Sybase requires that autocommit be true for any schema interrogation.
 IndexInfo[] getIndexInfo(DatabaseMetaData meta, String catalog, String schemaName, String tableName, boolean unique, boolean approx, Connection conn)
          Sybase requires that autocommit be true for any schema interrogation.
 int getJDBCType(int metaTypeCode, boolean lob)
          Return the preferred Types constant for the given FieldMapping constant.
 PrimaryKeyInfo[] getPrimaryKeys(DatabaseMetaData meta, String catalog, String schemaName, String tableName, Connection conn)
          Sybase requires that autocommit be true for any schema interrogation.
 TableInfo[] getTables(DatabaseMetaData meta, String catalog, String schemaName, String tableName, Connection conn)
          Sybase requires that autocommit be true for any schema interrogation.
 void refSchemaComponents(Table table)
          Increment the reference count of any table components that this dictionary adds that are not used by mappings.
 void setBigInteger(PreparedStatement stmnt, int idx, BigInteger val)
          Set the given value as a parameter to the statement.
 void setCreateIdentityColumn(boolean createIdentityColumn)
          If true, then whenever the schematool creates a table, it will append an additional IDENTITY column to the table's creation SQL.
 void setDBMetaData(DBMetaData meta)
          Set the database metadata for this dictionary.
 void setIdentityColumnName(String identityColumnName)
          If getCreateIdentityColumn() is true, then the identityColumnName will be the name of the additional unique column that will be created.
 
Methods inherited from class kodo.jdbc.sql.AbstractSQLServerDictionary
configureReflectedColumn, getFullName, getReservedKeywords, setNull, supportsSizeInColumnDefinition
 
Methods inherited from class kodo.jdbc.sql.DBDictionary
addSystemSchema, addSystemTable, appendSize, canBatch, canLock, convertSchemaCase, getAddColumnSQL, getAddForeignKeySQL, getAddPrimaryKeySQL, getArray, getAsciiStream, getAutoIncrementClause, getAutoIncrementTypeName, getBatchLimit, getBatchParameterLimit, getBigDecimal, getBigInteger, getBigintTypeName, getBinaryStream, getBinaryTypeName, getBitTypeName, getBlob, getBlobObject, getBlobStream, getBlobTypeName, getBoolean, getByte, getBytes, getCatalogNameForMetadata, getCatalogSeparator, getChar, getCharacterStream, getCharTypeName, getClob, getClobString, getClobTypeName, getColumnNameForMetadata, getConfiguration, getConstraintNameBeforeDeclaration, getCreateIndexSQL, getCreatePrimaryKeys, getDate, getDate, getDatePrecision, getDateTypeName, getDBMetaData, getDecimalTypeName, getDistinctTypeName, getDouble, getDoubleTypeName, getDropForeignKeySQL, getDropIndexSQL, getDropPrimaryKeySQL, getDropTableSQL, getFloat, getFloatTypeName, getForeignKeyActionName, getForeignKeyConstraintSQL, getForUpdateClause, getFrom, getFullName, getGeneratedKey, getInitializationSQL, getInt, getIntegerTypeName, getJavaObjectTypeName, getJoinSyntax, getJoinSyntaxConstant, getLastGeneratedKeyQuery, getLastGeneratedKeyQuery, getLocale, getLong, getLongVarbinaryTypeName, getLongVarcharTypeName, getMaxCharacterFieldLength, getMaxColumnNameLength, getMaxForeignKeyNameLength, getMaxIndexesPerTable, getMaxIndexNameLength, getMaxKeyNameLength, getMaxPrimaryKeyNameLength, getMaxTableNameLength, getNullTypeName, getNumericTypeName, getObject, getOrderings, getOtherTypeName, getPlatform, getPreferredType, getPrimaryKeyConstraintSQL, getPrimaryKeysFromBestRowIdentifier, getPrimaryKeysFromGetPrimaryKeys, getRealTypeName, getRef, getRefTypeName, getReservedWords, getSchemaCase, getSchemaNameForMetadata, getSelects, getShort, getSimulateLocking, getSizeClause, getSmallintTypeName, getStorageLimitationsFatal, getStoreCharsAsNumbers, getStoreLargeNumbersAsStrings, getString, getStructTypeName, getSupportsDeferredConstraints, getSupportsForeignKeys, getSupportsLockingWithDistinctClause, getSupportsLockingWithInnerJoin, getSupportsLockingWithMultipleTables, getSupportsLockingWithOrderClause, getSupportsLockingWithOuterJoin, getSupportsMultipleNontransactionalResultSets, getSupportsNullTableForGetColumns, getSupportsNullTableForGetImportedKeys, getSupportsNullTableForGetIndexInfo, getSupportsNullTableForGetPrimaryKeys, getSupportsSchemaForGetColumns, getSupportsSchemaForGetTables, getSupportsSelectForUpdate, getSystemSchemas, getSystemTables, getTableForUpdateClause, getTableNameForMetadata, getTableTypes, getTime, getTimestamp, getTimestampTypeName, getTimeTypeName, getTinyintTypeName, getTypeName, getUseGetBestRowIdentifierForPrimaryKeys, getUseGetBytesForBlobs, getUseGetObjectForBlobs, getUseSchemaName, getUseSetBytesForBlobs, getUseStringsForClobs, getValidationSQL, getValidColumnName, getValidForeignKeyName, getValidIndexName, getValidPrimaryKeyName, getValidTableName, getVarbinaryTypeName, getVarcharTypeName, getWhere, isReserved, isSupported, isSystemIndex, isSystemTable, makeNameValid, maxKeyNameLength, newColumnInfo, newForeignKeyInfo, newIndexInfo, newPrimaryKeyInfo, newTableInfo, replaceMapping, replaceMapping, replaceMappingFactory, replaceSchemaFactory, replaceSize, serialize, setArray, setAsciiStream, setAutoIncrementClause, setAutoIncrementTypeName, setBatchLimit, setBatchParameterLimit, setBigDecimal, setBigintTypeName, setBinaryStream, setBinaryTypeName, setBitTypeName, setBlob, setBlobObject, setBlobTypeName, setBoolean, setByte, setBytes, setCatalogSeparator, setChar, setCharacterStream, setCharTypeName, setClob, setClobString, setClobTypeName, setConfiguration, setCreatePrimaryKeys, setDate, setDate, setDateTypeName, setDecimalTypeName, setDistinctTypeName, setDouble, setDoubleTypeName, setFloat, setFloatTypeName, setForUpdateClause, setInitializationSQL, setInt, setIntegerTypeName, setJavaObjectTypeName, setJoinSyntax, setJoinSyntaxConstant, setLastGeneratedKeyQuery, setLocale, setLong, setLongVarbinaryTypeName, setLongVarcharTypeName, setMaxIndexesPerTable, setMaxKeyNameLength, setNullTypeName, setNumericTypeName, setObject, setOtherTypeName, setPlatform, setRealTypeName, setRef, setRefTypeName, setReservedWords, setSchemaCase, setShort, setSimulateLocking, setSmallintTypeName, setStorageLimitationsFatal, setStoreCharsAsNumbers, setStoreLargeNumbersAsStrings, setString, setStructTypeName, setSupportsDeferredConstraints, setSupportsForeignKeys, setSupportsLockingWithDistinctClause, setSupportsLockingWithInnerJoin, setSupportsLockingWithMultipleTables, setSupportsLockingWithOrderClause, setSupportsLockingWithOuterJoin, setSupportsMultipleNontransactionalResultSets, setSupportsNullTableForGetColumns, setSupportsNullTableForGetImportedKeys, setSupportsNullTableForGetIndexInfo, setSupportsNullTableForGetPrimaryKeys, setSupportsSchemaForGetColumns, setSupportsSchemaForGetTables, setSupportsSelectForUpdate, setSystemSchemas, setSystemTables, setTableForUpdateClause, setTableTypes, setTime, setTimestamp, setTimestampTypeName, setTimeTypeName, setTinyintTypeName, setup, setUseGetBestRowIdentifierForPrimaryKeys, setUseGetBytesForBlobs, setUseGetObjectForBlobs, setUseSchemaName, setUseSetBytesForBlobs, setUseStringsForClobs, setValidationSQL, setVarbinaryTypeName, setVarcharTypeName, startConfiguration, storageWarning, supportsAutoIncrement, supportsForeignKey, supportsSelectForUpdate, supportsTotalCountsForBatch, supportsUpdateCountsForBatch, toNativeJoin, toSelect, toSelect, toSQL92Join, toTraditionalJoin, warnSupportedDictionary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SybaseDictionary

public SybaseDictionary()
Method Detail

setDBMetaData

public void setDBMetaData(DBMetaData meta)
                   throws SQLException
Description copied from class: DBDictionary
Set the database metadata for this dictionary. This method will be called by the system.
Overrides:
setDBMetaData in class DBDictionary

getJDBCType

public int getJDBCType(int metaTypeCode,
                       boolean lob)
Description copied from class: DBDictionary
Return the preferred Types constant for the given FieldMapping constant.
Overrides:
getJDBCType in class DBDictionary

setBigInteger

public void setBigInteger(PreparedStatement stmnt,
                          int idx,
                          BigInteger val)
                   throws SQLException
Description copied from class: DBDictionary
Set the given value as a parameter to the statement.
Overrides:
setBigInteger in class DBDictionary

setCreateIdentityColumn

public void setCreateIdentityColumn(boolean createIdentityColumn)
If true, then whenever the schematool creates a table, it will append an additional IDENTITY column to the table's creation SQL. This is so Sybase will be able to perform SELECT...FOR UPDATE statements.
Since:
2.5.0

getCreateIdentityColumn

public boolean getCreateIdentityColumn()
If true, then whenever the schematool creates a table, it will append an additional IDENTITY column to the table's creation SQL. This is so Sybase will be able to perform SELECT...FOR UPDATE statements.
Since:
2.5.0

setIdentityColumnName

public void setIdentityColumnName(String identityColumnName)
If getCreateIdentityColumn() is true, then the identityColumnName will be the name of the additional unique column that will be created.
Since:
2.5.0

getIdentityColumnName

public String getIdentityColumnName()
If getCreateIdentityColumn() is true, then the identityColumnName will be the name of the additional unique column that will be created.
Since:
2.5.0

endConfiguration

public void endConfiguration()
Description copied from interface: Configurable
Invoked upon completion of bean property configuration for this object.
Overrides:
endConfiguration in class DBDictionary

getCreateTableSQL

public String[] getCreateTableSQL(Table table)
Description copied from class: DBDictionary
Return a series of SQL statements to create the given table, complete with columns. Indexes and constraints will be created separately.
Overrides:
getCreateTableSQL in class DBDictionary

getDeclareColumnSQL

protected String getDeclareColumnSQL(Column col,
                                     boolean alter)
Description copied from class: DBDictionary
Return the declaration SQL for the given column. This method is used for each column from within DBDictionary.getCreateTableSQL(kodo.jdbc.schema.Table) and DBDictionary.getAddColumnSQL(kodo.jdbc.schema.Column).
Overrides:
getDeclareColumnSQL in class DBDictionary

getDropColumnSQL

public String[] getDropColumnSQL(Column column)
Description copied from class: DBDictionary
Return a series of SQL statements to drop the given column from its table. Return an empty array if operation not supported. The DBMetaData is checked for support automatically. Returns ALTER TABLE <table name> DROP COLUMN <col name> by default.
Overrides:
getDropColumnSQL in class DBDictionary

refSchemaComponents

public void refSchemaComponents(Table table)
Description copied from class: DBDictionary
Increment the reference count of any table components that this dictionary adds that are not used by mappings. Does nothing by default.
Overrides:
refSchemaComponents in class DBDictionary

getTables

public TableInfo[] getTables(DatabaseMetaData meta,
                             String catalog,
                             String schemaName,
                             String tableName,
                             Connection conn)
                      throws SQLException
Sybase requires that autocommit be true for any schema interrogation.
Overrides:
getTables in class DBDictionary

getColumns

public ColumnInfo[] getColumns(DatabaseMetaData meta,
                               String catalog,
                               String schemaName,
                               String tableName,
                               String columnName,
                               Connection conn)
                        throws SQLException
Sybase requires that autocommit be true for any schema interrogation.
Overrides:
getColumns in class DBDictionary

getPrimaryKeys

public PrimaryKeyInfo[] getPrimaryKeys(DatabaseMetaData meta,
                                       String catalog,
                                       String schemaName,
                                       String tableName,
                                       Connection conn)
                                throws SQLException
Sybase requires that autocommit be true for any schema interrogation.
Overrides:
getPrimaryKeys in class DBDictionary

getIndexInfo

public IndexInfo[] getIndexInfo(DatabaseMetaData meta,
                                String catalog,
                                String schemaName,
                                String tableName,
                                boolean unique,
                                boolean approx,
                                Connection conn)
                         throws SQLException
Sybase requires that autocommit be true for any schema interrogation.
Overrides:
getIndexInfo in class DBDictionary

getImportedKeys

public ForeignKeyInfo[] getImportedKeys(DatabaseMetaData meta,
                                        String catalog,
                                        String schemaName,
                                        String tableName,
                                        Connection conn)
                                 throws SQLException
Sybase requires that autocommit be true for any schema interrogation.
Overrides:
getImportedKeys in class DBDictionary

decorate

public Connection decorate(Connection conn)
                    throws SQLException
Decorate all connections with one that handles some Sybase autocommit bugs.
Overrides:
decorate in class DBDictionary

SolarMetric Kodo JDO 3.0.3 generated on February 20 2004

Copyright 2001,2002 SolarMetric, Inc. All Rights Reserved.