net.java.ao.db
Class ClientDerbyDatabaseProvider

java.lang.Object
  extended by net.java.ao.DatabaseProvider
      extended by net.java.ao.db.ClientDerbyDatabaseProvider

public class ClientDerbyDatabaseProvider
extends DatabaseProvider

Author:
Daniel Spiewak

Constructor Summary
ClientDerbyDatabaseProvider(java.lang.String uri, java.lang.String username, java.lang.String password)
           
 
Method Summary
protected  boolean considerPrecision(DDLField field)
           
protected  java.lang.String convertTypeToString(DatabaseType<?> type)
           
 java.lang.Class<? extends java.sql.Driver> getDriverClass()
          Returns the JDBC Driver class which corresponds to the database being abstracted.
 java.sql.ResultSet getTables(java.sql.Connection conn)
           
protected  java.lang.String getTriggerNameForField(DDLTable table, DDLField field)
           
 java.lang.Object parseValue(int type, java.lang.String value)
          Parses the database-agnostic String value relevant to the specified SQL type in int form (as defined by Types and returns the Java value which corresponds.
protected  java.lang.String[] renderAlterTableChangeColumn(DDLTable table, DDLField oldField, DDLField field)
           
protected  java.lang.String renderAutoIncrement()
          Generates the DDL fragment required to specify an INTEGER field as auto-incremented.
protected  java.lang.String renderOnUpdate(DDLField field)
           
protected  java.lang.String renderQueryLimit(Query query)
           
protected  java.lang.String renderTriggerForField(DDLTable table, DDLField field)
           
protected  void setPostConnectionProperties(java.sql.Connection conn)
           
 void setQueryResultSetProperties(java.sql.ResultSet res, Query query)
           
 void setQueryStatementProperties(java.sql.Statement stmt, Query query)
           
 
Methods inherited from class net.java.ao.DatabaseProvider
dispose, executeInsertReturningKeys, getConnection, getConnectionImpl, getDateFormat, getFunctionNameForField, getInstance, getInstance, getPassword, getURI, getUsername, insertReturningKeys, isNumericType, renderAction, renderAlterTableAddColumn, renderAlterTableAddKey, renderAlterTableDropColumn, renderAlterTableDropKey, renderAppend, renderCalendar, renderConstraintsForTable, renderDropFunctions, renderDropTable, renderDropTriggers, renderField, renderFieldType, renderForeignKey, renderFunction, renderFunctionForField, renderFunctions, renderQuery, renderQueryGroupBy, renderQueryJoins, renderQueryOrderBy, renderQuerySelect, renderQueryWhere, renderTable, renderTriggers, renderUnique, renderValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientDerbyDatabaseProvider

public ClientDerbyDatabaseProvider(java.lang.String uri,
                                   java.lang.String username,
                                   java.lang.String password)
Method Detail

getDriverClass

public java.lang.Class<? extends java.sql.Driver> getDriverClass()
                                                          throws java.lang.ClassNotFoundException
Description copied from class: DatabaseProvider

Returns the JDBC Driver class which corresponds to the database being abstracted. This should be implemented in such a way as to initialize and register the driver with JDBC. For most drivers, this requires code in the following form:

public Class<? extends Driver> getDriverClass() {
     return (Class<? extends Driver>) Class.forName("com.mysql.jdbc.Driver");
 }

The following does not fire the driver's static initializer and thus will (usually) not work:

public Class<? extends Driver> getDriverClass() {
     return com.mysql.jdbc.Driver.class;
 }

If the driver is not on the classpath, a ClassNotFoundException can and should be thrown (certain auto-magic configuration sections of ActiveObjects depend upon this under certain circumstances).

Specified by:
getDriverClass in class DatabaseProvider
Throws:
java.lang.ClassNotFoundException

setPostConnectionProperties

protected void setPostConnectionProperties(java.sql.Connection conn)
                                    throws java.sql.SQLException
Throws:
java.sql.SQLException

setQueryStatementProperties

public void setQueryStatementProperties(java.sql.Statement stmt,
                                        Query query)
                                 throws java.sql.SQLException
Overrides:
setQueryStatementProperties in class DatabaseProvider
Throws:
java.sql.SQLException

setQueryResultSetProperties

public void setQueryResultSetProperties(java.sql.ResultSet res,
                                        Query query)
                                 throws java.sql.SQLException
Overrides:
setQueryResultSetProperties in class DatabaseProvider
Throws:
java.sql.SQLException

getTables

public java.sql.ResultSet getTables(java.sql.Connection conn)
                             throws java.sql.SQLException
Overrides:
getTables in class DatabaseProvider
Throws:
java.sql.SQLException

parseValue

public java.lang.Object parseValue(int type,
                                   java.lang.String value)
Description copied from class: DatabaseProvider

Parses the database-agnostic String value relevant to the specified SQL type in int form (as defined by Types and returns the Java value which corresponds. This method is completely database-agnostic, as are all of all of its delegate methods.

WARNING: This method is being considered for removal to another class (perhaps TypeManager?) as it is not a database-specific function and thus confuses the purpose of this class. Do not rely upon it heavily. (better yet, don't rely on it at all from external code. It's not designed to be part of the public API)

Overrides:
parseValue in class DatabaseProvider
Parameters:
type - The JDBC integer type of the database field against which to parse the value.
value - The database-agnostic String value to parse into a proper Java object with respect to the specified SQL type.

renderQueryLimit

protected java.lang.String renderQueryLimit(Query query)
Overrides:
renderQueryLimit in class DatabaseProvider

convertTypeToString

protected java.lang.String convertTypeToString(DatabaseType<?> type)
Overrides:
convertTypeToString in class DatabaseProvider

renderAutoIncrement

protected java.lang.String renderAutoIncrement()
Description copied from class: DatabaseProvider

Generates the DDL fragment required to specify an INTEGER field as auto-incremented. For databases which do not support such flags (which is just about every database exception MySQL), "" is an acceptable return value. This method should never return null as it would cause the field rendering method to throw a NullPointerException.

This method is abstract (as opposed to the other methods which are either defined against MySQL or simply empty) because of the vast differences in rendering auto-incremented fields across different databases. Also, it seemed like a terribly good idea at the time and I haven't found a compelling reason to change it.

Specified by:
renderAutoIncrement in class DatabaseProvider

renderOnUpdate

protected java.lang.String renderOnUpdate(DDLField field)
Overrides:
renderOnUpdate in class DatabaseProvider

renderTriggerForField

protected java.lang.String renderTriggerForField(DDLTable table,
                                                 DDLField field)
Overrides:
renderTriggerForField in class DatabaseProvider

getTriggerNameForField

protected java.lang.String getTriggerNameForField(DDLTable table,
                                                  DDLField field)
Overrides:
getTriggerNameForField in class DatabaseProvider

considerPrecision

protected boolean considerPrecision(DDLField field)
Overrides:
considerPrecision in class DatabaseProvider

renderAlterTableChangeColumn

protected java.lang.String[] renderAlterTableChangeColumn(DDLTable table,
                                                          DDLField oldField,
                                                          DDLField field)
Overrides:
renderAlterTableChangeColumn in class DatabaseProvider