SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool

com.solarmetric.rd.kodo.impl.jdbc.schema
Class DBDictionary

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

public class DBDictionary
extends java.lang.Object

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


Field Summary
protected static int CENTI
           
protected static int DECI
           
protected static int MICRO
           
protected static int MILLI
           
protected static int NANO
           
protected static int SEC
           
 
Constructor Summary
DBDictionary()
           
 
Method Summary
 void addSystemSchema(java.lang.String schemaName)
          Add the name of a schema that should not be reflected on.
 void addSystemTable(java.lang.String tableName)
          Add the name of a table that should not be reflected on.
 boolean generateForeignKeys(com.solarmetric.rd.kodo.impl.jdbc.schema.SchemaGroup group, java.lang.String schemaName, java.lang.String tableName, java.sql.Connection conn, java.sql.DatabaseMetaData meta)
          By default, the SchemaGenerator uses JDBC database metadata to reflect on the schema.
 boolean generateIndexes(com.solarmetric.rd.kodo.impl.jdbc.schema.SchemaGroup group, java.lang.String schemaName, java.lang.String tableName, java.sql.Connection conn, java.sql.DatabaseMetaData meta)
          By default, the SchemaGenerator uses JDBC database metadata to reflect on the schema.
 boolean generatePrimaryKeys(com.solarmetric.rd.kodo.impl.jdbc.schema.SchemaGroup group, java.lang.String schemaName, java.lang.String tableName, java.sql.Connection conn, java.sql.DatabaseMetaData meta)
          By default, the SchemaGenerator uses JDBC database metadata to reflect on the schema.
 boolean generateTables(com.solarmetric.rd.kodo.impl.jdbc.schema.SchemaGroup group, java.lang.String schemaName, java.lang.String tableName, java.sql.Connection conn, java.sql.DatabaseMetaData meta)
          By default, the SchemaGenerator uses JDBC database metadata to reflect on the schema.
 java.lang.String[] getAddColumnSQL(com.solarmetric.rd.kodo.impl.jdbc.schema.Column column)
          Return a series of SQL statements to add the given column to its table.
 java.lang.String[] getAddForeignKeySQL(com.solarmetric.rd.kodo.impl.jdbc.schema.ForeignKey fk)
          Return a series of SQL statements to add the given foreign key to its table.
 java.lang.String[] getAddPrimaryKeySQL(com.solarmetric.rd.kodo.impl.jdbc.schema.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)
          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.
 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.
 com.solarmetric.rd.kodo.impl.jdbc.conf.JDBCConfiguration getConfiguration()
          Get the configuration for this dictionary.
 java.lang.String[] getCreateIndexSQL(com.solarmetric.rd.kodo.impl.jdbc.schema.Index index)
          Return a series of SQL statements to create the given index.
 java.lang.String[] getCreateTableSQL(com.solarmetric.rd.kodo.impl.jdbc.schema.Table table)
          Return a series of SQL statements to create the given table, complete with columns and all constraints.
 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  int getDatePrecision()
          Set to the precision of timestamps in the data store.
 com.solarmetric.rd.kodo.impl.jdbc.schema.DBMetaData getDBMetaData()
          Get the DBMetaData for this dictionary.
protected  java.lang.String getDeclareColumnSQL(com.solarmetric.rd.kodo.impl.jdbc.schema.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(com.solarmetric.rd.kodo.impl.jdbc.schema.Column column)
          Return a series of SQL statements to drop the given column from its table.
 java.lang.String[] getDropForeignKeySQL(com.solarmetric.rd.kodo.impl.jdbc.schema.ForeignKey fk)
          Return a series of SQL statements to drop the given foreign key from its table.
 java.lang.String[] getDropIndexSQL(com.solarmetric.rd.kodo.impl.jdbc.schema.Index index)
          Return a series of SQL statements to drop the given index.
 java.lang.String[] getDropPrimaryKeySQL(com.solarmetric.rd.kodo.impl.jdbc.schema.PrimaryKey pk)
          Return a series of SQL statements to drop the given primary key from its table.
 java.lang.String[] getDropTableSQL(com.solarmetric.rd.kodo.impl.jdbc.schema.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 getForeignKeyActionName(int action)
          Return the action SQL for the given foreign key.
protected  java.lang.String getForeignKeyConstraintSQL(com.solarmetric.rd.kodo.impl.jdbc.schema.ForeignKey fk)
          Return the declaration SQL for the given foreign key, or null if it is not supported.
 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 FieldMapping constant.
 int getJDBCType(java.lang.String typeName)
          Return the corresponding JDBC type for a given unhandled type (e.g.
 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.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 getPlatform()
          Return the database platform for this dictionary.
 int getPreferredType(int type)
          Return the preferred Types type for the given one.
protected  java.lang.String getPrimaryKeyConstraintSQL(com.solarmetric.rd.kodo.impl.jdbc.schema.PrimaryKey pk)
          Return the declaration SQL for the given primary key.
 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.
 short getShort(java.sql.ResultSet rs, int column)
          Convert the specified column of the SQL ResultSet to the proper java type.
 boolean getSimulateLocking()
          If true, pessimistic locking will be allowed even if the database does not support locking.
 boolean getStoreCharsAsNumbers()
          If true, Java char values will be stored as numbers.
 boolean getStoreLargeNumbersAsStrings()
          If true, BigDecimals and BigIntegers will be stored as strings.
 java.lang.String getString(java.sql.ResultSet rs, int column)
          Convert the specified column of the SQL ResultSet to the proper java type.
 java.util.Collection getSystemSchemas()
          Return the list of system schemas that will not be reflected on when constructing the in-memory representation of the schema.
 java.util.Collection getSystemTables()
          Return the list of system tables that will not be reflected on when constructing the in-memory representation of the schema.
 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.
protected  java.lang.String getTypeName(com.solarmetric.rd.kodo.impl.jdbc.schema.Column col)
          Return the preferred database type for the given column's type from Types.
 java.lang.String getValidColumnName(java.lang.String name, com.solarmetric.rd.kodo.impl.jdbc.schema.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, com.solarmetric.rd.kodo.impl.jdbc.schema.Table table, com.solarmetric.rd.kodo.impl.jdbc.schema.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, com.solarmetric.rd.kodo.impl.jdbc.schema.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, com.solarmetric.rd.kodo.impl.jdbc.schema.Table table)
          Make any necessary changes to the given primary key name to make it valid for the current DB.
 java.lang.String getValidTableName(java.lang.String name, com.solarmetric.rd.kodo.impl.jdbc.schema.Schema schema)
          Make any necessary changes to the given table name to make it valid for the current DB.
 boolean isSystemIndex(java.lang.String name, com.solarmetric.rd.kodo.impl.jdbc.schema.Table table)
          This method is used to filter system indexes 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.
 java.lang.String makeNameValid(java.lang.String name, com.solarmetric.rd.kodo.impl.jdbc.schema.NameSet set, int maxLen)
          Shortens the given name to the given maximum length, then checks that it is not a reserved word.
 com.solarmetric.rd.kodo.impl.jdbc.meta.FieldMapping replaceMapping(com.solarmetric.rd.kodo.impl.jdbc.meta.FieldMapping mapping)
          Replace the given mapping with one suited to this database, or return the original if no replacement is needed.
 com.solarmetric.rd.kodo.impl.jdbc.meta.MappingFactory replaceMappingFactory(com.solarmetric.rd.kodo.impl.jdbc.meta.MappingFactory factory)
          Replace the given factory with one suited to this database, or return the original if no replacement is needed.
 com.solarmetric.rd.kodo.impl.jdbc.schema.SchemaFactory replaceSchemaFactory(com.solarmetric.rd.kodo.impl.jdbc.schema.SchemaFactory factory)
          Replace the given factory with one suited to this database, or return the original if no replacement is needed.
 void setArray(java.sql.PreparedStatement stmnt, int idx, java.sql.Array val)
          Set the given value as a parameter to the statement.
 void setAsciiStream(java.sql.PreparedStatement stmnt, int idx, java.io.InputStream val, int length)
          Set the given value as a parameter to the statement.
 void setBigDecimal(java.sql.PreparedStatement stmnt, int idx, java.math.BigDecimal val)
          Set the given value as a parameter to the statement.
 void setBigInteger(java.sql.PreparedStatement stmnt, int idx, java.math.BigInteger val)
          Set the given value as a parameter to the statement.
 void setBinaryStream(java.sql.PreparedStatement stmnt, int idx, java.io.InputStream val, int length)
          Set the given value as a parameter to the statement.
 void setBlob(java.sql.PreparedStatement stmnt, int idx, java.sql.Blob val)
          Set the given value as a parameter to the statement.
 void setBlobObject(java.sql.PreparedStatement stmnt, int idx, java.lang.Object val)
          Set the given value as a parameter to the statement.
 void setBoolean(java.sql.PreparedStatement stmnt, int idx, boolean val)
          Set the given value as a parameter to the statement.
 void setByte(java.sql.PreparedStatement stmnt, int idx, byte val)
          Set the given value as a parameter to the statement.
 void setBytes(java.sql.PreparedStatement stmnt, int idx, byte[] val)
          Set the given value as a parameter to the statement.
 void setChar(java.sql.PreparedStatement stmnt, int idx, char val)
          Set the given value as a parameter to the statement.
 void setCharacterStream(java.sql.PreparedStatement stmnt, int idx, java.io.Reader val, int length)
          Set the given value as a parameter to the statement.
 void setClob(java.sql.PreparedStatement stmnt, int idx, java.sql.Clob val)
          Set the given value as a parameter to the statement.
 void setClobString(java.sql.PreparedStatement stmnt, int idx, java.lang.String val)
          Set the given value as a parameter to the statement.
 void setConfiguration(com.solarmetric.rd.kodo.impl.jdbc.conf.JDBCConfiguration conf)
          Set the configuration for this dictionary.
 void setDate(java.sql.PreparedStatement stmnt, int idx, java.util.Date val)
          Set the given value as a parameter to the statement.
 void setDate(java.sql.PreparedStatement stmnt, int idx, java.sql.Date val, java.util.Calendar cal)
          Set the given value as a parameter to the statement.
 void setDBMetaData(com.solarmetric.rd.kodo.impl.jdbc.schema.DBMetaData meta)
          Set the database metadata for this dictionary.
 void setDouble(java.sql.PreparedStatement stmnt, int idx, double val)
          Set the given value as a parameter to the statement.
 void setFloat(java.sql.PreparedStatement stmnt, int idx, float val)
          Set the given value as a parameter to the statement.
 void setInt(java.sql.PreparedStatement stmnt, int idx, int val)
          Set the given value as a parameter to the statement.
 void setLocale(java.sql.PreparedStatement stmnt, int idx, java.util.Locale val)
          Set the given value as a parameter to the statement.
 void setLong(java.sql.PreparedStatement stmnt, int idx, long val)
          Set the given value as a parameter to the statement.
 void setNull(java.sql.PreparedStatement stmnt, int idx, int colType)
          Set the given value as a parameters to the statement.
 void setObject(java.sql.PreparedStatement stmnt, int idx, java.lang.Object val, int colType)
          Set the given value as a parameters to the statement.
 void setRef(java.sql.PreparedStatement stmnt, int idx, java.sql.Ref val)
          Set the given value as a parameter to the statement.
 void setShort(java.sql.PreparedStatement stmnt, int idx, short val)
          Set the given value as a parameter to the statement.
 void setSimulateLocking(boolean simulate)
          If true, pessimistic locking will be allowed even if the database does not support locking.
 void setStoreCharsAsNumbers(boolean charsAsNumbers)
          If true, Java char values will be stored as numbers.
 void setStoreLargeNumbersAsStrings(boolean asStrings)
          If true, BigDecimals and BigIntegers will be stored as strings.
 void setString(java.sql.PreparedStatement stmnt, int idx, java.lang.String val)
          Set the given value as a parameter to the statement.
 void setSystemSchemas(java.lang.String schemaNames)
          Set a comma-separated string of table names that are considered system schemas and should not be reflected on.
 void setSystemTables(java.lang.String tableNames)
          Set a comma-separated string of table names that are considered system tables and should not be reflected on.
 void setTime(java.sql.PreparedStatement stmnt, int idx, java.sql.Time val, java.util.Calendar cal)
          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)
          Set the given value as a parameter to the statement.
 boolean supportsDeferredConstraints()
          Return true if the database supports deferred constraints.
 boolean supportsForeignKeyDeleteAction(int action)
          Return true if the database supports the given foreign key delete action.
 boolean supportsSelectForUpdate()
          Whether locking on queries is supported; returns the metadata's reported value by default.
 boolean supportsUpdateCountsForBatch()
          Return true if the database returns meaningful update counts on batched statements.
 com.solarmetric.rd.kodo.impl.jdbc.schema.SQLBuffer toSelect(com.solarmetric.rd.kodo.impl.jdbc.schema.SQLBuffer select, java.lang.String tables, com.solarmetric.rd.kodo.impl.jdbc.schema.SQLBuffer where, com.solarmetric.rd.kodo.impl.jdbc.schema.SQLBuffer order, boolean distinct, boolean forUpdate)
          Create a SELECT statement for this database.
 java.sql.Connection wrapConnection(java.sql.Connection conn)
          Wrap the given connection if needed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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

DBDictionary

public DBDictionary()
Method Detail

getConfiguration

public com.solarmetric.rd.kodo.impl.jdbc.conf.JDBCConfiguration getConfiguration()
Get the configuration for this dictionary.


setConfiguration

public void setConfiguration(com.solarmetric.rd.kodo.impl.jdbc.conf.JDBCConfiguration conf)
Set the configuration for this dictionary. This method will always be called by the system before the dictionary is used.


getDBMetaData

public com.solarmetric.rd.kodo.impl.jdbc.schema.DBMetaData getDBMetaData()
Get the DBMetaData for this dictionary.


setDBMetaData

public void setDBMetaData(com.solarmetric.rd.kodo.impl.jdbc.schema.DBMetaData meta)
Set the database metadata for this dictionary. This method will be called by the system.


getPlatform

public java.lang.String getPlatform()
Return the database platform for this dictionary.


getStoreCharsAsNumbers

public boolean getStoreCharsAsNumbers()
If true, Java char values will be stored as numbers. Defaults to false.


setStoreCharsAsNumbers

public void setStoreCharsAsNumbers(boolean charsAsNumbers)
If true, Java char values will be stored as numbers. Defaults to false.


getStoreLargeNumbersAsStrings

public boolean getStoreLargeNumbersAsStrings()
If true, BigDecimals and BigIntegers will be stored as strings. Defaults to false.


setStoreLargeNumbersAsStrings

public void setStoreLargeNumbersAsStrings(boolean asStrings)
If true, BigDecimals and BigIntegers will be stored as strings. Defaults to false.


getSimulateLocking

public boolean getSimulateLocking()
If true, pessimistic locking will be allowed even if the database does not support locking. Defaults to false.


setSimulateLocking

public void setSimulateLocking(boolean simulate)
If true, pessimistic locking will be allowed even if the database does not support locking. Defaults to false.


getSystemTables

public java.util.Collection getSystemTables()
Return the list of system tables that will not be reflected on when constructing the in-memory representation of the schema.


setSystemTables

public void setSystemTables(java.lang.String tableNames)
Set a comma-separated string of table names that are considered system tables and should not be reflected on. Used by the auto-configuration mechanism to set a list of tables from properties.


addSystemTable

public void addSystemTable(java.lang.String tableName)
Add the name of a table that should not be reflected on.


getSystemSchemas

public java.util.Collection getSystemSchemas()
Return the list of system schemas that will not be reflected on when constructing the in-memory representation of the schema.


setSystemSchemas

public void setSystemSchemas(java.lang.String schemaNames)
Set a comma-separated string of table names that are considered system schemas and should not be reflected on. Used by the auto-configuration mechanism to set a list of schemas from properties.


addSystemSchema

public void addSystemSchema(java.lang.String schemaName)
Add the name of a schema that should not be reflected on.


supportsUpdateCountsForBatch

public boolean supportsUpdateCountsForBatch()
Return true if the database returns meaningful update counts on batched statements. Returns true by default.


supportsForeignKeyDeleteAction

public boolean supportsForeignKeyDeleteAction(int action)
Return true if the database supports the given foreign key delete action. Returns true for all actions except ForeignKey.ACTION_NONE by default.


supportsDeferredConstraints

public boolean supportsDeferredConstraints()
Return true if the database supports deferred constraints. Returns true by default.


supportsSelectForUpdate

public boolean supportsSelectForUpdate()
Whether locking on queries is supported; returns the metadata's reported value by default.


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.

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.

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.

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.

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.

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.

java.sql.SQLException

getBlobObject

public java.lang.Object getBlobObject(java.sql.ResultSet rs,
                                      int column)
                               throws java.sql.SQLException
Convert the specified column of the SQL ResultSet to the proper java type.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

java.sql.SQLException

setArray

public void setArray(java.sql.PreparedStatement stmnt,
                     int idx,
                     java.sql.Array val)
              throws java.sql.SQLException
Set the given value as a parameter to the statement.

java.sql.SQLException

setAsciiStream

public void setAsciiStream(java.sql.PreparedStatement stmnt,
                           int idx,
                           java.io.InputStream val,
                           int length)
                    throws java.sql.SQLException
Set the given value as a parameter to the statement.

java.sql.SQLException

setBigDecimal

public void setBigDecimal(java.sql.PreparedStatement stmnt,
                          int idx,
                          java.math.BigDecimal val)
                   throws java.sql.SQLException
Set the given value as a parameter to the statement.

java.sql.SQLException

setBigInteger

public void setBigInteger(java.sql.PreparedStatement stmnt,
                          int idx,
                          java.math.BigInteger val)
                   throws java.sql.SQLException
Set the given value as a parameter to the statement.

java.sql.SQLException

setBinaryStream

public void setBinaryStream(java.sql.PreparedStatement stmnt,
                            int idx,
                            java.io.InputStream val,
                            int length)
                     throws java.sql.SQLException
Set the given value as a parameter to the statement.

java.sql.SQLException

setBlob

public void setBlob(java.sql.PreparedStatement stmnt,
                    int idx,
                    java.sql.Blob val)
             throws java.sql.SQLException
Set the given value as a parameter to the statement.

java.sql.SQLException

setBlobObject

public void setBlobObject(java.sql.PreparedStatement stmnt,
                          int idx,
                          java.lang.Object val)
                   throws java.sql.SQLException
Set the given value as a parameter to the statement.

java.sql.SQLException

setBoolean

public void setBoolean(java.sql.PreparedStatement stmnt,
                       int idx,
                       boolean val)
                throws java.sql.SQLException
Set the given value as a parameter to the statement.

java.sql.SQLException

setByte

public void setByte(java.sql.PreparedStatement stmnt,
                    int idx,
                    byte val)
             throws java.sql.SQLException
Set the given value as a parameter to the statement.

java.sql.SQLException

setBytes

public void setBytes(java.sql.PreparedStatement stmnt,
                     int idx,
                     byte[] val)
              throws java.sql.SQLException
Set the given value as a parameter to the statement.

java.sql.SQLException

setChar

public void setChar(java.sql.PreparedStatement stmnt,
                    int idx,
                    char val)
             throws java.sql.SQLException
Set the given value as a parameter to the statement.

java.sql.SQLException

setCharacterStream

public void setCharacterStream(java.sql.PreparedStatement stmnt,
                               int idx,
                               java.io.Reader val,
                               int length)
                        throws java.sql.SQLException
Set the given value as a parameter to the statement.

java.sql.SQLException

setClob

public void setClob(java.sql.PreparedStatement stmnt,
                    int idx,
                    java.sql.Clob val)
             throws java.sql.SQLException
Set the given value as a parameter to the statement.

java.sql.SQLException

setClobString

public void setClobString(java.sql.PreparedStatement stmnt,
                          int idx,
                          java.lang.String val)
                   throws java.sql.SQLException
Set the given value as a parameter to the statement.

java.sql.SQLException

setDate

public void setDate(java.sql.PreparedStatement stmnt,
                    int idx,
                    java.util.Date val)
             throws java.sql.SQLException
Set the given value as a parameter to the statement. Translates the date to a Timestamp by default.

java.sql.SQLException

setDate

public void setDate(java.sql.PreparedStatement stmnt,
                    int idx,
                    java.sql.Date val,
                    java.util.Calendar cal)
             throws java.sql.SQLException
Set the given value as a parameter to the statement.

java.sql.SQLException

setDouble

public void setDouble(java.sql.PreparedStatement stmnt,
                      int idx,
                      double val)
               throws java.sql.SQLException
Set the given value as a parameter to the statement.

java.sql.SQLException

setFloat

public void setFloat(java.sql.PreparedStatement stmnt,
                     int idx,
                     float val)
              throws java.sql.SQLException
Set the given value as a parameter to the statement.

java.sql.SQLException

setInt

public void setInt(java.sql.PreparedStatement stmnt,
                   int idx,
                   int val)
            throws java.sql.SQLException
Set the given value as a parameter to the statement.

java.sql.SQLException

setLong

public void setLong(java.sql.PreparedStatement stmnt,
                    int idx,
                    long val)
             throws java.sql.SQLException
Set the given value as a parameter to the statement.

java.sql.SQLException

setLocale

public void setLocale(java.sql.PreparedStatement stmnt,
                      int idx,
                      java.util.Locale val)
               throws java.sql.SQLException
Set the given value as a parameter to the statement.

java.sql.SQLException

setNull

public void setNull(java.sql.PreparedStatement stmnt,
                    int idx,
                    int colType)
             throws java.sql.SQLException
Set the given value as a parameters to the statement. The column type will come from Types.

java.sql.SQLException

setObject

public void setObject(java.sql.PreparedStatement stmnt,
                      int idx,
                      java.lang.Object val,
                      int colType)
               throws java.sql.SQLException
Set the given value as a parameters to the statement. The column type will come from Types.

java.sql.SQLException

setRef

public void setRef(java.sql.PreparedStatement stmnt,
                   int idx,
                   java.sql.Ref val)
            throws java.sql.SQLException
Set the given value as a parameter to the statement.

java.sql.SQLException

setShort

public void setShort(java.sql.PreparedStatement stmnt,
                     int idx,
                     short val)
              throws java.sql.SQLException
Set the given value as a parameter to the statement.

java.sql.SQLException

setString

public void setString(java.sql.PreparedStatement stmnt,
                      int idx,
                      java.lang.String val)
               throws java.sql.SQLException
Set the given value as a parameter to the statement.

java.sql.SQLException

setTime

public void setTime(java.sql.PreparedStatement stmnt,
                    int idx,
                    java.sql.Time val,
                    java.util.Calendar cal)
             throws java.sql.SQLException
Set the given value as a parameter to the statement.

java.sql.SQLException

setTimestamp

public void setTimestamp(java.sql.PreparedStatement stmnt,
                         int idx,
                         java.sql.Timestamp val,
                         java.util.Calendar cal)
                  throws java.sql.SQLException
Set the given value as a parameter to the statement.

java.sql.SQLException

getDatePrecision

protected int getDatePrecision()
Set to the precision of timestamps in the data store. Set to one of: NANO, MICRO, MILLI, CENTI, DECI, SEC. Returns MILLI by default.


getJDBCType

public int getJDBCType(int metaTypeCode,
                       boolean lob)
Return the preferred Types constant for the given FieldMapping constant.


getPreferredType

public int getPreferredType(int type)
Return the preferred Types type for the given one. Returns the given type by default.


getJDBCType

public int getJDBCType(java.lang.String typeName)
Return the corresponding JDBC type for a given unhandled type (e.g. for Types.OTHER). Currently, the system will only query on OTHER. Returns Types.OTHER by default.

Parameters:
typeName - corresponds to DatabaseMetaData.getColumns(java.lang.String, java.lang.String, java.lang.String, java.lang.String) TYPE_NAME column

getTypeName

protected java.lang.String getTypeName(com.solarmetric.rd.kodo.impl.jdbc.schema.Column col)
Return the preferred database type for the given column's type from Types. Defaults to using the DBMetaData.


toSelect

public com.solarmetric.rd.kodo.impl.jdbc.schema.SQLBuffer toSelect(com.solarmetric.rd.kodo.impl.jdbc.schema.SQLBuffer select,
                                                                   java.lang.String tables,
                                                                   com.solarmetric.rd.kodo.impl.jdbc.schema.SQLBuffer where,
                                                                   com.solarmetric.rd.kodo.impl.jdbc.schema.SQLBuffer order,
                                                                   boolean distinct,
                                                                   boolean forUpdate)
Create a SELECT statement for this database.


getValidTableName

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

See Also:
makeNameValid(java.lang.String, com.solarmetric.rd.kodo.impl.jdbc.schema.NameSet, int)

getValidColumnName

public java.lang.String getValidColumnName(java.lang.String name,
                                           com.solarmetric.rd.kodo.impl.jdbc.schema.Table table)
Make any necessary changes to the given column name to make it valid for the current DB.

See Also:
makeNameValid(java.lang.String, com.solarmetric.rd.kodo.impl.jdbc.schema.NameSet, int)

getValidPrimaryKeyName

public java.lang.String getValidPrimaryKeyName(java.lang.String name,
                                               com.solarmetric.rd.kodo.impl.jdbc.schema.Table table)
Make any necessary changes to the given primary key name to make it valid for the current DB.

See Also:
makeNameValid(java.lang.String, com.solarmetric.rd.kodo.impl.jdbc.schema.NameSet, int)

getValidForeignKeyName

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

See Also:
makeNameValid(java.lang.String, com.solarmetric.rd.kodo.impl.jdbc.schema.NameSet, int)

getValidIndexName

public java.lang.String getValidIndexName(java.lang.String name,
                                          com.solarmetric.rd.kodo.impl.jdbc.schema.Table table)
Make any necessary changes to the given index name to make it valid for the current DB.

See Also:
makeNameValid(java.lang.String, com.solarmetric.rd.kodo.impl.jdbc.schema.NameSet, int)

makeNameValid

public java.lang.String makeNameValid(java.lang.String name,
                                      com.solarmetric.rd.kodo.impl.jdbc.schema.NameSet set,
                                      int maxLen)
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(com.solarmetric.rd.kodo.impl.jdbc.schema.Table table)
Return a series of SQL statements to create the given table, complete with columns and all constraints. Indexes will be created separately.


getDropTableSQL

public java.lang.String[] getDropTableSQL(com.solarmetric.rd.kodo.impl.jdbc.schema.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.


getCreateIndexSQL

public java.lang.String[] getCreateIndexSQL(com.solarmetric.rd.kodo.impl.jdbc.schema.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(com.solarmetric.rd.kodo.impl.jdbc.schema.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(com.solarmetric.rd.kodo.impl.jdbc.schema.Column column)
Return a series of SQL statements to add the given column to its table. Return an empty array if operation not supported. The DBMetaData is checked for support automatically. Returns ALTER TABLE <table name> ADD (<col dec>) by default.


getDropColumnSQL

public java.lang.String[] getDropColumnSQL(com.solarmetric.rd.kodo.impl.jdbc.schema.Column column)
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.


getAddPrimaryKeySQL

public java.lang.String[] getAddPrimaryKeySQL(com.solarmetric.rd.kodo.impl.jdbc.schema.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(com.solarmetric.rd.kodo.impl.jdbc.schema.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(com.solarmetric.rd.kodo.impl.jdbc.schema.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(com.solarmetric.rd.kodo.impl.jdbc.schema.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(com.solarmetric.rd.kodo.impl.jdbc.schema.Column col,
                                               boolean alter)
Return the declaration SQL for the given column. This method is used for each column from within getCreateTableSQL(com.solarmetric.rd.kodo.impl.jdbc.schema.Table) and getAddColumnSQL(com.solarmetric.rd.kodo.impl.jdbc.schema.Column).


getPrimaryKeyConstraintSQL

protected java.lang.String getPrimaryKeyConstraintSQL(com.solarmetric.rd.kodo.impl.jdbc.schema.PrimaryKey pk)
Return the declaration SQL for the given primary key. This method is used from within getCreateTableSQL(com.solarmetric.rd.kodo.impl.jdbc.schema.Table) and getAddPrimaryKeySQL(com.solarmetric.rd.kodo.impl.jdbc.schema.PrimaryKey). Returns CONSTRAINT <pk name> PRIMARY KEY (<col list>) by default.


getForeignKeyConstraintSQL

protected java.lang.String getForeignKeyConstraintSQL(com.solarmetric.rd.kodo.impl.jdbc.schema.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(com.solarmetric.rd.kodo.impl.jdbc.schema.Table) and getAddForeignKeySQL(com.solarmetric.rd.kodo.impl.jdbc.schema.ForeignKey). Returns CONSTRAINT <cons name> FOREIGN KEY (<col list>) REFERENCES <foreign table> (<col list>) [ON DELETE <action>] by default.


getForeignKeyActionName

protected java.lang.String getForeignKeyActionName(int action)
Return the action SQL for the given foreign key. Return null if no action SQL should be specified (if the database default should be used). By default, returns CASCADE for ForeignKey.ACTION_CASCADE, SET NULL for ForeignKey.ACTION_NULL, SET DEFAULT for ForeignKey.ACTION_DEFAULT, and null for ForeignKey.ACTION_EXCEPTION. Any other action causes an IllegalArgumentException.


generateTables

public boolean generateTables(com.solarmetric.rd.kodo.impl.jdbc.schema.SchemaGroup group,
                              java.lang.String schemaName,
                              java.lang.String tableName,
                              java.sql.Connection conn,
                              java.sql.DatabaseMetaData meta)
                       throws java.sql.SQLException
By default, the SchemaGenerator uses JDBC database metadata to reflect on the schema. If this method is implemented, it will be used instead. Return true if this method is implemented. Returns false by default.

Parameters:
group - the schema group to add tables to
schemaName - the name pattern of the schema(s) to generate, or null for all schemas
tableName - the name pattern of the table(s) to generate, or null for all tables
java.sql.SQLException

generatePrimaryKeys

public boolean generatePrimaryKeys(com.solarmetric.rd.kodo.impl.jdbc.schema.SchemaGroup group,
                                   java.lang.String schemaName,
                                   java.lang.String tableName,
                                   java.sql.Connection conn,
                                   java.sql.DatabaseMetaData meta)
                            throws java.sql.SQLException
By default, the SchemaGenerator uses JDBC database metadata to reflect on the schema. If this method is implemented, it will be used instead. Return true if this method is implemented. Returns false by default.

Parameters:
group - the schema group to add primary keys to
schemaName - the name pattern of the schema(s) to generate, or null for all schemas
tableName - the name pattern of the table(s) to generate, or null for all tables
java.sql.SQLException

generateIndexes

public boolean generateIndexes(com.solarmetric.rd.kodo.impl.jdbc.schema.SchemaGroup group,
                               java.lang.String schemaName,
                               java.lang.String tableName,
                               java.sql.Connection conn,
                               java.sql.DatabaseMetaData meta)
                        throws java.sql.SQLException
By default, the SchemaGenerator uses JDBC database metadata to reflect on the schema. If this method is implemented, it will be used instead. Return true if this method is implemented. Returns false by default.

Parameters:
group - the schema group to add indexes to
schemaName - the name pattern of the schema(s) to generate, or null for all schemas
tableName - the name pattern of the table(s) to generate, or null for all tables
java.sql.SQLException

generateForeignKeys

public boolean generateForeignKeys(com.solarmetric.rd.kodo.impl.jdbc.schema.SchemaGroup group,
                                   java.lang.String schemaName,
                                   java.lang.String tableName,
                                   java.sql.Connection conn,
                                   java.sql.DatabaseMetaData meta)
                            throws java.sql.SQLException
By default, the SchemaGenerator uses JDBC database metadata to reflect on the schema. If this method is implemented, it will be used instead. Return true if this method is implemented. Returns false by default.

Parameters:
group - the schema group to add foreign keys to
schemaName - the name pattern of the schema(s) to generate, or null for all schemas
tableName - the name pattern of the table(s) to generate, or null for all tables
java.sql.SQLException

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

isSystemIndex

public boolean isSystemIndex(java.lang.String name,
                             com.solarmetric.rd.kodo.impl.jdbc.schema.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

replaceMapping

public com.solarmetric.rd.kodo.impl.jdbc.meta.FieldMapping replaceMapping(com.solarmetric.rd.kodo.impl.jdbc.meta.FieldMapping mapping)
Replace the given mapping with one suited to this database, or return the original if no replacement is needed. Returns the original by default.


replaceMappingFactory

public com.solarmetric.rd.kodo.impl.jdbc.meta.MappingFactory replaceMappingFactory(com.solarmetric.rd.kodo.impl.jdbc.meta.MappingFactory factory)
Replace the given factory with one suited to this database, or return the original if no replacement is needed. Returns the original by default.


replaceSchemaFactory

public com.solarmetric.rd.kodo.impl.jdbc.schema.SchemaFactory replaceSchemaFactory(com.solarmetric.rd.kodo.impl.jdbc.schema.SchemaFactory factory)
Replace the given factory with one suited to this database, or return the original if no replacement is needed. Returns the original by default.


wrapConnection

public java.sql.Connection wrapConnection(java.sql.Connection conn)
Wrap the given connection if needed. Some databases require special handling for JDBC bugs. If this method is overridden, it should wrap the connection returned by super.wrapConnection rather than the original connection argument. By default, the connection is wrapped in a special connection type that always uses scrollable result sets (but only if the database supports it and the configuration's DefaultFetchThreshold is not -1).


SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool

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