org.objectweb.cjdbc.sql
Class InsertRequest

java.lang.Object
  extended byorg.objectweb.cjdbc.sql.AbstractRequest
      extended byorg.objectweb.cjdbc.sql.AbstractWriteRequest
          extended byorg.objectweb.cjdbc.sql.InsertRequest
All Implemented Interfaces:
java.io.Serializable

public class InsertRequest
extends AbstractWriteRequest
implements java.io.Serializable

An InsertRequest is an SQL request of the following syntax:

 INSERT INTO table-name [(column-name[,column-name]*)]
 {VALUES (constant|null[,constant|null]*)}|{SELECT query}
 
VALUES are ignored.

Version:
1.0
Author:
Emmanuel Cecchet
See Also:
Serialized Form

Field Summary
 
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
InsertRequest(java.lang.String sqlQuery, boolean escapeProcessing, int timeout)
          Creates a new InsertRequest instance.
InsertRequest(java.lang.String sqlQuery, boolean escapeProcessing, int timeout, DatabaseSchema schema, int granularity, boolean isCaseSensitive)
          Creates a new InsertRequest instance.
 
Method Summary
 void cloneParsing(AbstractRequest request)
          Clones the parsing of a request.
 void debug()
          Displays some debugging information about this request.
 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 isUpdate()
          Returns true if this request in an UPDATE statement.
 void parse(DatabaseSchema schema, int granularity, boolean isCaseSensitive)
          TODO: extraction of the selected columns
 
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
 

Constructor Detail

InsertRequest

public InsertRequest(java.lang.String sqlQuery,
                     boolean escapeProcessing,
                     int timeout,
                     DatabaseSchema schema,
                     int granularity,
                     boolean isCaseSensitive)
              throws java.sql.SQLException
Creates a new InsertRequest instance. The caller must give an SQL request, without any leading or trailing spaces and beginning with 'insert into ' (it will not be checked).

If the syntax is incorrect an exception is thrown.

Parameters:
sqlQuery - the SQL query
escapeProcessing - should the driver to escape processing before sending to the database ?
timeout - an int value
schema - a DatabaseSchema value
granularity - parsing granularity as defined in ParsingGranularities
isCaseSensitive - true if parsing is case sensitive
Throws:
java.sql.SQLException - if an error occurs

InsertRequest

public InsertRequest(java.lang.String sqlQuery,
                     boolean escapeProcessing,
                     int timeout)
Creates a new InsertRequest instance. The caller must give an SQL request, without any leading or trailing spaces and beginning with 'insert into ' (it will not be checked).

The request is not parsed but it can be done later by a call to parse(DatabaseSchema, int, boolean).

Parameters:
sqlQuery - the SQL query
escapeProcessing - should the driver to escape processing before sending to the database ?
timeout - an int value
See Also:
parse(org.objectweb.cjdbc.sql.schema.DatabaseSchema, int, boolean)
Method Detail

parse

public void parse(DatabaseSchema schema,
                  int granularity,
                  boolean isCaseSensitive)
           throws java.sql.SQLException
TODO: extraction of the selected columns

Specified by:
parse in class AbstractRequest
Parameters:
schema - a DatabaseSchema value
granularity - parsing granularity as defined in ParsingGranularities
isCaseSensitive - true if parsing must be case sensitive
Throws:
java.sql.SQLException - if the parsing fails
See Also:
AbstractRequest.parse(org.objectweb.cjdbc.sql.schema.DatabaseSchema, int, boolean)

cloneParsing

public void cloneParsing(AbstractRequest request)
Description copied from class: AbstractRequest
Clones the parsing of a request.

Specified by:
cloneParsing in class AbstractRequest
Parameters:
request - the parsed request to clone
See Also:
AbstractRequest.cloneParsing(AbstractRequest)

isInsert

public boolean isInsert()
Description copied from class: AbstractWriteRequest
Returns true if this request in an INSERT statement.

Specified by:
isInsert in class AbstractWriteRequest
Returns:
true
See Also:
AbstractWriteRequest.isInsert()

isUpdate

public boolean isUpdate()
Description copied from class: AbstractWriteRequest
Returns true if this request in an UPDATE statement.

Specified by:
isUpdate in class AbstractWriteRequest
Returns:
false
See Also:
AbstractWriteRequest.isUpdate()

isDelete

public boolean isDelete()
Description copied from class: AbstractWriteRequest
Returns true if this request in a DELETE statement.

Specified by:
isDelete in class AbstractWriteRequest
Returns:
false
See Also:
AbstractWriteRequest.isDelete()

isCreate

public boolean isCreate()
Description copied from class: AbstractWriteRequest
Returns true if this request in a CREATE statement.

Specified by:
isCreate in class AbstractWriteRequest
Returns:
false
See Also:
AbstractWriteRequest.isCreate()

isDrop

public boolean isDrop()
Description copied from class: AbstractWriteRequest
Returns true if this request in a DROP statement.

Specified by:
isDrop in class AbstractWriteRequest
Returns:
false
See Also:
AbstractWriteRequest.isDrop()

debug

public void debug()
Displays some debugging information about this request.

Overrides:
debug in class AbstractRequest


Copyright © 2002, 2003 - ObjectWeb Consortium - All Rights Reserved.