|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.objectweb.cjdbc.sql.AbstractRequest
org.objectweb.cjdbc.sql.AbstractWriteRequest
org.objectweb.cjdbc.sql.DeleteRequest
An DeleteRequest is an SQL request with the following
syntax:
DELETE FROM table-name WHERE search-condition
| Field Summary | |
private java.util.ArrayList |
from
ArrayList of String objects |
private boolean |
isUnique
true if this query only deletes a single row. |
protected java.util.ArrayList |
whereValues
ArrayList of values String associated with
the unique columns involved in this delete query.
|
| Fields inherited from class org.objectweb.cjdbc.sql.AbstractWriteRequest |
blocking, columns, tableName |
| Fields inherited from class org.objectweb.cjdbc.sql.AbstractRequest |
cacheable, escapeProcessing, id, isAutoCommit, isParsed, isReadOnly, login, maxRows, sqlQuery, sqlSkeleton, timeout, transactionId |
| Constructor Summary | |
DeleteRequest(java.lang.String sqlQuery,
boolean escapeProcessing,
int timeout)
Creates a new DeleteRequest instance. |
|
DeleteRequest(java.lang.String sqlQuery,
boolean escapeProcessing,
int timeout,
DatabaseSchema schema,
int granularity,
boolean isCaseSensitive)
Creates a new DeleteRequest instance. |
|
| Method Summary | |
void |
cloneParsing(AbstractRequest request)
Clones the parsing of a request. |
void |
debug()
Displays some debugging information about this request. |
private java.util.ArrayList |
getFromTables(java.lang.String fromClause,
DatabaseSchema dbs)
Extracts the tables from the given FROM clause and retrieves
their alias if any. |
java.util.ArrayList |
getValues()
Returns an ArrayList of String
objects representing the values associated with the unique
columns involved in this request. |
private java.util.ArrayList |
getWhereColumns(java.lang.String whereClause,
java.util.ArrayList aliasedFrom)
Gets all the columns involved in the given WHERE clause.
|
private java.util.ArrayList |
getWhereColumnsAndBuildValues(java.lang.String whereClause,
java.util.ArrayList aliasedFrom)
Gets all the columns involved in the given WHERE clause and
builds the values associated with UNIQUE columns.
|
boolean |
isCreate()
Returns true if this request in a CREATE
statement. |
boolean |
isDelete()
Returns true if this request in a DELETE
statement. |
boolean |
isDrop()
Returns true if this request in a DROP
statement. |
boolean |
isInsert()
Returns true if this request in an INSERT
statement. |
boolean |
isUnique()
Returns true if this query only deletes a single row. |
boolean |
isUpdate()
Returns true if this request in an UPDATE
statement. |
void |
parse(DatabaseSchema schema,
int granularity,
boolean isCaseSensitive)
Parses the SQL request and extracts the selected columns and tables given the DatabaseSchema of the database
targeted by this request.
|
| Methods inherited from class org.objectweb.cjdbc.sql.AbstractWriteRequest |
cloneTableNameAndColumns, getColumns, getTableName, isReadRequest, isUnknownRequest, isWriteRequest, mightBlock, setBlocking |
| Methods inherited from class org.objectweb.cjdbc.sql.AbstractRequest |
equals, getCacheAbility, getEscapeProcessing, getId, getLogin, getMaxRows, getSQL, getSqlSkeleton, getTimeout, getTransactionId, isAutoCommit, isParsed, isReadOnly, setCacheAbility, setId, setIsAutoCommit, setIsReadOnly, setLogin, setMaxRows, setSQL, setSqlSkeleton, setTimeout, setTransactionId, trimCarriageReturn |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private boolean isUnique
true if this query only deletes a single row.
private java.util.ArrayList from
ArrayList of String objects
protected java.util.ArrayList whereValues
ArrayList of values String associated with
the unique columns involved in this delete query.
The values instance variable is only used when a
COLUMN_UNIQUE_DELETE granularity is applied.
Here, the DELETE request is UNIQUE: all columns of the WHERE clause are
UNIQUE and used in the left part of an equality.
When such a granularity is used, the columns instance variable
contains only UNIQUE columns.
CachingGranularities| Constructor Detail |
public DeleteRequest(java.lang.String sqlQuery,
boolean escapeProcessing,
int timeout,
DatabaseSchema schema,
int granularity,
boolean isCaseSensitive)
throws java.sql.SQLException
DeleteRequest instance. The caller must give an
SQL request, without any leading or trailing spaces and beginning with
'delete from ' (it will not be checked).
If the syntax is incorrect an exception is thrown.
sqlQuery - the SQL requestescapeProcessing - should the driver to escape processing
before sending to the database ?timeout - an int valueschema - a DatabaseSchema valuegranularity - parsing granularity as defined in
ParsingGranularitiesisCaseSensitive - true if parsing is case sensitive
java.sql.SQLException - if an error occurs
public DeleteRequest(java.lang.String sqlQuery,
boolean escapeProcessing,
int timeout)
DeleteRequest instance. The caller must give an
SQL request, without any leading or trailing spaces and beginning with
'delete from ' (it will not be checked).
The request is not parsed but it can be done later
by a call to parse(DatabaseSchema, int, boolean).
sqlQuery - the SQL requestescapeProcessing - should the driver to escape processing
before sending to the database ?timeout - an int valueparse(org.objectweb.cjdbc.sql.schema.DatabaseSchema, int, boolean)| Method Detail |
public void parse(DatabaseSchema schema,
int granularity,
boolean isCaseSensitive)
throws java.sql.SQLException
DatabaseSchema of the database
targeted by this request.
An exception is thrown when the parsing fails. Warning, this method does not check the validity of the request. In particular, invalid request could be parsed without throwing an exception. However, valid SQL request should never throw an exception.
parse in class AbstractRequestschema - a DatabaseSchema valuegranularity - parsing granularity as defined in
ParsingGranularitiesisCaseSensitive - if parsing must be case sensitive
java.sql.SQLException - if the parsing failspublic void cloneParsing(AbstractRequest request)
AbstractRequest
cloneParsing in class AbstractRequestrequest - the parsed request to cloneAbstractRequest.cloneParsing(AbstractRequest)
private java.util.ArrayList getFromTables(java.lang.String fromClause,
DatabaseSchema dbs)
throws java.sql.SQLException
FROM clause and retrieves
their alias if any.
fromClause - the FROM clause of the request (without the
FROM keyword)dbs - the DatabaseSchema this request refers to
ArrayList of AliasedDatabaseTable
objects
SQLException - if an error occurs
java.sql.SQLException
private java.util.ArrayList getWhereColumns(java.lang.String whereClause,
java.util.ArrayList aliasedFrom)
throws java.sql.SQLException
WHERE clause.
The selected columns or tables must be found in the given
ArrayList of AliasedDatabaseTable
representing the FROM clause of the same request.
whereClause - WHERE clause of the request (without the
WHERE keyword)aliasedFrom - an ArrayList of
AliasedDatabaseTable
ArrayList of TableColumn
java.sql.SQLException
private java.util.ArrayList getWhereColumnsAndBuildValues(java.lang.String whereClause,
java.util.ArrayList aliasedFrom)
throws java.sql.SQLException
WHERE clause and
builds the values associated with UNIQUE columns.
Furthermore, set isUnique field to its value.
The selected columns or tables must be found in the given
ArrayList of AliasedDatabaseTable representing
the FROM clause of the same request.
whereClause - WHERE clause of the request (without the
WHERE keyword)aliasedFrom - an ArrayList of
AliasedDatabaseTable
ArrayList of TableColumn
java.sql.SQLExceptionpublic java.util.ArrayList getValues()
ArrayList of String
objects representing the values associated with the unique
columns involved in this request.
ArrayList valuepublic boolean isUnique()
true if this query only deletes a single row.
boolean valuepublic boolean isInsert()
AbstractWriteRequesttrue if this request in an INSERT
statement.
isInsert in class AbstractWriteRequestfalseAbstractWriteRequest.isInsert()public boolean isUpdate()
AbstractWriteRequesttrue if this request in an UPDATE
statement.
isUpdate in class AbstractWriteRequestfalseAbstractWriteRequest.isUpdate()public boolean isDelete()
AbstractWriteRequesttrue if this request in a DELETE
statement.
isDelete in class AbstractWriteRequesttrueAbstractWriteRequest.isDelete()public boolean isCreate()
AbstractWriteRequesttrue if this request in a CREATE
statement.
isCreate in class AbstractWriteRequestfalseAbstractWriteRequest.isCreate()public boolean isDrop()
AbstractWriteRequesttrue if this request in a DROP
statement.
isDrop in class AbstractWriteRequestfalseAbstractWriteRequest.isDrop()public void debug()
debug in class AbstractRequest
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||