All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class org.xmlmiddleware.xmldbms.datahandlers.SQLStrings

java.lang.Object
   |
   +----org.xmlmiddleware.xmldbms.datahandlers.SQLStrings

public class SQLStrings
extends Object
Get SELECT, UPDATE, INSERT, and DELETE strings.

The class caches all strings except UPDATE strings, calling DMLGenerator to generate new strings as needed.

Version:
2.0
Author:
Sean Walter, 2001
See Also:
DMLGenerator

Constructor Index

 o SQLStrings(Connection)
Construct a new SQLStrings.
 o SQLStrings(DMLGenerator)
Construct a new SQLStrings.

Method Index

 o getDelete(Table, Key)
Returns a DELETE SQL string for a given table.
 o getDeleteWhere(Table, Key, String)
Returns a "DELETE FROM Table WHERE key = ? AND <where>" SQL string for a given table.
 o getInsert(Table)
Returns an INSERT SQL string for the given table.
 o getSelectKey(Table, Key)
Returns a "SELECT key WHERE key = ?" SQL string for a given table.
 o getSelectRow(Table, Key, OrderInfo)
Returns a "SELECT * WHERE key = ? ORDER BY ?" SQL string for a given table.
 o getSelectWhere(Table, Key, String, OrderInfo)
Returns a "SELECT * WHERE key = ? AND <where> ORDER BY ?" SQL string for a given table.
 o getUpdate(Table, Key, Column[])
Returns an UPDATE SQL string for a given table, key, and set of columns.

Constructors

 o SQLStrings
 public SQLStrings(Connection conn) throws SQLException
Construct a new SQLStrings.

Parameters:
conn - A database connection. This is used to get database metadata.
Throws: SQLException
Thrown if a database exception occurs while getting the database metadata.
 o SQLStrings
 public SQLStrings(DMLGenerator dml)
Construct a new SQLStrings.

Parameters:
dml - A DMLGenerator.

Methods

 o getInsert
 public String getInsert(Table t)
Returns an INSERT SQL string for the given table.

Parameters:
t - The table. Must not be null.
Returns:
The INSERT string.
 o getSelectRow
 public String getSelectRow(Table t,
                            Key key,
                            OrderInfo order)
Returns a "SELECT * WHERE key = ? ORDER BY ?" SQL string for a given table.

Parameters:
t - The table to select from. Must not be null.
key - The key to restrict with.
order - The sort information. May be null.
Returns:
The SELECT string.
 o getSelectKey
 public String getSelectKey(Table t,
                            Key key)
Returns a "SELECT key WHERE key = ?" SQL string for a given table.

Parameters:
t - The table to select from. Must not be null.
key - The key to restrict with.
Returns:
The SELECT string.
 o getSelectWhere
 public String getSelectWhere(Table t,
                              Key key,
                              String where,
                              OrderInfo order)
Returns a "SELECT * WHERE key = ? AND <where> ORDER BY ?" SQL string for a given table.

Parameters:
t - The table to select from. Must not be null.
key - The key to restrict with. May be null.
where - An additional where clause. May be null.
order - The sort information. May be null.
Returns:
The SELECT string.
 o getUpdate
 public String getUpdate(Table t,
                         Key key,
                         Column cols[])
Returns an UPDATE SQL string for a given table, key, and set of columns.

Parameters:
t - The table to update. Must not be null.
key - The key to restrict with. Must not be null.
cols - The columns to update. If this is null, all columns are included.
Returns:
The UPDATE string.
 o getDelete
 public String getDelete(Table t,
                         Key key)
Returns a DELETE SQL string for a given table.

Parameters:
t - The table to delete from. Must not be null.
key - The key to restrict with. Must not be null.
Returns:
The DELETE string.
 o getDeleteWhere
 public String getDeleteWhere(Table t,
                              Key key,
                              String where)
Returns a "DELETE FROM Table WHERE key = ? AND <where>" SQL string for a given table.

Parameters:
t - The table to select from. Must not be null.
key - The key to restrict with. May be null.
where - An additional where clause. May be null.
Returns:
The DELETE string.

All Packages  Class Hierarchy  This Package  Previous  Next  Index