public interface DBLockStatementGenerator
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.
Modifier and Type | Field and Description |
---|---|
static DBLock |
EMPTY_LOCK
An immutable lock that contains no statements.
|
static java.lang.String |
TYPE_TABLE |
static java.lang.String |
TYPE_VIEW |
Modifier and Type | Method and Description |
---|---|
void |
addListedColumn(java.lang.String columnName)
Method for caller to supply columns that are listed
as part of a pending SELECT, INSERT or UPDATE statement.
|
void |
addPrimaryKeyColumn(java.lang.String columnName)
Method for caller to supply table primary key info
for the table referenced in the pending SQL statement.
|
void |
addWhereColumn(java.lang.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(java.lang.String tableName,
java.lang.String tableType)
Method for caller to supply table name and type info
for the pending SQL statement.
|
void |
setWhereClause(java.lang.String whereClause)
Method for caller to supply the WHERE clause signature
of the pending SELECT, UPDATE, or DELETE statement.
|
static final DBLock EMPTY_LOCK
static final java.lang.String TYPE_TABLE
static final java.lang.String TYPE_VIEW
void setTable(java.lang.String tableName, java.lang.String tableType)
tableName
- will not be null
,
empty string, or whitespacetableType
- will be one of the TYPE
values
defined as part of this interfacevoid addPrimaryKeyColumn(java.lang.String columnName)
columnName
- will not be null
,
empty string, or whitespacevoid addListedColumn(java.lang.String columnName)
columnName
- will not be null
,
empty string, or whitespacevoid addWhereColumn(java.lang.String columnName)
columnName
- will not be null
,
empty string, or whitespacevoid setWhereClause(java.lang.String whereClause)
This should be appened as-is if the lock statement being generated requires a WHERE clause. The caller will set parameter values.
whereClause
- contains a single whitespace character
before the word WHERE; will not be null
,
empty string, or whitespaceDBLock generateSelectLock()
This method is currently not invoked in any rt. Its use is reserved for future use.
null
DBLock generateInsertLock()
null
DBLock generateUpdateLock()
null
DBLock generateDeleteLock()
null
void reset()