SolarMetric Kodo JDO 2.4.3 generated on March 27 2003

com.solarmetric.kodo.impl.jdbc.schema.dict
Class AbstractDictionary

java.lang.Object
  |
  +--com.solarmetric.kodo.impl.jdbc.schema.dict.AbstractDictionary
All Implemented Interfaces:
DBDictionary
Direct Known Subclasses:
CloudscapeDictionary, DaffodilDictionary, DB2Dictionary, GenericDictionary, HSQLDictionary, InformixDictionary, InstantDBDictionary, InterbaseDictionary, MySQLDictionary, OracleDictionary, PointbaseDictionary, PostgresDictionary, SQLServerDictionary, SybaseDictionary

public abstract class AbstractDictionary
extends Object
implements DBDictionary

Abstrract implementation of the DBDictionary interface for generic SQL.

Since:
2.4

Field Summary
protected static int CENTI
           
protected static int DECI
           
protected  DBMetaData meta
           
protected static int MICRO
           
protected static int MILLI
           
protected static int NANO
           
static NumberFormat NUMBER_FORMAT
           
protected static int SEC
           
 
Constructor Summary
AbstractDictionary()
          Constructor.
 
Method Summary
 SQLBuffer addForUpdateClause(SQLBuffer buffer, String[] cols, String[] tables, SQLBuffer where, SQLBuffer order, boolean distinct, boolean update)
          Add a "FOR UPDATE" clause to the specified SQLBuffer.
 BigDecimal bigDecimalFromSQL(ResultSet rs, int column)
          Get the BigDecimal value of a particular column.
 void bigDecimalToPreparedParameter(PreparedStatement st, int index, BigDecimal val)
           
 Object bigDecimalToSQL(BigDecimal val)
           
 BigInteger bigIntegerFromSQL(ResultSet rs, int column)
           
 void bigIntegerToPreparedParameter(PreparedStatement st, int index, BigInteger val)
           
 Object bigIntegerToSQL(BigInteger val)
           
 Object blobFromSQL(ResultSet rs, int column)
           
 void blobToPreparedParameter(PreparedStatement st, int index, Object val)
           
 Object blobToSQL(Object val)
           
 boolean booleanFromSQL(ResultSet rs, int column)
          Convert the specified column of the SQL ResultSet to the proper java type.
 void booleanToPreparedParameter(PreparedStatement st, int index, Boolean val)
           
 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.
 void byteToPreparedParameter(PreparedStatement st, int index, Number val)
           
 Object byteToSQL(byte val)
          Convert data into SQL for the current database platform.
 void characterToPreparedParameter(PreparedStatement st, int index, Character val)
           
 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.
 String clobFromSQL(ResultSet rs, int column)
           
 void clobToPreparedParameter(PreparedStatement st, int index, Object val)
           
 Object clobToSQL(Object val)
           
protected  String colsToString(String[] cols)
          Converts an array of column names to a comma-separated list of columns appropriate for use in a SELECT statement.
 Date dateFromSQL(ResultSet rs, int column)
           
 void dateToPreparedParameter(PreparedStatement st, int index, Date val)
           
 Object dateToSQL(Date val)
           
protected  Timestamp dateToTimestamp(Date val)
           
 double doubleFromSQL(ResultSet rs, int column)
          Convert the specified column of the SQL ResultSet to the proper java type.
 void doubleToPreparedParameter(PreparedStatement st, int index, Number val)
           
 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.
 void floatToPreparedParameter(PreparedStatement st, int index, Number val)
           
 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.
 Class[] getClassMappingCandidateClasses()
          Here to make life easy for people who overrode this in 2.2/2.3.
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.
protected  SQLBuffer getCreateIndexSQL(Index index)
          Return the SQL to create an index.
 SQLBuffer[] getCreateTableSQL(Table table)
          Return a series of SQL statements to create the given table, including any indexes it has.
protected  int getDatePrecision()
          Return the precision to which dates are stored in this type of data store.
 DBMetaData getDBMetaData()
          Return 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.
protected  SQLBuffer getDropIndexSQL(Index index)
          Return the SQL to drop an index.
 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.
 int getMaxColumnNameLength()
           
 int getMaxIndexNameLength()
           
 int getMaxTableNameLength()
           
 int getNameTruncationVersion()
          Return the name truncation version to use.
 String getPlatform()
          Return the title of this database platform, used for display only.
 boolean getQuoteNumbers()
          Return whether number values should be quoted when being inserted.
 String getSchemaName()
          Return the schema to act on.
 boolean getSimulateLocking()
          If true, we will pretend to allow pessimistic transactions even though the underlying data store does not support pessimistic locking.
protected  SQLTypeMap getSQLTypeMap()
          Returns the type map setup in the setupSQLTypeMap(com.solarmetric.kodo.impl.jdbc.schema.dict.SQLTypeMap) method.
 boolean getStoreCharsAsStrings()
          Get whether we want to store char values as String objects in the data store.
 boolean getStoreLargeNumbersAsStrings()
           
 ResultSet getTables(Connection conn)
          Return a ResultSet with all the tables in the database.
 boolean getValidateConnections()
          Specify whether we want to validate a Connection by issuing a small SQL statement.
 String getValidateConnectionSQL()
          Returns the SQL query used to validate that a SQL Connection is in a valid state.
 String getValidColumnName(String name)
          Limits column names to getMaxTableNameLength()-1 plus an 'X' that is appended to the end of the given name to avoid SQL keyword conflicts.
 String getValidIndexName(String name)
          Limits index names to getMaxIndexNameLength()-1 plus an 'I' that is appended to the end of the given name to avoid SQL keyword conflicts.
 String getValidTableName(String name)
          Limits table names to getMaxTableNameLength()-1 plus an 'X' that is appended to the end of the given name to avoid SQL keyword conflicts.
protected  void initTypeMap()
           
 int intFromSQL(ResultSet rs, int column)
          Convert the specified column of the SQL ResultSet to the proper java type.
 void intToPreparedParameter(PreparedStatement st, int index, Number val)
           
 Object intToSQL(int val)
          Convert data into SQL for the current database platform.
 boolean isClosed(Connection connection)
          Validate the state of the specified Connection.
 Locale localeFromSQL(ResultSet rs, int column)
           
 void localeToPreparedParameter(PreparedStatement st, int index, Locale val)
           
 Object localeToSQL(Locale val)
           
 long longFromSQL(ResultSet rs, int column)
          Convert the specified column of the SQL ResultSet to the proper java type.
 void longToPreparedParameter(PreparedStatement st, int index, Number val)
           
 Object longToSQL(long val)
          Convert data into SQL for the current database platform.
 Object objectFromSQL(int type, ResultSet rs, int column)
          Catch-all responsible for converting any type not converted using one of the methods above.
 void objectToPreparedParameter(int type, PreparedStatement st, int index, Object val)
          Catch-all responsible for converting any type not converted using one of the methods above.
 Object objectToSQL(int type, Object val)
          Catch-all responsible for converting any type not converted using one of the methods above.
protected  boolean prepareLargeNumberAsString(PreparedStatement st, int index, Number val)
          Store a large number as a parameter to a PreparedStatement.
 void setColumnNameGenerator(NameGenerator generator)
          Set the NameGenerator to use for generating column names.
 void setCursorName(Statement stmnt, SQLBuffer buffer)
          By default, we do not ever set the cursor name; this method does nothing.
 void setDBMetaData(DBMetaData metadata)
          Set the metadata for this dictionary.
 void setIndexNameGenerator(NameGenerator generator)
          Set the NameGenerator to use for generating index names.
 void setMaxColumnNameLength(int length)
           
 void setMaxIndexNameLength(int length)
           
 void setMaxTableNameLength(int length)
           
 void setNameTruncationVersion(int version)
          Set the name truncation version to use.
 void setNullParameter(PreparedStatement ps, int index, int type)
          Some JDBC drivers need to deal with nulls in a special way: this method can be overridden to check for various special null circumstances.
 void setQuoteNumbers(boolean quoteNumbers)
          Sets whether number values should be quoted when being inserted.
 void setSchemaName(String schema)
          Set the schema to act on.
 void setSimulateLocking(boolean simulateLocking)
          If true, we will pretend to allow pessimistic transactions even though the underlying data store does not support pessimistic locking.
 void setStoreCharsAsStrings(boolean storeCharsAsStrings)
          Set whether we want to store char values as String objects in the data store.
 void setStoreLargeNumbersAsStrings(boolean storeLargeNumbersAsStrings)
          Storing numbers as strings works around various problems, such as loss of BigDecimal trailing zeros and overflow problems for very large numbers.
 void setTableNameGenerator(NameGenerator generator)
          Set the NameGenerator to use for generating table names.
 void setTransactionIsolation(Connection conn, JDBCConfiguration config)
          Setup the transaction isolation level on the Connection.
protected  void setupSQLTypeMap(SQLTypeMap map)
          This is the most commonly overridden method when porting to a new database.
 void setValidateConnections(boolean validateConnections)
          Specify whether we want to validate a Connection by issuing a small SQL statement.
 void setValidateConnectionSQL(String validateConnectionSQL)
          Set the SQL query to use to verify that a SQL connection is in a valid state.
 short shortFromSQL(ResultSet rs, int column)
          Convert the specified column of the SQL ResultSet to the proper java type.
 void shortToPreparedParameter(PreparedStatement st, int index, Number val)
           
 Object shortToSQL(short val)
          Convert data into SQL for the current database platform.
 String stringFromSQL(ResultSet rs, int column)
           
 void stringToPreparedParameter(PreparedStatement st, int index, String val)
           
 String stringToSQL(String string)
          Called from the toSQL method for Strings; by defualt escapes all single quote characters with another single quote.
 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().
protected  String tablesToString(String[] tables)
          Converts an array of table names to a comma-separated list of tables appropriate for use in a SELECT statement.
 void toPreparedParameter(int type, PreparedStatement st, int i, Object o)
          Set o as the i'th (base 1) element in st.
 SQLBuffer toSelect(String[] cols, String[] tables, SQLBuffer where, SQLBuffer order, boolean distinct, boolean update)
          Appends the given pieces using standard SQL.
 String toSelect(String[] cols, String[] tables, String where, String order, boolean distinct, boolean update)
          Deprecated.  
 String toSelect(String cols, String tables, String where, String order, boolean distinct, boolean update)
          Deprecated. This method is no longer supported, and now throws an exception to that effect.
 Object toSQL(int type, Object val)
          Translate the given value into a SQL string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NUMBER_FORMAT

public static final NumberFormat NUMBER_FORMAT

NANO

protected static final int NANO

MICRO

protected static final int MICRO

MILLI

protected static final int MILLI

CENTI

protected static final int CENTI

DECI

protected static final int DECI

SEC

protected static final int SEC

meta

protected DBMetaData meta
Constructor Detail

AbstractDictionary

public AbstractDictionary()
Constructor. Initializes mapping of DBDictionary constants to SQL types through the {#link setupSQLTypeMap} method.
Method Detail

setDBMetaData

public void setDBMetaData(DBMetaData metadata)
Set the metadata for this dictionary.
Specified by:
setDBMetaData in interface DBDictionary
Parameters:
metadata - the database meta data

getDBMetaData

public DBMetaData getDBMetaData()
Return the DBMetaData for this Dictionary.
Specified by:
getDBMetaData in interface DBDictionary

getSchemaName

public String getSchemaName()
Return the schema to act on.

setSchemaName

public void setSchemaName(String schema)
Set the schema to act on.

getNameTruncationVersion

public int getNameTruncationVersion()
Return the name truncation version to use.

setNameTruncationVersion

public void setNameTruncationVersion(int version)
Set the name truncation version to use.

getPlatform

public String getPlatform()
Return the title of this database platform, used for display only.
Specified by:
getPlatform in interface DBDictionary

getQuoteNumbers

public boolean getQuoteNumbers()
Return whether number values should be quoted when being inserted.

setQuoteNumbers

public void setQuoteNumbers(boolean quoteNumbers)
Sets whether number values should be quoted when being inserted. Some databases store perfect precision when number values are quoted.

toSQL

public final Object toSQL(int type,
                          Object val)
Translate the given value into a SQL string.
Specified by:
toSQL in interface DBDictionary
Parameters:
type - the type of the column
val - the object to translate
Returns:
the SQL String

stringToSQL

public String stringToSQL(String string)
Called from the toSQL method for Strings; by defualt escapes all single quote characters with another single quote.

dateToSQL

public Object dateToSQL(Date val)

dateToTimestamp

protected Timestamp dateToTimestamp(Date val)

booleanToSQL

public Object booleanToSQL(boolean val)
Description copied from interface: DBDictionary
Convert data into SQL for the current database platform.
Specified by:
booleanToSQL in interface DBDictionary

byteToSQL

public Object byteToSQL(byte val)
Description copied from interface: DBDictionary
Convert data into SQL for the current database platform.
Specified by:
byteToSQL in interface DBDictionary

charToSQL

public Object charToSQL(char val)
Description copied from interface: DBDictionary
Convert data into SQL for the current database platform.
Specified by:
charToSQL in interface DBDictionary

doubleToSQL

public Object doubleToSQL(double val)
Description copied from interface: DBDictionary
Convert data into SQL for the current database platform.
Specified by:
doubleToSQL in interface DBDictionary

floatToSQL

public Object floatToSQL(float val)
Description copied from interface: DBDictionary
Convert data into SQL for the current database platform.
Specified by:
floatToSQL in interface DBDictionary

intToSQL

public Object intToSQL(int val)
Description copied from interface: DBDictionary
Convert data into SQL for the current database platform.
Specified by:
intToSQL in interface DBDictionary

longToSQL

public Object longToSQL(long val)
Description copied from interface: DBDictionary
Convert data into SQL for the current database platform.
Specified by:
longToSQL in interface DBDictionary

shortToSQL

public Object shortToSQL(short val)
Description copied from interface: DBDictionary
Convert data into SQL for the current database platform.
Specified by:
shortToSQL in interface DBDictionary

localeToSQL

public Object localeToSQL(Locale val)

blobToSQL

public Object blobToSQL(Object val)

clobToSQL

public Object clobToSQL(Object val)

bigIntegerToSQL

public Object bigIntegerToSQL(BigInteger val)

bigDecimalToSQL

public Object bigDecimalToSQL(BigDecimal val)

objectToSQL

public Object objectToSQL(int type,
                          Object val)
Catch-all responsible for converting any type not converted using one of the methods above. This will become more important when we migrate to java.sql.Types instead of SQLTypes.

fromSQL

public final Object fromSQL(int type,
                            ResultSet rs,
                            int column)
                     throws SQLException
Description copied from interface: DBDictionary
Convert the specified column of the SQL ResultSet to the proper java type. The type will be from the constants of SQLTypes.
Specified by:
fromSQL in interface DBDictionary

booleanFromSQL

public boolean booleanFromSQL(ResultSet rs,
                              int column)
                       throws SQLException
Description copied from interface: DBDictionary
Convert the specified column of the SQL ResultSet to the proper java type.
Specified by:
booleanFromSQL in interface DBDictionary

byteFromSQL

public byte byteFromSQL(ResultSet rs,
                        int column)
                 throws SQLException
Description copied from interface: DBDictionary
Convert the specified column of the SQL ResultSet to the proper java type.
Specified by:
byteFromSQL in interface DBDictionary

charFromSQL

public char charFromSQL(ResultSet rs,
                        int column)
                 throws SQLException
Description copied from interface: DBDictionary
Convert the specified column of the SQL ResultSet to the proper java type.
Specified by:
charFromSQL in interface DBDictionary

doubleFromSQL

public double doubleFromSQL(ResultSet rs,
                            int column)
                     throws SQLException
Description copied from interface: DBDictionary
Convert the specified column of the SQL ResultSet to the proper java type.
Specified by:
doubleFromSQL in interface DBDictionary

floatFromSQL

public float floatFromSQL(ResultSet rs,
                          int column)
                   throws SQLException
Description copied from interface: DBDictionary
Convert the specified column of the SQL ResultSet to the proper java type.
Specified by:
floatFromSQL in interface DBDictionary

intFromSQL

public int intFromSQL(ResultSet rs,
                      int column)
               throws SQLException
Description copied from interface: DBDictionary
Convert the specified column of the SQL ResultSet to the proper java type.
Specified by:
intFromSQL in interface DBDictionary

longFromSQL

public long longFromSQL(ResultSet rs,
                        int column)
                 throws SQLException
Description copied from interface: DBDictionary
Convert the specified column of the SQL ResultSet to the proper java type.
Specified by:
longFromSQL in interface DBDictionary

shortFromSQL

public short shortFromSQL(ResultSet rs,
                          int column)
                   throws SQLException
Description copied from interface: DBDictionary
Convert the specified column of the SQL ResultSet to the proper java type.
Specified by:
shortFromSQL in interface DBDictionary

bigDecimalFromSQL

public BigDecimal bigDecimalFromSQL(ResultSet rs,
                                    int column)
                             throws SQLException
Get the BigDecimal value of a particular column. We need to check for the JDBC driver version, since getBigDecimal(column) only exists in JDBC2, whereas JDBC 1 has getBigDecimal(column,scale).

bigIntegerFromSQL

public BigInteger bigIntegerFromSQL(ResultSet rs,
                                    int column)
                             throws SQLException

stringFromSQL

public String stringFromSQL(ResultSet rs,
                            int column)
                     throws SQLException

localeFromSQL

public Locale localeFromSQL(ResultSet rs,
                            int column)
                     throws SQLException

clobFromSQL

public String clobFromSQL(ResultSet rs,
                          int column)
                   throws SQLException

blobFromSQL

public Object blobFromSQL(ResultSet rs,
                          int column)
                   throws SQLException

dateFromSQL

public Date dateFromSQL(ResultSet rs,
                        int column)
                 throws SQLException

objectFromSQL

public Object objectFromSQL(int type,
                            ResultSet rs,
                            int column)
                     throws SQLException
Catch-all responsible for converting any type not converted using one of the methods above. This will become more important when we migrate to java.sql.Types instead of SQLTypes.

toPreparedParameter

public final void toPreparedParameter(int type,
                                      PreparedStatement st,
                                      int i,
                                      Object o)
                               throws SQLException
Set o as the i'th (base 1) element in st.
Specified by:
toPreparedParameter in interface DBDictionary

stringToPreparedParameter

public void stringToPreparedParameter(PreparedStatement st,
                                      int index,
                                      String val)
                               throws SQLException

dateToPreparedParameter

public void dateToPreparedParameter(PreparedStatement st,
                                    int index,
                                    Date val)
                             throws SQLException

booleanToPreparedParameter

public void booleanToPreparedParameter(PreparedStatement st,
                                       int index,
                                       Boolean val)
                                throws SQLException

byteToPreparedParameter

public void byteToPreparedParameter(PreparedStatement st,
                                    int index,
                                    Number val)
                             throws SQLException

characterToPreparedParameter

public void characterToPreparedParameter(PreparedStatement st,
                                         int index,
                                         Character val)
                                  throws SQLException

prepareLargeNumberAsString

protected boolean prepareLargeNumberAsString(PreparedStatement st,
                                             int index,
                                             Number val)
                                      throws SQLException
Store a large number as a parameter to a PreparedStatement.
Parameters:
st - the PreparedStatement to which to bind
index - the index of the PreparedStatement
val - the Number to set as a String
Returns:
true if we bound it as a String, false if it needs to be bound by the number
Throws:
SQLException - on database exception
See Also:
setStoreLargeNumbersAsStrings(boolean)

doubleToPreparedParameter

public void doubleToPreparedParameter(PreparedStatement st,
                                      int index,
                                      Number val)
                               throws SQLException

floatToPreparedParameter

public void floatToPreparedParameter(PreparedStatement st,
                                     int index,
                                     Number val)
                              throws SQLException

intToPreparedParameter

public void intToPreparedParameter(PreparedStatement st,
                                   int index,
                                   Number val)
                            throws SQLException

longToPreparedParameter

public void longToPreparedParameter(PreparedStatement st,
                                    int index,
                                    Number val)
                             throws SQLException

shortToPreparedParameter

public void shortToPreparedParameter(PreparedStatement st,
                                     int index,
                                     Number val)
                              throws SQLException

bigIntegerToPreparedParameter

public void bigIntegerToPreparedParameter(PreparedStatement st,
                                          int index,
                                          BigInteger val)
                                   throws SQLException

bigDecimalToPreparedParameter

public void bigDecimalToPreparedParameter(PreparedStatement st,
                                          int index,
                                          BigDecimal val)
                                   throws SQLException

localeToPreparedParameter

public void localeToPreparedParameter(PreparedStatement st,
                                      int index,
                                      Locale val)
                               throws SQLException

blobToPreparedParameter

public void blobToPreparedParameter(PreparedStatement st,
                                    int index,
                                    Object val)
                             throws SQLException

clobToPreparedParameter

public void clobToPreparedParameter(PreparedStatement st,
                                    int index,
                                    Object val)
                             throws SQLException

objectToPreparedParameter

public void objectToPreparedParameter(int type,
                                      PreparedStatement st,
                                      int index,
                                      Object val)
                               throws SQLException
Catch-all responsible for converting any type not converted using one of the methods above. This will become more important when we migrate to java.sql.Types instead of SQLTypes.

toSelect

public final String toSelect(String cols,
                             String tables,
                             String where,
                             String order,
                             boolean distinct,
                             boolean update)
Deprecated. This method is no longer supported, and now throws an exception to that effect.


toSelect

public SQLBuffer toSelect(String[] cols,
                          String[] tables,
                          SQLBuffer where,
                          SQLBuffer order,
                          boolean distinct,
                          boolean update)
Appends the given pieces using standard SQL.
Specified by:
toSelect in interface DBDictionary
Following copied from interface: com.solarmetric.kodo.impl.jdbc.schema.DBDictionary
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

addForUpdateClause

public SQLBuffer addForUpdateClause(SQLBuffer buffer,
                                    String[] cols,
                                    String[] tables,
                                    SQLBuffer where,
                                    SQLBuffer order,
                                    boolean distinct,
                                    boolean update)
Add a "FOR UPDATE" clause to the specified SQLBuffer. By default this simply appends " FOR UPDATE" to the end of the clause. Other databases may use different syntax.

colsToString

protected String colsToString(String[] cols)
Converts an array of column names to a comma-separated list of columns appropriate for use in a SELECT statement.

tablesToString

protected String tablesToString(String[] tables)
Converts an array of table names to a comma-separated list of tables appropriate for use in a SELECT statement.

getValidTableName

public String getValidTableName(String name)
Limits table names to getMaxTableNameLength()-1 plus an 'X' that is appended to the end of the given name to avoid SQL keyword conflicts.
Specified by:
getValidTableName in interface DBDictionary

getValidColumnName

public String getValidColumnName(String name)
Limits column names to getMaxTableNameLength()-1 plus an 'X' that is appended to the end of the given name to avoid SQL keyword conflicts.
Specified by:
getValidColumnName in interface DBDictionary

getValidIndexName

public String getValidIndexName(String name)
Limits index names to getMaxIndexNameLength()-1 plus an 'I' that is appended to the end of the given name to avoid SQL keyword conflicts.
Specified by:
getValidIndexName in interface DBDictionary

getMaxTableNameLength

public int getMaxTableNameLength()
Returns:
The maximum length of table names allowed in this database. Defaults to 30.

setMaxTableNameLength

public void setMaxTableNameLength(int length)

getMaxColumnNameLength

public int getMaxColumnNameLength()
Returns:
The maximum length of column names allowed in this database. Defaults to 30.

setMaxColumnNameLength

public void setMaxColumnNameLength(int length)

getMaxIndexNameLength

public int getMaxIndexNameLength()
Returns:
The maximum length of index names allowed in this database. Defaults to 30.

setMaxIndexNameLength

public void setMaxIndexNameLength(int length)

getCreateTableSQL

public SQLBuffer[] getCreateTableSQL(Table table)
Description copied from interface: DBDictionary
Return a series of SQL statements to create the given table, including any indexes it has.
Specified by:
getCreateTableSQL in interface DBDictionary

getDropTableSQL

public SQLBuffer[] getDropTableSQL(Table table)
Description copied from interface: DBDictionary
Return a series of SQL statements to drop the given table, including any indexes it may have.
Specified by:
getDropTableSQL in interface DBDictionary

getAddColumnSQL

public SQLBuffer[] getAddColumnSQL(Column column)
Description copied from interface: DBDictionary
Return a series of SQL statements to add the given column to its table, including the addition of any indexes on the column.
Specified by:
getAddColumnSQL in interface DBDictionary

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.
Specified by:
getDropColumnSQL in interface DBDictionary

getCreateIndexSQL

protected SQLBuffer getCreateIndexSQL(Index index)
Return the SQL to create an index. Defaults to: CREATE INDEX <index-name> ON <table-name> ( <column-name>)

getDropIndexSQL

protected SQLBuffer getDropIndexSQL(Index index)
Return the SQL to drop an index. Defaults to: DROP INDEX <index-name>

getColumnDeclaration

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]. Where NOT NULL is appended if it is a primary key column.

getSQLTypeMap

protected SQLTypeMap getSQLTypeMap()
Returns the type map setup in the setupSQLTypeMap(com.solarmetric.kodo.impl.jdbc.schema.dict.SQLTypeMap) method.

setupSQLTypeMap

protected void setupSQLTypeMap(SQLTypeMap map)
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.

initTypeMap

protected final void initTypeMap()

getDatePrecision

protected int getDatePrecision()
Return the precision to which dates are stored in this type of data store. Returns MILLI by default, as java.util.Date is only precise to the nearest millisecond. This value is used when generating timestamps to store in the data store. It is important that we never generate SQL data with greater precision than what will be returned to us, as otherwise we can get into awkward situations in which we cannot use retrieved values in where clauses since the data is not sufficiently precise. SQLServer behaves strangely here. It returns values whose millis are not accurate, but allows SELECT, DELETE statements using these non-accurate milli values. It must perform some internal rounding. Oracle, MySQL return values precise to the second on select, but will select/delete all values in a particular second, not just those values with exactly 0 nanos.

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.
Specified by:
getTables in interface DBDictionary

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

Specified by:
getColumns in interface DBDictionary

getClassMappingCandidateClasses

public final Class[] getClassMappingCandidateClasses()
Here to make life easy for people who overrode this in 2.2/2.3.

getFieldMappingCandidateClasses

public Class[] getFieldMappingCandidateClasses()
Description copied from interface: DBDictionary
Returns a list of possible FieldMapping classes for use with this DBDictionary.
Specified by:
getFieldMappingCandidateClasses in interface DBDictionary

supportsLocking

public boolean supportsLocking()
Description copied from interface: DBDictionary
Returns whether or not this database supports locking (e.g., FOR UPDATE clause in SELECT).
Specified by:
supportsLocking in interface DBDictionary

setSimulateLocking

public void setSimulateLocking(boolean simulateLocking)
If true, we will pretend to allow pessimistic transactions even though the underlying data store does not support pessimistic locking.

getSimulateLocking

public boolean getSimulateLocking()
If true, we will pretend to allow pessimistic transactions even though the underlying data store does not support pessimistic locking.

setStoreCharsAsStrings

public void setStoreCharsAsStrings(boolean storeCharsAsStrings)
Set whether we want to store char values as String objects in the data store.

getStoreCharsAsStrings

public boolean getStoreCharsAsStrings()
Get whether we want to store char values as String objects in the data store.

setStoreLargeNumbersAsStrings

public void setStoreLargeNumbersAsStrings(boolean storeLargeNumbersAsStrings)

Storing numbers as strings works around various problems, such as loss of BigDecimal trailing zeros and overflow problems for very large numbers.

If this attribute is true, then parameters to inserts and queries will be treated as Strings for the following types:

Furthermore, schemas that are initialized with this value set to true will initialize the appropriate columns as type VARCHAR(400).

Parameters:
storeLargeNumbersAsStrings - true if numbers are to be stored as Strings

getStoreLargeNumbersAsStrings

public boolean getStoreLargeNumbersAsStrings()
Returns:
whether we are storing numbers as Strings
See Also:
setStoreLargeNumbersAsStrings(boolean)

setIndexNameGenerator

public void setIndexNameGenerator(NameGenerator generator)
Set the NameGenerator to use for generating index names.
Specified by:
setIndexNameGenerator in interface DBDictionary

setColumnNameGenerator

public void setColumnNameGenerator(NameGenerator generator)
Set the NameGenerator to use for generating column names.
Specified by:
setColumnNameGenerator in interface DBDictionary

setTableNameGenerator

public void setTableNameGenerator(NameGenerator generator)
Set the NameGenerator to use for generating table names.

setValidateConnections

public void setValidateConnections(boolean validateConnections)
Specify whether we want to validate a Connection by issuing a small SQL statement. This is useful for JDBC drivers that do not actually do connection validation in the Connection.isClosed() method.
Parameters:
validateConnections - if true, then perform additional validation

getValidateConnections

public boolean getValidateConnections()
Specify whether we want to validate a Connection by issuing a small SQL statement. This is useful for JDBC drivers that do not actually do connection validation in the Connection.isClosed() method.

isClosed

public boolean isClosed(Connection connection)
Validate the state of the specified Connection. The default implementation just checks Connection.isClosed(), and then, if getValidateConnections() is true and getValidateConnectionSQL() does not return a null value, issue a SQL statement to the database to ensure that the connection is in a valid state.
Specified by:
isClosed in interface DBDictionary
Following copied from interface: com.solarmetric.kodo.impl.jdbc.schema.DBDictionary
Returns:
true if the Connection is not valid

setValidateConnectionSQL

public void setValidateConnectionSQL(String validateConnectionSQL)
Set the SQL query to use to verify that a SQL connection is in a valid state.

getValidateConnectionSQL

public String getValidateConnectionSQL()
Returns the SQL query used to validate that a SQL Connection is in a valid state.

supportsUpdateCountsForBatch

public boolean supportsUpdateCountsForBatch()
Description copied from interface: DBDictionary
Returns true if the JDBC driver supports correct update counts in the return value from Statement.executeBatch().
Specified by:
supportsUpdateCountsForBatch in interface DBDictionary

toSelect

public final String toSelect(String[] cols,
                             String[] tables,
                             String where,
                             String order,
                             boolean distinct,
                             boolean update)
Deprecated.  

Obsolete API: final so people do not override it.

setNullParameter

public void setNullParameter(PreparedStatement ps,
                             int index,
                             int type)
                      throws SQLException
Some JDBC drivers need to deal with nulls in a special way: this method can be overridden to check for various special null circumstances.

setTransactionIsolation

public void setTransactionIsolation(Connection conn,
                                    JDBCConfiguration config)
                             throws SQLException
Description copied from interface: DBDictionary
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.
Specified by:
setTransactionIsolation in interface DBDictionary

setCursorName

public void setCursorName(Statement stmnt,
                          SQLBuffer buffer)
                   throws SQLException
By default, we do not ever set the cursor name; this method does nothing.
Specified by:
setCursorName in interface DBDictionary

SolarMetric Kodo JDO 2.4.3 generated on March 27 2003

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