Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.5.8 generated on January 11 2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.solarmetric.kodo.impl.jdbc.schema.dict
Class SybaseDictionary

    java.lang.Object
      |
      +--com.solarmetric.kodo.impl.jdbc.schema.dict.AbstractDictionary
            |
            +--com.solarmetric.kodo.impl.jdbc.schema.dict.SybaseDictionary

All Implemented Interfaces:
  DBDictionary

public class SybaseDictionary
extends AbstractDictionary

Implementation of `DBDictionary` 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`.

Fields inherited from class com.solarmetric.kodo.impl.jdbc.schema.dict.AbstractDictionary
`CENTI, DECI, meta, MICRO, MILLI, NANO, NUMBER_FORMAT, SEC`

Constructor Summary
`SybaseDictionary()`

Method Summary
`SQLBuffer` | `addForUpdateClause(SQLBuffer buffer, String[] cols, String[] tables, SQLBuffer where, SQLBuffer order, boolean distinct, boolean update)` Sybase requires that a "FOR UPDATE" clause include each of the column names as well as appending a "AT ISOLATION SERIALIZABLE" clause.
`protected SQLBuffer` | `getColumnDeclaration(Column column)` This method can be overridden if the database does not support standard column declarations, which are in the form: `<column-name> <sql-type> [NOT NULL]`.
`ResultSet` | `getColumns(String tableName, Connection conn)` Return a ResultSet with all the column names in the given table.
`boolean` | `getCreateIdentityColumn()` If true, then whenever the `schematool` creates a table, it will append an additional IDENTITY column to the table's creation SQL.
`SQLBuffer[]` | `getCreateTableSQL(Table table)` If `getIdentityColumnName()` is true, then we will add in a unique identity column.
`SQLBuffer[]` | `getDropColumnSQL(Column column)` Return a series of SQL statements to drop the given column from its table, including the deletion of any indices from the column.
`protected SQLBuffer` | `getDropIndexSQL(Index index)` Return the SQL to drop an index.
`String` | `getIdentityColumnName()` If `getCreateIdentityColumn()` is true, then the `identityColumnName` will be the name of the additional unique column that will be created.
`String` | `getPlatform()` Return the title of this database platform, used for display only.
`ResultSet` | `getTables(Connection conn)` Return a ResultSet with all the tables in the database.
`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` | `setIdentityColumnName(String identityColumnName)` If `getCreateIdentityColumn()` is true, then the `identityColumnName` will be the name of the additional unique column that will be created.
`void` | `setNullParameter(PreparedStatement st, int index, int type)` Since Sybase does not support `Types.BLOB` or `Types.CLOB`, we override the `setNull` method to `Types.VARCHAR` and `Types.VARBINARY`, respectively.
`protected void` | `setupSQLTypeMap(SQLTypeMap map)` This is the most commonly overridden method when porting to a new database.
`void` | `validateConfiguration(JDBCConfiguration conf, DBMetaData meta)` Raise a warning if the ConnectionURL does not have the special "SelectMethod=cursor" parameter.

Methods inherited from class com.solarmetric.kodo.impl.jdbc.schema.dict.AbstractDictionary
`, bigDecimalFromSQL, bigDecimalToPreparedParameter, bigDecimalToSQL, bigIntegerFromSQL, bigIntegerToPreparedParameter, bigIntegerToSQL, blobFromSQL, blobToPreparedParameter, blobToSQL, booleanFromSQL, booleanToPreparedParameter, booleanToSQL, byteFromSQL, byteToPreparedParameter, byteToSQL, characterToPreparedParameter, charFromSQL, charToSQL, clobFromSQL, clobToPreparedParameter, clobToSQL, colsToString, createdSQLExecutionManager, dateFromSQL, dateToPreparedParameter, dateToSQL, dateToTimestamp, deserialize, deserialize, doubleFromSQL, doubleToPreparedParameter, doubleToSQL, dropTableDropsIndices, floatFromSQL, floatToPreparedParameter, floatToSQL, fromSQL, getAddColumnSQL, getClassMappingCandidateClasses, getCreateIndexSQL, getCreateTableSuffix, getDatePrecision, getDBMetaData, getDropTableSQL, getFieldMappingCandidateClasses, getMaxColumnNameLength, getMaxIndexNameLength, getMaxTableNameLength, getNameTruncationVersion, getNextAutoIncrementValue, getNonSQL92LeftOuterJoin, getPrimaryKeyClause, getQuoteNumbers, getSchemaName, getSimulateLocking, getSQLTypeMap, getStoreCharsAsStrings, getStoreLargeNumbersAsStrings, getSupportedResultSetType, getValidateConnections, getValidateConnectionSQL, getValidColumnName, getValidIndexName, getValidTableName, initTypeMap, intFromSQL, intToPreparedParameter, intToSQL, isClosed, localeFromSQL, localeToPreparedParameter, localeToSQL, longFromSQL, longToPreparedParameter, longToSQL, objectFromSQL, objectToPreparedParameter, objectToSQL, prepareLargeNumberAsString, prepareStatement, serialize, setColumnNameGenerator, setCreateTableSuffix, setDBMetaData, setIndexNameGenerator, setMaxColumnNameLength, setMaxIndexNameLength, setMaxTableNameLength, setNameTruncationVersion, setQuoteNumbers, setSchemaName, setSimulateLocking, setStoreCharsAsStrings, setStoreLargeNumbersAsStrings, setTableNameGenerator, setTransactionIsolation, setValidateConnections, setValidateConnectionSQL, shortFromSQL, shortToPreparedParameter, shortToSQL, stringFromSQL, stringToPreparedParameter, stringToSQL, supportsAutoIncrement, supportsLocking, supportsNonSQL92LeftOuterJoins, supportsUpdateCountsForBatch, tablesToString, timestampFromSQL, toPreparedParameter, toSelect, toSelect, toSelect, toSQL, truncate, truncate`

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

### getPlatform

    public String getPlatform()

  Description copied from class: `AbstractDictionary`
  Return the title of this database platform, used for display only.
  Overrides:
    `getPlatform` in class `AbstractDictionary`

### setupSQLTypeMap

    protected void setupSQLTypeMap(SQLTypeMap map)

  Description copied from class: `AbstractDictionary`
  This is the most commonly overridden method when porting to a new database. Most databases have different mappings between java and SQL types; this method can be used to setup the mappings for the database being ported.
  Overrides:
    `setupSQLTypeMap` in class `AbstractDictionary`

### getCreateTableSQL

    public SQLBuffer[] getCreateTableSQL(Table table)

  If `getIdentityColumnName()` is true, then we will add in a unique identity column.
  Overrides:
    `getCreateTableSQL` in class `AbstractDictionary`

### getColumnDeclaration

    protected SQLBuffer getColumnDeclaration(Column column)

  Description copied from class: `AbstractDictionary`
  This method can be overridden if the database does not support standard column declarations, which are in the form: `<column-name> <sql-type> [NOT NULL]`. Where NOT NULL is appended if it is a primary key column.
  Overrides:
    `getColumnDeclaration` in class `AbstractDictionary`

### getDropIndexSQL

    protected SQLBuffer getDropIndexSQL(Index index)

  Description copied from class: `AbstractDictionary`
  Return the SQL to drop an index. Defaults to: `DROP INDEX <index-name>`
  Overrides:
    `getDropIndexSQL` in class `AbstractDictionary`

### getDropColumnSQL

    public SQLBuffer[] getDropColumnSQL(Column column)

  Description copied from interface: `DBDictionary`
  Return a series of SQL statements to drop the given column from its table, including the deletion of any indices from the column.
  Overrides:
    `getDropColumnSQL` in class `AbstractDictionary`

### addForUpdateClause

    public SQLBuffer addForUpdateClause(SQLBuffer buffer,
                                        String[] cols,
                                        String[] tables,
                                        SQLBuffer where,
                                        SQLBuffer order,
                                        boolean distinct,
                                        boolean update)

  Sybase requires that a "FOR UPDATE" clause include each of the column names as well as appending a "AT ISOLATION SERIALIZABLE" clause.
  Overrides:
    `addForUpdateClause` in class `AbstractDictionary`

### setNullParameter

    public void setNullParameter(PreparedStatement st,
                                 int index,
                                 int type)
                          throws SQLException

  Since Sybase does not support `Types.BLOB` or `Types.CLOB`, we override the `setNull` method to `Types.VARCHAR` and `Types.VARBINARY`, respectively.
  Overrides:
    `setNullParameter` in class `AbstractDictionary`
  Since:
    2.4.1

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

### validateConfiguration

    public void validateConfiguration(JDBCConfiguration conf,
                                      DBMetaData meta)

  Raise a warning if the ConnectionURL does not have the special "SelectMethod=cursor" parameter.
  Overrides:
    `validateConfiguration` in class `AbstractDictionary`

### getTables

    public ResultSet getTables(Connection conn)
                        throws SQLException

  Description copied from interface: `DBDictionary`
  Return a ResultSet with all the tables in the database. Used when determining what tables need to be updated during schema manipulation.
  Overrides:
    `getTables` in class `AbstractDictionary`

### getColumns

    public ResultSet getColumns(String tableName,
                                Connection conn)
                         throws SQLException

  Description copied from interface: `DBDictionary`
  Return a ResultSet with all the column names in the given table. Used when determining what tables need to be updated during schema manipulation. This is typically just a result of a `DatabaseMetaData.getColumns(String,String,String,String)` invocation, but the actual dictionary can choose to implement this however they like, provided that the `ResultSet` that is returned contains the following columns:

  - TABLE_NAME
  - COLUMN_NAME
  Overrides:
    `getColumns` in class `AbstractDictionary`

Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.5.8 generated on January 11 2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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