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

Constructor Index

 o DMLGenerator(DatabaseMetaData)
Construct a new DMLGenerator.

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)
 o getInsert(Table, Column[])
Returns an INSERT SQL string for the given table.
 o getSelect(Table, Key)
Returns a "SELECT key WHERE key = ?" SQL string for a given table.
 o getSelect(Table, Key, Column[])
Returns a "SELECT cols WHERE Key = ?" SQL string for a given table.
 o getSelect(Table, Key, OrderInfo)
Returns a "SELECT * WHERE key = ? ORDER BY ?" SQL string for a given table.
 o getSelect(Table, Key, String, OrderInfo)
Returns a "SELECT * WHERE Key = ? AND <where> ORDER BY ?" SQL string for a given table
 o getTableName(Table)
Returns a properly quoted (with schema, catalog if necessary) table name.
 o getUpdate(Table, Key, Column[])
Returns an UPDATE SQL string for a given table, key, and set of columns.

Constructors

 o 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.

Methods

 o getInsert
 public String getInsert(Table t)
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 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 constraint. May be null.
Returns:
The DELETE string.
 o 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