edu.jhu.tmaj.database.sql
Interface SQLMaker

All Known Implementing Classes:
GeneralSQLMaker, OracleSQLMaker

public interface SQLMaker

Turns SQL objects into database-ready sql. The sql strings that are returned by this function are then ready to be run on the database.
Example-- getDeleteSQL(a_delete_SQL_Object) would return something like:
DELETE FROM Users WHERE UserID=53
The SQL statement generated will differ slightly among databases.

Different databases have to implement their own SQLMaker. This is because, for example, an UpdateSQL object may contain a field called BirthDate. The actual SQL that is generated from this UpdateSQL object will be different between databases as dates are often handled differently. So for sybase you might see the UpdateSQL statement get turned into:
UPDATE Employees SET BirthDate='1978-04-31' WHERE EmployeeID=1
where for oracle it might be turned into:
UPDATE Employees SET BirthDate=to_db_date(1978,4,31) WHERE EmployeeID=1


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.
 java.lang.String getSelectSQL(SelectSQL selectSQL)
          Returns a SELECT SQL string that is ready to be run on the database.
 java.lang.String getUpdateSQL(UpdateSQL updateSQL)
          Returns a UPDATE SQL string that is ready to be run on the database.
 

Method Detail

getInsertSQL

TwoSQLStatements getInsertSQL(InsertSQL insertSQL)
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.


getSelectSQL

java.lang.String getSelectSQL(SelectSQL selectSQL)
Returns a SELECT SQL string that is ready to be run on the database.


getUpdateSQL

java.lang.String getUpdateSQL(UpdateSQL updateSQL)
Returns a UPDATE SQL string that is ready to be run on the database.


getDeleteSQL

java.lang.String getDeleteSQL(DeleteSQL deleteSQL)
Returns a DELETE SQL string that is ready to be run on the database.