Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.4.3 generated on March 27 2003
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.solarmetric.kodo.impl.jdbc.schema
Interface DBDictionary

All Known Implementing Classes:
  AbstractDictionary

public interface DBDictionary

Interface which allows the creation of SQL dynamically, in a database agnostic fashion.

Method Summary
`boolean` | `booleanFromSQL(ResultSet rs, int column)` Convert the specified column of the SQL ResultSet to the proper java type.
`Object` | `booleanToSQL(boolean val)` Convert data into SQL for the current database platform.
`byte` | `byteFromSQL(ResultSet rs, int column)` Convert the specified column of the SQL ResultSet to the proper java type.
`Object` | `byteToSQL(byte val)` Convert data into SQL for the current database platform.
`char` | `charFromSQL(ResultSet rs, int column)` Convert the specified column of the SQL ResultSet to the proper java type.
`Object` | `charToSQL(char val)` Convert data into SQL for the current database platform.
`double` | `doubleFromSQL(ResultSet rs, int column)` Convert the specified column of the SQL ResultSet to the proper java type.
`Object` | `doubleToSQL(double val)` Convert data into SQL for the current database platform.
`float` | `floatFromSQL(ResultSet rs, int column)` Convert the specified column of the SQL ResultSet to the proper java type.
`Object` | `floatToSQL(float val)` Convert data into SQL for the current database platform.
`Object` | `fromSQL(int type, ResultSet rs, int column)` Convert the specified column of the SQL ResultSet to the proper java type.
`SQLBuffer[]` | `getAddColumnSQL(Column column)` Return a series of SQL statements to add the given column to its table, including the addition of any indexes on the column.
`ResultSet` | `getColumns(String tableName, Connection conn)` Return a ResultSet with all the column names in the given table.
`SQLBuffer[]` | `getCreateTableSQL(Table table)` Return a series of SQL statements to create the given table, including any indexes it has.
`DBMetaData` | `getDBMetaData()` Get the DBMetaData for this dictionary.
`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.
`SQLBuffer[]` | `getDropTableSQL(Table table)` Return a series of SQL statements to drop the given table, including any indexes it may have.
`Class[]` | `getFieldMappingCandidateClasses()` Returns a list of possible `FieldMapping` classes for use with this DBDictionary.
`String` | `getPlatform()` Return the name of the platform for the DB type handled; for example, Oracle
`ResultSet` | `getTables(Connection conn)` Return a ResultSet with all the tables in the database.
`String` | `getValidColumnName(String name)` Make any necessary changes to the given column name to make it valid for the current DB.
`String` | `getValidIndexName(String name)` Make any necessary changes to the given index name to make it valid for the current DB.
`String` | `getValidTableName(String name)` Make any necessary changes to the given table name to make it valid for the current DB.
`int` | `intFromSQL(ResultSet rs, int column)` Convert the specified column of the SQL ResultSet to the proper java type.
`Object` | `intToSQL(int val)` Convert data into SQL for the current database platform.
`boolean` | `isClosed(Connection conn)` Some JDBC drivers do not validate the state of the `Connection` when `Connection.isClosed()` is invoked.
`long` | `longFromSQL(ResultSet rs, int column)` Convert the specified column of the SQL ResultSet to the proper java type.
`Object` | `longToSQL(long val)` Convert data into SQL for the current database platform.
`void` | `setColumnNameGenerator(NameGenerator generator)` Set the `NameGenerator` to use for generating column names.
`void` | `setCursorName(Statement stmnt, SQLBuffer buffer)` Sets the cursor name a statment.
`void` | `setDBMetaData(DBMetaData meta)` Set the DBMetaData for this dictionary.
`void` | `setIndexNameGenerator(NameGenerator generator)` Set the `NameGenerator` to use for generating index names.
`void` | `setTransactionIsolation(Connection conn, JDBCConfiguration config)` Setup the transaction isolation level on the Connection.
`short` | `shortFromSQL(ResultSet rs, int column)` Convert the specified column of the SQL ResultSet to the proper java type.
`Object` | `shortToSQL(short val)` Convert data into SQL for the current database platform.
`boolean` | `supportsLocking()` Returns whether or not this database supports locking (e.g., FOR UPDATE clause in SELECT).
`boolean` | `supportsUpdateCountsForBatch()` Returns true if the JDBC driver supports correct update counts in the return value from `Statement.executeBatch()`.
`void` | `toPreparedParameter(int type, PreparedStatement st, int i, Object val)` Set `val` as the `i`'th (base 1) element in `st`.
`SQLBuffer` | `toSelect(String[] cols, String[] tables, SQLBuffer where, SQLBuffer order, boolean distinct, boolean update)` Create a SELECT statement for this databse from the given parts.
`Object` | `toSQL(int type, Object obj)` Convert data into SQL for the current database platform.

Method Detail

### getDBMetaData

    public DBMetaData getDBMetaData()

  Get the DBMetaData for this dictionary.

### setDBMetaData

    public void setDBMetaData(DBMetaData meta)

  Set the DBMetaData for this dictionary.

### isClosed

    public boolean isClosed(Connection conn)

  Some JDBC drivers do not validate the state of the `Connection` when `Connection.isClosed()` is invoked. This method will issue a small SQL statement to validate that the `Connection` is actually in a usable state.
  Returns:
    true if the `Connection` is not valid

### getPlatform

    public String getPlatform()

  Return the name of the platform for the DB type handled; for example, Oracle

### toSQL

    public Object toSQL(int type,
                        Object obj)

  Convert data into SQL for the current database platform. The given type constant will be from the constants of `SQLTypes`.

### booleanToSQL

    public Object booleanToSQL(boolean val)

  Convert data into SQL for the current database platform.

### byteToSQL

    public Object byteToSQL(byte val)

  Convert data into SQL for the current database platform.

### charToSQL

    public Object charToSQL(char val)

  Convert data into SQL for the current database platform.

### doubleToSQL

    public Object doubleToSQL(double val)

  Convert data into SQL for the current database platform.

### floatToSQL

    public Object floatToSQL(float val)

  Convert data into SQL for the current database platform.

### intToSQL

    public Object intToSQL(int val)

  Convert data into SQL for the current database platform.

### longToSQL

    public Object longToSQL(long val)

  Convert data into SQL for the current database platform.

### shortToSQL

    public Object shortToSQL(short val)

  Convert data into SQL for the current database platform.

### fromSQL

    public Object fromSQL(int type,
                          ResultSet rs,
                          int column)
                   throws SQLException

  Convert the specified column of the SQL ResultSet to the proper java type. The type will be from the constants of `SQLTypes`.

### booleanFromSQL

    public boolean booleanFromSQL(ResultSet rs,
                                  int column)
                           throws SQLException

  Convert the specified column of the SQL ResultSet to the proper java type.

### byteFromSQL

    public byte byteFromSQL(ResultSet rs,
                            int column)
                     throws SQLException

  Convert the specified column of the SQL ResultSet to the proper java type.

### charFromSQL

    public char charFromSQL(ResultSet rs,
                            int column)
                     throws SQLException

  Convert the specified column of the SQL ResultSet to the proper java type.

### doubleFromSQL

    public double doubleFromSQL(ResultSet rs,
                                int column)
                         throws SQLException

  Convert the specified column of the SQL ResultSet to the proper java type.

### floatFromSQL

    public float floatFromSQL(ResultSet rs,
                              int column)
                       throws SQLException

  Convert the specified column of the SQL ResultSet to the proper java type.

### intFromSQL

    public int intFromSQL(ResultSet rs,
                          int column)
                   throws SQLException

  Convert the specified column of the SQL ResultSet to the proper java type.

### longFromSQL

    public long longFromSQL(ResultSet rs,
                            int column)
                     throws SQLException

  Convert the specified column of the SQL ResultSet to the proper java type.

### shortFromSQL

    public short shortFromSQL(ResultSet rs,
                              int column)
                       throws SQLException

  Convert the specified column of the SQL ResultSet to the proper java type.

### toPreparedParameter

    public void toPreparedParameter(int type,
                                    PreparedStatement st,
                                    int i,
                                    Object val)
                             throws SQLException

  Set `val` as the `i`'th (base 1) element in `st`. The given type will be from `SQLTypes`.

### toSelect

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

  Create a SELECT statement for this databse from the given parts. Many databases use alternate syntaxes for complex queries; this method can be used to create a query from its basic parts.
  Parameters:
    `cols` - list of values the columns to select
    `tables` - list of the tables to select from
    `where` - the WHERE conditions; may be null if none
    `order` - the ORDER BY conditions; may be null if none
    `distinct` - if true, this should be a SELECT DISTINCT-equivalent query
    `update` - if true this should be a SELECT FOR UPDATE-equivalent query

### getValidTableName

    public String getValidTableName(String name)

  Make any necessary changes to the given table name to make it valid for the current DB.

### getValidColumnName

    public String getValidColumnName(String name)

  Make any necessary changes to the given column name to make it valid for the current DB.

### getValidIndexName

    public String getValidIndexName(String name)

  Make any necessary changes to the given index name to make it valid for the current DB.

### getCreateTableSQL

    public SQLBuffer[] getCreateTableSQL(Table table)

  Return a series of SQL statements to create the given table, including any indexes it has.

### getDropTableSQL

    public SQLBuffer[] getDropTableSQL(Table table)

  Return a series of SQL statements to drop the given table, including any indexes it may have.

### getAddColumnSQL

    public SQLBuffer[] getAddColumnSQL(Column column)

  Return a series of SQL statements to add the given column to its table, including the addition of any indexes on the column.

### getDropColumnSQL

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

### getTables

    public ResultSet getTables(Connection conn)
                        throws SQLException

  Return a ResultSet with all the tables in the database. Used when determining what tables need to be updated during schema manipulation.

### getColumns

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

  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 `Connection.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

### getFieldMappingCandidateClasses

    public Class[] getFieldMappingCandidateClasses()

  Returns a list of possible `FieldMapping` classes for use with this DBDictionary.

### supportsLocking

    public boolean supportsLocking()

  Returns whether or not this database supports locking (e.g., FOR UPDATE clause in SELECT).

### setIndexNameGenerator

    public void setIndexNameGenerator(NameGenerator generator)

  Set the `NameGenerator` to use for generating index names.

### setColumnNameGenerator

    public void setColumnNameGenerator(NameGenerator generator)

  Set the `NameGenerator` to use for generating column names.

### supportsUpdateCountsForBatch

    public boolean supportsUpdateCountsForBatch()

  Returns true if the JDBC driver supports correct update counts in the return value from `Statement.executeBatch()`.

### setTransactionIsolation

    public void setTransactionIsolation(Connection conn,
                                        JDBCConfiguration config)
                                 throws SQLException

  Setup the transaction isolation level on the Connection. This will typically use the value of `JDBCConfiguration.getTransactionIsolationLevel()`, but the dictionary implementation retains the option of overriding the default transaction level.
  Since:
    2.4.1

### setCursorName

    public void setCursorName(Statement stmnt,
                              SQLBuffer buffer)
                       throws SQLException

  Sets the cursor name a statment. Some databases require that a cursor name be set when using pessimistic locking.
  Since:
    2.4.1

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.4.3 generated on March 27 2003
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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