|
|||||||||||
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.UpdateRequest
An UpdateRequest
is an SQL request with the following
syntax:
UPDATE table-name SET (column-name=expression[,column-name=expression]*) WHERE search-condition
Field Summary | |
private java.lang.String |
equivalentInsert
INSERT statement equivalent to this UPDATE .
|
private boolean |
isUnique
true if this request updates a UNIQUE row. |
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 | |
UpdateRequest(java.lang.String sqlQuery,
boolean escapeProcessing,
int timeout)
Creates a new UpdateRequest instance. |
|
UpdateRequest(java.lang.String sqlQuery,
boolean escapeProcessing,
int timeout,
DatabaseSchema schema,
int granularity,
boolean isCaseSensitive)
Creates a new UpdateRequest instance. |
Method Summary | |
void |
cloneParsing(AbstractRequest request)
Clones the parsing of a request. |
void |
debug()
Displays some debugging information about this request. |
java.lang.String |
getEquivalentInsert()
Returns the INSERT statement equivalent to this
UPDATE . |
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 as this request updates a UNIQUE
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 extract 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 request updates a UNIQUE
row.
private java.lang.String equivalentInsert
INSERT
statement equivalent to this UPDATE
.
This statement is used for cache coherency and can only be provided if
isUnique()
is true
.
Constructor Detail |
public UpdateRequest(java.lang.String sqlQuery, boolean escapeProcessing, int timeout, DatabaseSchema schema, int granularity, boolean isCaseSensitive) throws java.sql.SQLException
UpdateRequest
instance. The caller must give
an SQL request, without any leading or trailing spaces and beginning with
'update ' (it will not be checked).
If the syntax is incorrect an exception is thrown.
sqlQuery
- the SQL queryescapeProcessing
- should the driver to escape processing before
sending to the database ?timeout
- an int
valueschema
- a DatabaseSchema
valuegranularity
- parsing granularity as defined in
ParsingGranularities
isCaseSensitive
- true if parsing is case sensitive
java.sql.SQLException
- if an error occurspublic UpdateRequest(java.lang.String sqlQuery, boolean escapeProcessing, int timeout)
UpdateRequest
instance. The caller must give
an SQL request, without any leading or trailing spaces and beginning with
'update ' (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 queryescapeProcessing
- 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.
Determines also if this query only deletes a single row, and the
equivalent INSERT
statement.
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 AbstractRequest
schema
- a DatabaseSchema
valuegranularity
- parsing granularity as defined in
ParsingGranularities
isCaseSensitive
- true if table name parsing is case sensitive
java.sql.SQLException
- if the parsing failspublic void cloneParsing(AbstractRequest request)
AbstractRequest
cloneParsing
in class AbstractRequest
request
- the parsed request to cloneAbstractRequest.cloneParsing(AbstractRequest)
public boolean isInsert()
AbstractWriteRequest
true
if this request in an INSERT
statement.
isInsert
in class AbstractWriteRequest
false
AbstractWriteRequest.isInsert()
public boolean isUpdate()
AbstractWriteRequest
true
if this request in an UPDATE
statement.
isUpdate
in class AbstractWriteRequest
true
AbstractWriteRequest.isUpdate()
public boolean isDelete()
AbstractWriteRequest
true
if this request in a DELETE
statement.
isDelete
in class AbstractWriteRequest
false
AbstractWriteRequest.isDelete()
public boolean isCreate()
AbstractWriteRequest
true
if this request in a CREATE
statement.
isCreate
in class AbstractWriteRequest
false
AbstractWriteRequest.isCreate()
public boolean isDrop()
AbstractWriteRequest
true
if this request in a DROP
statement.
isDrop
in class AbstractWriteRequest
false
AbstractWriteRequest.isDrop()
public boolean isUnique()
true
as this request updates a UNIQUE
row.
false
public java.lang.String getEquivalentInsert()
INSERT
statement equivalent to this
UPDATE
. This statement is used for cache coherency and can
only be provided if isUnique()
is true
.
String
containing the equivalent INSERT
statement or null
if isUnique()
is
false
.public void debug()
debug
in class AbstractRequest
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |