|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.cjdbc.sql.AbstractRequest
An AbstractRequest
defines the skeleton of an SQL
request.
Field Summary | |
protected int |
cacheable
Whether this request is cacheable or not. |
protected boolean |
escapeProcessing
Should the driver do escape processing before sending to the database? |
protected int |
id
Request unique id (set by the controller). |
protected boolean |
isAutoCommit
Whether this request has been sent in autocommit
mode or not. |
protected boolean |
isParsed
Whether the SQL content has been parsed or not. |
protected boolean |
isReadOnly
True if the connection has been set to read-only |
protected java.lang.String |
login
Login used to issue this request (must be set by the Connection object). |
protected int |
maxRows
Maximum number of rows in the ResultSet. |
protected java.lang.String |
sqlQuery
SQL query (should be set in constructor). |
protected java.lang.String |
sqlSkeleton
SQL query skeleton as it appears in PreparedStatements. |
protected int |
timeout
Timeout for this request in seconds, value 0 means no timeout (should be set in constructor). |
protected int |
transactionId
Transaction identifier if this request belongs to a transaction. |
Constructor Summary | |
AbstractRequest()
|
Method Summary | |
abstract void |
cloneParsing(AbstractRequest request)
Clones the parsing of a request. |
void |
debug()
Displays some debugging information about this request. |
boolean |
equals(java.lang.Object other)
Two requests are equal if they have the same SQL code. |
int |
getCacheAbility()
Returns the cacheable status of this request. |
boolean |
getEscapeProcessing()
Returns true if the driver should escape processing before
sending to the database? |
int |
getId()
Returns the unique id of this request. |
java.lang.String |
getLogin()
Returns the login used to issue this request. |
int |
getMaxRows()
Get the maximum number of rows the ResultSet can contain. |
java.lang.String |
getSQL()
Gets the SQL code of this request. |
java.lang.String |
getSqlSkeleton()
|
int |
getTimeout()
Gets the timeout for this request in seconds. |
int |
getTransactionId()
Gets the identifier of the transaction if this request belongs to a transaction, or -1 if this request does not belong to a transaction. |
boolean |
isAutoCommit()
Returns true if the request should be executed in
autocommit mode. |
boolean |
isParsed()
Returns true if the request SQL content has been already
parsed. |
boolean |
isReadOnly()
Returns true if the connection is set to read-only |
abstract boolean |
isReadRequest()
Returns true if this request is a read request
(SELECT requests for example perform a read). |
abstract boolean |
isUnknownRequest()
Returns true if the resulting operation on this request is
unknown (some non-standard command or stored procedure for example). |
abstract boolean |
isWriteRequest()
Returns true if this request is a write request
(INSERT or UPDATE for example perform writes). |
abstract 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.
|
void |
setCacheAbility(int cacheAbility)
Set the cacheable status of this request. |
void |
setId(int id)
Sets the unique id of this request. |
void |
setIsAutoCommit(boolean isAutoCommit)
Sets the autocommit mode for this request. |
void |
setIsReadOnly(boolean isReadOnly)
Sets the read-only mode for this request. |
void |
setLogin(java.lang.String login)
Sets the login to use to issue this request. |
void |
setMaxRows(int rows)
Set the maximum number of rows in the ResultSet. |
void |
setSQL(java.lang.String sql)
Set the SQL code of this request. |
void |
setSqlSkeleton(java.lang.String skel)
|
void |
setTimeout(int timeout)
Sets the new timeout in seconds for this request. |
void |
setTransactionId(int id)
Sets the transaction identifier this request belongs to. |
protected static java.lang.String |
trimCarriageReturn(java.lang.String s)
Replaces any carriage returns by a space in a given String . |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int id
protected java.lang.String sqlQuery
protected java.lang.String sqlSkeleton
protected java.lang.String login
Connection
object).
protected int cacheable
protected boolean isParsed
protected int maxRows
Statement.setMaxRows(int)
protected boolean isReadOnly
protected boolean isAutoCommit
autocommit
mode or not.
protected int transactionId
protected int timeout
protected boolean escapeProcessing
Constructor Detail |
public AbstractRequest()
Method Detail |
public abstract boolean isReadRequest()
true
if this request is a read request
(SELECT
requests for example perform a read).
true
if this request is a read requestpublic abstract boolean isWriteRequest()
true
if this request is a write request
(INSERT
or UPDATE
for example perform writes).
true
if this requests is a write requestpublic abstract boolean isUnknownRequest()
true
if the resulting operation on this request is
unknown (some non-standard command or stored procedure for example).
boolean
valuepublic boolean isParsed()
true
if the request SQL content has been already
parsed.
boolean
valuepublic boolean isReadOnly()
true
if the connection is set to read-only
boolean
valuepublic void setIsReadOnly(boolean isReadOnly)
isReadOnly
- true
if connection is read-onlypublic int getCacheAbility()
RequestType.CACHEABLE
,
RequestType.UNCACHEABLE
or
RequestType.UNIQUE_CACHEABLE
int
valuepublic void setCacheAbility(int cacheAbility)
RequestType.CACHEABLE
,
RequestType.UNCACHEABLE
or
RequestType.UNIQUE_CACHEABLE
cacheAbility
- a int
valuepublic boolean getEscapeProcessing()
true
if the driver should escape processing before
sending to the database?
boolean
valuepublic int getId()
public void setId(int id)
id
- the id to setpublic boolean isAutoCommit()
true
if the request should be executed in
autocommit
mode.
boolean
valuepublic void setIsAutoCommit(boolean isAutoCommit)
isAutoCommit
- true
if
autocommit
should be usedpublic java.lang.String getLogin()
String
valuepublic void setLogin(java.lang.String login)
login
- a String
valuepublic java.lang.String getSQL()
public int getMaxRows()
Statement.getMaxRows()
public void setMaxRows(int rows)
rows
- maximum number of rowsStatement.setMaxRows(int)
public void setSQL(java.lang.String sql)
parse(DatabaseSchema, int, boolean)
if needed.
sql
- SQL statementpublic int getTimeout()
public void setTimeout(int timeout)
timeout
- an int
valuepublic int getTransactionId()
public void setTransactionId(int id)
id
- transaction idpublic boolean equals(java.lang.Object other)
other
- an object
boolean
valuepublic abstract 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.
schema
- a DatabaseSchema
valuegranularity
- parsing granularity as defined in
ParsingGranularities
isCaseSensitive
- true if parsing must be case sensitive
java.sql.SQLException
- if the parsing failspublic abstract void cloneParsing(AbstractRequest request)
request
- the parsed request to cloneprotected static java.lang.String trimCarriageReturn(java.lang.String s)
String
.
s
- the String
to transform
String
public java.lang.String getSqlSkeleton()
PreparedStatement
.public void setSqlSkeleton(java.lang.String skel)
skel
- set the SQL query skeleton given in a
PreparedStatement
.public void debug()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |