edu.jhu.tmaj.database.sql
Class GeneralSQLMaker

java.lang.Object
  extended by edu.jhu.tmaj.database.sql.GeneralSQLMaker
All Implemented Interfaces:
SQLMaker
Direct Known Subclasses:
OracleSQLMaker

public class GeneralSQLMaker
extends java.lang.Object
implements SQLMaker

A SQLMaker that provides the typical functionality for most databases. SybaseSQLMaker and OracleSQLMaker subclass this to handle the specifics of converting a SQL object into a SQL String.


Field Summary
(package private) static java.lang.String NULL_STRING
           
 
Constructor Summary
GeneralSQLMaker()
           
 
Method Summary
 java.lang.String getDeleteSQL(DeleteSQL deleteSQL)
          Returns a DELETE SQL string that is ready to be run on the database.
 TwoSQLStatements getInsertSQL(InsertSQL insertSQL)
          Returns a INSERT SQL string that is ready to be run on the database.
static GeneralSQLMaker getInstance()
          Returns a SQLMaker suitable for most databases (except Oracle.)
 java.lang.String getSelectSQL(SelectSQL selectSQL)
          Returns a SELECT SQL string that is ready to be run on the database.
protected  java.lang.String getSQLValue(DatabaseField databaseField, java.lang.Object obj)
          Get a sql-ready string given a java object.
 java.lang.String getTableName(java.lang.String tableName)
          Gets the sql-ready tablename given the table-name that tmaj uses.
 java.lang.String getUpdateSQL(UpdateSQL updateSQL)
          Returns a UPDATE SQL string that is ready to be run on the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL_STRING

static final java.lang.String NULL_STRING
See Also:
Constant Field Values
Constructor Detail

GeneralSQLMaker

public GeneralSQLMaker()
Method Detail

getInstance

public static GeneralSQLMaker getInstance()
Returns a SQLMaker suitable for most databases (except Oracle.)


getSelectSQL

public java.lang.String getSelectSQL(SelectSQL selectSQL)
Description copied from interface: SQLMaker
Returns a SELECT SQL string that is ready to be run on the database.

Specified by:
getSelectSQL in interface SQLMaker

getTableName

public java.lang.String getTableName(java.lang.String tableName)
Gets the sql-ready tablename given the table-name that tmaj uses.


getInsertSQL

public TwoSQLStatements getInsertSQL(InsertSQL insertSQL)
Description copied from interface: SQLMaker
Returns a INSERT SQL string that is ready to be run on the database. In addition, a SELECT statement is also included in TwoSQLStatements. See TwoSQLStatements for more details.

Specified by:
getInsertSQL in interface SQLMaker

getDeleteSQL

public java.lang.String getDeleteSQL(DeleteSQL deleteSQL)
Description copied from interface: SQLMaker
Returns a DELETE SQL string that is ready to be run on the database.

Specified by:
getDeleteSQL in interface SQLMaker

getUpdateSQL

public java.lang.String getUpdateSQL(UpdateSQL updateSQL)
Description copied from interface: SQLMaker
Returns a UPDATE SQL string that is ready to be run on the database.

Specified by:
getUpdateSQL in interface SQLMaker

getSQLValue

protected java.lang.String getSQLValue(DatabaseField databaseField,
                                       java.lang.Object obj)
Get a sql-ready string given a java object. If the java object is a String such as "my house", the returned string would be "'my house'". If the java object is an Integer such as new Integer(5), 5 would be returned.