All Packages Class Hierarchy This Package Previous Next Index
Class org.xmlmiddleware.xmldbms.maps.utils.DMLGenerator
java.lang.Object
|
+----org.xmlmiddleware.xmldbms.maps.utils.DMLGenerator
- public class DMLGenerator
- extends Object
Generate SELECT, UPDATE, INSERT, and DELETE strings.
- Version:
- 2.0
- Author:
- Sean Walter, 2001
-
DMLGenerator(DatabaseMetaData)
- Construct a new DMLGenerator.
-
getDelete(Table, Key)
- Returns a DELETE SQL string for a given table.
-
getDeleteWhere(Table, Key, String)
-
Returns a "DELETE FROM Table WHERE Key = ? AND <where>"
SQL string for a given table
-
getInsert(Table)
-
-
getInsert(Table, Column[])
- Returns an INSERT SQL string for the given table.
-
getSelect(Table, Key)
- Returns a "SELECT key WHERE key = ?" SQL string for a given table.
-
getSelect(Table, Key, Column[])
- Returns a "SELECT cols WHERE Key = ?" SQL string for a given table.
-
getSelect(Table, Key, OrderInfo)
- Returns a "SELECT * WHERE key = ? ORDER BY ?" SQL string for a
given table.
-
getSelect(Table, Key, String, OrderInfo)
-
Returns a "SELECT * WHERE Key = ? AND <where> ORDER BY ?"
SQL string for a given table
-
getTableName(Table)
-
Returns a properly quoted (with schema, catalog if
necessary) table name.
-
getUpdate(Table, Key, Column[])
- Returns an UPDATE SQL string for a given table, key, and set of columns.
DMLGenerator
public DMLGenerator(DatabaseMetaData meta) throws SQLException
- Construct a new DMLGenerator.
- Parameters:
- meta - A DatabaseMetaData object.
- SQLException - Thrown if an error occurs retrieving database metadata.
getInsert
public String getInsert(Table t)
getInsert
public String getInsert(Table t,
Column cols[])
- Returns an INSERT SQL string for the given table.
- Parameters:
- t - The table. Must not be null.
- Returns:
- The INSERT string.
getSelect
public String getSelect(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.
getSelect
public String getSelect(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.
getSelect
public String getSelect(Table t,
Key key,
Column cols[])
- Returns a "SELECT cols 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.
- cols - The columns to select.
- Returns:
- The SELECT string.
getSelect
public String getSelect(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 constraint. May be null.
- order - The sort information. May be null.
- Returns:
- The SELECT string.
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.
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.
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 constraint. May be null.
- Returns:
- The DELETE string.
getTableName
public String getTableName(Table table)
- Returns a properly quoted (with schema, catalog if
necessary) table name.
- Parameters:
- table - The table.
All Packages Class Hierarchy This Package Previous Next Index