com.novell.nds.dirxml.driver.jdbc.db.lock
Interface DBLockStatementGenerator

All Known Implementing Classes:
DBLockGenerator

public interface DBLockStatementGenerator

Database-independent interface used to generate proprietary SQL locking statements based upon a pending standardized SQL DML statement.

Implementations should generate the appropriate locking statement(s) that will obtain database locks necessary to prevent blocking of a pending SQL statement.

All subclasses MUST have a public constructor with no parameters.


Field Summary
static DBLock EMPTY_LOCK
          An immutable lock that contains no statements.
static String TYPE_TABLE
           
static String TYPE_VIEW
           
 
Method Summary
 void addListedColumn(String columnName)
          Method for caller to supply columns that are listed as part of a pending SELECT, INSERT or UPDATE statement.
 void addPrimaryKeyColumn(String columnName)
          Method for caller to supply table primary key info for the table referenced in the pending SQL statement.
 void addWhereColumn(String columnName)
          Method for caller to supply columns that are listed as part of the WHERE clause for a pending SELECT, UPDATE, or DELETE statement.
 DBLock generateDeleteLock()
          Method for caller to request the appropriate database lock for a pending DELETE statement.
 DBLock generateInsertLock()
          Method for caller to request the appropriate database lock for a pending INSERT statement.
 DBLock generateSelectLock()
          Method for caller to request the appropriate database lock for a pending SELECT statement.
 DBLock generateUpdateLock()
          Method for caller to request the appropriate database lock for a pending UPDATE statement.
 void reset()
          Method for caller to reset the state of this generator for use with another pending SQL statement.
 void setTable(String tableName, String tableType)
          Method for caller to supply table name and type info for the pending SQL statement.
 void setWhereClause(String whereClause)
          Method for caller to supply the WHERE clause signature of the pending SELECT, UPDATE, or DELETE statement.
 

Field Detail

EMPTY_LOCK

public static final DBLock EMPTY_LOCK
An immutable lock that contains no statements.


TYPE_TABLE

public static final String TYPE_TABLE
See Also:
Constant Field Values

TYPE_VIEW

public static final String TYPE_VIEW
See Also:
Constant Field Values
Method Detail

setTable

public void setTable(String tableName,
                     String tableType)
Method for caller to supply table name and type info for the pending SQL statement.

Parameters:
tableName - will not be null, empty string, or whitespace
tableType - will be one of the TYPE values defined as part of this interface

addPrimaryKeyColumn

public void addPrimaryKeyColumn(String columnName)
Method for caller to supply table primary key info for the table referenced in the pending SQL statement.

Parameters:
columnName - will not be null, empty string, or whitespace

addListedColumn

public void addListedColumn(String columnName)
Method for caller to supply columns that are listed as part of a pending SELECT, INSERT or UPDATE statement.

Parameters:
columnName - will not be null, empty string, or whitespace

addWhereColumn

public void addWhereColumn(String columnName)
Method for caller to supply columns that are listed as part of the WHERE clause for a pending SELECT, UPDATE, or DELETE statement.

Parameters:
columnName - will not be null, empty string, or whitespace

setWhereClause

public void setWhereClause(String whereClause)
Method for caller to supply the WHERE clause signature of the pending SELECT, UPDATE, or DELETE statement.

This should be appened as-is if the lock statement being generated requires a WHERE clause. The caller will set parameter values.

Parameters:
whereClause - contains a single whitespace character before the word WHERE; will not be null, empty string, or whitespace

generateSelectLock

public DBLock generateSelectLock()
Method for caller to request the appropriate database lock for a pending SELECT statement.

This method is currently not invoked in any rt. Its use is reserved for future use.

Returns:
should not return null

generateInsertLock

public DBLock generateInsertLock()
Method for caller to request the appropriate database lock for a pending INSERT statement.

Returns:
should not return null

generateUpdateLock

public DBLock generateUpdateLock()
Method for caller to request the appropriate database lock for a pending UPDATE statement.

Returns:
should not return null

generateDeleteLock

public DBLock generateDeleteLock()
Method for caller to request the appropriate database lock for a pending DELETE statement.

Returns:
should not return null

reset

public void reset()
Method for caller to reset the state of this generator for use with another pending SQL statement.