|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.cjdbc.common.sql.AbstractRequest
An AbstractRequest
defines the skeleton of an SQL request.
Field Summary | |
protected int |
cacheable
Whether this request is cacheable or not. |
private boolean |
driverProcessed
If set to true, the query is interpreted on the driver side, if false the various parameters are encoded and passed as is to the database native driver by the controller. |
protected boolean |
escapeProcessing
Should the driver do escape processing before sending to the database? |
private int |
fetchSize
|
protected long |
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 |
private java.lang.String |
lineSeparator
Should match System.getProperty("line.separator") on the driver side. |
protected java.lang.String |
login
Login used to issue this request (must be set by the VirtualDatabaseWorkerThread). |
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 long |
transactionId
Transaction identifier if this request belongs to a transaction. |
Constructor Summary | |
AbstractRequest(java.lang.String sqlQuery,
boolean escapeProcessing,
int timeout,
java.lang.String lineSeparator)
Default constructor Creates a new AbstractRequest object |
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 |
getFetchSize()
Returns the fetchSize value. |
long |
getId()
Returns the unique id of this request. |
java.lang.String |
getLineSeparator()
Returns the lineSeparator value. |
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 |
getSQLShortForm(int nbOfCharacters)
Get a short form of this request if the SQL statement exceeds nbOfCharacters. |
java.lang.String |
getSqlSkeleton()
|
int |
getTimeout()
Gets the timeout for this request in seconds. |
long |
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 |
isDriverProcessed()
Returns the driverProcessed value. |
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 |
setDriverProcessed(boolean driverProcessed)
Sets the driverProcessed value. |
void |
setFetchSize(int fetchSize)
Sets the fetchSize value. |
void |
setId(long 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 |
setLineSeparator(java.lang.String lineSeparator)
Sets the lineSeparator value. |
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(long id)
Sets the transaction identifier this request belongs to. |
java.lang.String |
trimCarriageReturn()
If the query has a skeleton defined, return the skeleton wth all carriage returns replaces with spaces. |
private 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 transient long id
protected java.lang.String sqlQuery
protected java.lang.String sqlSkeleton
protected java.lang.String login
protected int cacheable
protected boolean isParsed
protected int maxRows
Statement.setMaxRows(int)
private int fetchSize
protected boolean isReadOnly
protected boolean isAutoCommit
autocommit
mode or
not.
protected long transactionId
protected int timeout
protected boolean escapeProcessing
private java.lang.String lineSeparator
private boolean driverProcessed
Constructor Detail |
public AbstractRequest(java.lang.String sqlQuery, boolean escapeProcessing, int timeout, java.lang.String lineSeparator)
AbstractRequest
object
sqlQuery
- the SQL queryescapeProcessing
- should the driver to escape processing before
sending to the database ?timeout
- an int
valuelineSeparator
- the line separator used in the queryMethod 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 long getId()
public void setId(long 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 java.lang.String getLineSeparator()
public void setLineSeparator(java.lang.String lineSeparator)
lineSeparator
- The lineSeparator to set.public void setLogin(java.lang.String login)
login
- a String
valuepublic java.lang.String getSQL()
public java.lang.String getSQLShortForm(int nbOfCharacters)
nbOfCharacters
- number of characters to include in the short form.
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 long getTransactionId()
public void setTransactionId(long 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 clonepublic java.lang.String trimCarriageReturn()
private 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 boolean isDriverProcessed()
public void setDriverProcessed(boolean driverProcessed)
driverProcessed
- The driverProcessed to set.public void setFetchSize(int fetchSize)
fetchSize
- The fetchSize to set.public int getFetchSize()
public void debug()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |