Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

org.objectweb.cjdbc.driver.Statement Class Reference

Inheritance diagram for org.objectweb.cjdbc.driver.Statement:

Inheritance graph
[legend]
Collaboration diagram for org.objectweb.cjdbc.driver.Statement:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Statement (Connection c)
void addBatch (String sql) throws SQLException
void cancel () throws SQLException
void clearBatch () throws SQLException
void clearWarnings () throws SQLException
int[] executeBatch () throws SQLException
void close () throws SQLException
boolean execute (String sql) throws SQLException
java.sql.ResultSet executeQuery (String sql) throws SQLException
int executeUpdate (String sql) throws SQLException
java.sql.Connection getConnection () throws SQLException
int getFetchDirection () throws SQLException
int getFetchSize () throws SQLException
int getMaxFieldSize () throws SQLException
int getMaxRows () throws SQLException
boolean getMoreResults () throws SQLException
int getQueryTimeout () throws SQLException
java.sql.ResultSet getResultSet () throws SQLException
int getResultSetConcurrency () throws SQLException
int getResultSetType () throws SQLException
int getUpdateCount () throws SQLException
SQLWarning getWarnings () throws SQLException
void setCursorName (String name) throws SQLException
void setEscapeProcessing (boolean enable) throws SQLException
void setFetchDirection (int direction) throws SQLException
void setFetchSize (int rows) throws SQLException
void setMaxFieldSize (int max) throws SQLException
void setMaxRows (int max) throws SQLException
void setQueryTimeout (int seconds) throws SQLException
void setResultSetConcurrency (int value) throws SQLException
void setResultSetType (int value) throws SQLException
boolean getMoreResults (int current) throws SQLException
java.sql.ResultSet getGeneratedKeys () throws SQLException
int executeUpdate (String sql, int autoGeneratedKeys) throws SQLException
int executeUpdate (String sql, int columnIndexes[]) throws SQLException
int executeUpdate (String sql, String columnNames[]) throws SQLException
boolean execute (String sql, int autoGeneratedKeys) throws SQLException
boolean execute (String sql, int columnIndexes[]) throws SQLException
boolean execute (String sql, String columnNames[]) throws SQLException
int getResultSetHoldability () throws SQLException

Protected Member Functions

java.sql.ResultSet executeQuery (String sqlSkeleton, String sqlQuery) throws SQLException
int executeUpdateWithSkeleton (String sqlSkeleton, String sqlQuery) throws SQLException

Protected Attributes

Connection connection = null
ResultSet result = null
int updateCount = -1
boolean escapeProcessing = true
ResultSet generatedKeys = null
int generatedKeysFlag = java.sql.Statement.NO_GENERATED_KEYS

Detailed Description

A Statement object is used for executing a static SQL statement and obtaining the results produced by it.

Only one ResultSet per Statement can be open at any point in time. Therefore, if the reading of one ResultSet is interleaved with the reading of another, each must have been generated by different Statements. All Statements execute methods implicitly close a statement's current ResultSet if an open one exists.

See also:
java.sql.Statement

DriverResultSet

Author:
Emmanuel Cecchet

Vadim Kassin

Jean-Bernard van Zuylen

Version:
1.0

Definition at line 62 of file org/objectweb/cjdbc/driver/Statement.java.


Constructor & Destructor Documentation

org.objectweb.cjdbc.driver.Statement.Statement Connection  c  ) 
 

Creates a new Statement instance.

Parameters:
c the Connection that created us

Definition at line 113 of file org/objectweb/cjdbc/driver/Statement.java.

References org.objectweb.cjdbc.driver.Statement.connection.

00114   {
00115     connection = c;
00116   }


Member Function Documentation

void org.objectweb.cjdbc.driver.Statement.addBatch String  sql  )  throws SQLException
 

Adds sql to the current list of commands.

Parameters:
sql an SQL statement that returns an update count (INSERT or UPDATE)
Exceptions:
SQLException if an error occurs

Implements java.sql.Statement.

Definition at line 124 of file org/objectweb/cjdbc/driver/Statement.java.

00125   {
00126     if (batch == null)
00127       batch = new Vector();
00128     batch.addElement(sql.trim());
00129   }

void org.objectweb.cjdbc.driver.Statement.cancel  )  throws SQLException
 

Could be use by one thread to cancel a statement that is being executed by another thread. We don't support that for instance.

Exceptions:
SQLException if an error occurs

Implements java.sql.Statement.

Definition at line 137 of file org/objectweb/cjdbc/driver/Statement.java.

00138   {
00139     throw new NotImplementedException("cancel()");
00140   }

void org.objectweb.cjdbc.driver.Statement.clearBatch  )  throws SQLException
 

Empties the current list of commands.

Exceptions:
SQLException if an error occurs

Implements java.sql.Statement.

Definition at line 147 of file org/objectweb/cjdbc/driver/Statement.java.

00148   {
00149     if (batch != null)
00150       batch.removeAllElements();
00151   }

void org.objectweb.cjdbc.driver.Statement.clearWarnings  )  throws SQLException
 

After this call, getWarnings returns null until a new warning is reported for this Statement.

Exceptions:
SQLException if a database access error occurs (why?)

Implements java.sql.Statement.

Definition at line 159 of file org/objectweb/cjdbc/driver/Statement.java.

00160   {
00161     warnings = null;
00162   }

void org.objectweb.cjdbc.driver.Statement.close  )  throws SQLException
 

In many cases, it is desirable to immediately release a Statement's database and JDBC resources instead of waiting for this to happen when it is automatically closed. The close method provides this immediate release.

Note: A Statement is automatically closed when it is garbage collected. When a Statement is closed, its current ResultSet, if one exists, is also closed.

Exceptions:
SQLException if a database access error occurs (why?)

Implements java.sql.Statement.

Reimplemented in org.objectweb.cjdbc.driver.PreparedStatement.

Definition at line 213 of file org/objectweb/cjdbc/driver/Statement.java.

References org.objectweb.cjdbc.driver.Connection.close(), org.objectweb.cjdbc.driver.Statement.connection, and org.objectweb.cjdbc.driver.Statement.result.

00214   {
00215     // Force the ResultSet to close
00216     if (result != null)
00217       result.close();
00218 
00219     // Disasociate it from us (For Garbage Collection)
00220     result = null;
00221     connection = null;
00222   }

boolean org.objectweb.cjdbc.driver.Statement.execute String  sql,
String  columnNames[]
throws SQLException
 

Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. This array contains the names of the columns in the target table that contain the auto-generated keys that should be made available. The driver will ignore the array if the given SQL statement is not an INSERT statement.

In some (uncommon) situations, a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this unless you are (1) executing a stored procedure that you know may return multiple results or (2) you are dynamically executing an unknown SQL string.

The execute method executes an SQL statement and indicates the form of the first result. You must then use the methods getResultSet or getUpdateCount to retrieve the result, and getMoreResults to move to any subsequent result(s).

Parameters:
sql any SQL statement
columnNames an array of the names of the columns in the inserted row that should be made available for retrieval by a call to the method getGeneratedKeys
Returns:
true if the next result is a ResultSet object; false if it is an update count or there are no more results
Exceptions:
SQLException if a database access error occurs
See also:
getResultSet

getUpdateCount

getMoreResults()

getGeneratedKeys

Since:
JDK 1.4

Implements java.sql.Statement.

Definition at line 937 of file org/objectweb/cjdbc/driver/Statement.java.

00938   {
00939     throw new NotImplementedException("execute");
00940   }

boolean org.objectweb.cjdbc.driver.Statement.execute String  sql,
int  columnIndexes[]
throws SQLException
 

Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. This array contains the indexes of the columns in the target table that contain the auto-generated keys that should be made available. The driver will ignore the array if the given SQL statement is not an INSERT statement.

Under some (uncommon) situations, a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this unless you are (1) executing a stored procedure that you know may return multiple results or (2) you are dynamically executing an unknown SQL string.

The execute method executes an SQL statement and indicates the form of the first result. You must then use the methods getResultSet or getUpdateCount to retrieve the result, and getMoreResults to move to any subsequent result(s).

Parameters:
sql any SQL statement
columnIndexes an array of the indexes of the columns in the inserted row that should be made available for retrieval by a call to the method getGeneratedKeys
Returns:
true if the first result is a ResultSet object; false if it is an update count or there are no results
Exceptions:
SQLException if a database access error occurs
See also:
getResultSet

getUpdateCount

getMoreResults()

Since:
JDK 1.4

Implements java.sql.Statement.

Definition at line 899 of file org/objectweb/cjdbc/driver/Statement.java.

00900   {
00901     throw new NotImplementedException("execute");
00902   }

boolean org.objectweb.cjdbc.driver.Statement.execute String  sql,
int  autoGeneratedKeys
throws SQLException
 

Executes the given SQL statement, which may return multiple results, and signals the driver that any auto-generated keys should be made available for retrieval. The driver will ignore this signal if the SQL statement is not an INSERT statement.

In some (uncommon) situations, a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this unless you are (1) executing a stored procedure that you know may return multiple results or (2) you are dynamically executing an unknown SQL string.

The execute method executes an SQL statement and indicates the form of the first result. You must then use the methods getResultSet or getUpdateCount to retrieve the result, and getMoreResults to move to any subsequent result(s).

Parameters:
sql any SQL statement
autoGeneratedKeys a constant indicating whether auto-generated keys should be made available for retrieval using the method getGeneratedKeys; one of the following constants: Statement.RETURN_GENERATED_KEYS or Statement.NO_GENERATED_KEYS
Returns:
true if the first result is a ResultSet object; false if it is an update count or there are no results
Exceptions:
SQLException if a database access error occurs
See also:
getResultSet

getUpdateCount

getMoreResults()

getGeneratedKeys

Since:
JDK 1.4

Implements java.sql.Statement.

Definition at line 860 of file org/objectweb/cjdbc/driver/Statement.java.

References org.objectweb.cjdbc.driver.Statement.execute().

00861   {
00862     generatedKeysFlag = autoGeneratedKeys;
00863     return execute(sql);
00864   }

boolean org.objectweb.cjdbc.driver.Statement.execute String  sql  )  throws SQLException
 

Execute a SQL statement that may return multiple results.

Parameters:
sql any SQL statement
Returns:
true if the result is a ResultSet or false if it is an integer
Exceptions:
SQLException if an error occurs

Implements java.sql.Statement.

Definition at line 231 of file org/objectweb/cjdbc/driver/Statement.java.

References org.objectweb.cjdbc.driver.Statement.executeQuery(), org.objectweb.cjdbc.driver.Statement.executeUpdate(), org.objectweb.cjdbc.driver.Statement.result, and org.objectweb.cjdbc.driver.Statement.updateCount.

Referenced by org.objectweb.cjdbc.driver.Statement.execute().

00232   {
00233     int start = 0;
00234     try
00235     {
00236       // Ignore any leading parenthesis
00237       while (sql.charAt(start) == '(')
00238         start++;
00239     }
00240     catch (IndexOutOfBoundsException e)
00241     {
00242       // Probably a buggy request, let it go through and let thefollowing code
00243       // to report an accurate error if any.
00244       start = 0;
00245     }
00246 
00247     if (sql.regionMatches(true, start, "select", 0, 6)
00248         || (sql.regionMatches(true, start, "{call", 0, 5)))
00249     {
00250       result = executeQuery(sql);
00251       return true;
00252     }
00253     else
00254     {
00255       updateCount = executeUpdate(sql);
00256       return false;
00257     }
00258   }

int [] org.objectweb.cjdbc.driver.Statement.executeBatch  )  throws SQLException
 

Execute a batch of commands

Returns:
an array containing update count that corresponding to the commands that executed successfully
Exceptions:
SQLException if an error occurs

Implements java.sql.Statement.

Definition at line 171 of file org/objectweb/cjdbc/driver/Statement.java.

References org.objectweb.cjdbc.driver.Statement.result.

00172   {
00173     if (batch == null || batch.isEmpty())
00174       return new int[0];
00175 
00176     int size = batch.size();
00177     int[] result = new int[size];
00178     int i = 0;
00179 
00180     try
00181     {
00182       for (i = 0; i < size; i++)
00183         result[i] = this.executeUpdate((String) batch.elementAt(i));
00184       return result;
00185     }
00186     catch (SQLException e)
00187     {
00188       String message = "Batch failed for request " + i + ": "
00189           + batch.elementAt(i) + " (" + e + ")";
00190 
00191       int[] updateCounts = new int[i];
00192       System.arraycopy(result, 0, updateCounts, 0, i);
00193 
00194       throw new BatchUpdateException(message, updateCounts);
00195     }
00196     finally
00197     {
00198       batch.removeAllElements();
00199     }
00200   }

java.sql.ResultSet org.objectweb.cjdbc.driver.Statement.executeQuery String  sqlSkeleton,
String  sqlQuery
throws SQLException [protected]
 

Execute a SQL statement that returns a single ResultSet

Parameters:
sqlSkeleton the SQL request squeleton or null
sqlQuery typically a static SQL SELECT statement that is already trimed
Returns:
a ResulSet that contains the data produced by the query
Exceptions:
SQLException if a database access error occurs

Definition at line 281 of file org/objectweb/cjdbc/driver/Statement.java.

References org.objectweb.cjdbc.driver.Connection.close(), org.objectweb.cjdbc.driver.Statement.connection, org.objectweb.cjdbc.driver.Statement.escapeProcessing, org.objectweb.cjdbc.driver.Connection.execReadRequest(), org.objectweb.cjdbc.driver.Connection.execReadStoredProcedure(), org.objectweb.cjdbc.driver.Connection.isDriverProcessed(), org.objectweb.cjdbc.driver.Connection.needSqlSkeleton, org.objectweb.cjdbc.driver.Statement.result, org.objectweb.cjdbc.common.sql.SelectRequest.setCursorName(), org.objectweb.cjdbc.common.sql.AbstractRequest.setFetchSize(), org.objectweb.cjdbc.common.sql.AbstractRequest.setMaxRows(), org.objectweb.cjdbc.common.sql.AbstractRequest.setSqlSkeleton(), and org.objectweb.cjdbc.driver.Statement.updateCount.

00283   {
00284     updateCount = -1; // invalidate the last write result
00285     if (result != null)
00286     { // Discard the previous result
00287       result.close();
00288       result = null;
00289     }
00290 
00291     if (sqlQuery.regionMatches(true, 0, "{call", 0, 5))
00292     {
00293       StoredProcedure proc = new StoredProcedure(sqlQuery, escapeProcessing,
00294           timeout, Connection.LINE_SEPARATOR);
00295       if (connection.needSqlSkeleton || !connection.isDriverProcessed())
00296         proc.setSqlSkeleton(sqlSkeleton);
00297       proc.setMaxRows(maxRows);
00298       result = connection.execReadStoredProcedure(proc);
00299     }
00300     else
00301     {
00302       SelectRequest request = new SelectRequest(sqlQuery, escapeProcessing,
00303           timeout, Connection.LINE_SEPARATOR);
00304       if (connection.needSqlSkeleton || !connection.isDriverProcessed())
00305         request.setSqlSkeleton(sqlSkeleton);
00306       request.setMaxRows(maxRows);
00307       request.setFetchSize(fetchSize);
00308       request.setCursorName(cursorName);
00309       result = connection.execReadRequest(request);
00310     }
00311 
00312     if (result instanceof DriverResultSet)
00313       ((DriverResultSet) result).setStatement(this);
00314     return result;
00315   }

java.sql.ResultSet org.objectweb.cjdbc.driver.Statement.executeQuery String  sql  )  throws SQLException
 

Execute a SQL statement that returns a single ResultSet

Parameters:
sql typically a static SQL SELECT statement
Returns:
a ResulSet that contains the data produced by the query
Exceptions:
SQLException if a database access error occurs

Implements java.sql.Statement.

Definition at line 267 of file org/objectweb/cjdbc/driver/Statement.java.

Referenced by org.objectweb.cjdbc.driver.Statement.execute().

00268   {
00269     return executeQuery(null, sql.trim());
00270   }

int org.objectweb.cjdbc.driver.Statement.executeUpdate String  sql,
String  columnNames[]
throws SQLException
 

Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. The driver will ignore the array if the SQL statement is not an INSERT statement.

Parameters:
sql an SQL INSERT,UPDATE or DELETE statement or an SQL statement that returns nothing
columnNames an array of the names of the columns that should be returned from the inserted row
Returns:
either the row count for INSERT, UPDATE, or DELETE statements, or 0 for SQL statements that return nothing
Exceptions:
SQLException if a database access error occurs
Since:
JDK 1.4

Implements java.sql.Statement.

Definition at line 821 of file org/objectweb/cjdbc/driver/Statement.java.

00823   {
00824     throw new NotImplementedException("executeUpdate");
00825   }

int org.objectweb.cjdbc.driver.Statement.executeUpdate String  sql,
int  columnIndexes[]
throws SQLException
 

Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. The driver will ignore the array if the SQL statement is not an INSERT statement.

Parameters:
sql an SQL INSERT,UPDATE or DELETE statement or an SQL statement that returns nothing, such as an SQL DDL statement
columnIndexes an array of column indexes indicating the columns that should be returned from the inserted row
Returns:
either the row count for INSERT, UPDATE, or DELETE statements, or 0 for SQL statements that return nothing
Exceptions:
SQLException if a database access error occurs or the SQL statement returns a ResultSet object
Since:
JDK 1.4

Implements java.sql.Statement.

Definition at line 799 of file org/objectweb/cjdbc/driver/Statement.java.

00800   {
00801     throw new NotImplementedException("executeUpdate");
00802   }

int org.objectweb.cjdbc.driver.Statement.executeUpdate String  sql,
int  autoGeneratedKeys
throws SQLException
 

Executes the given SQL statement and signals the driver with the given flag about whether the auto-generated keys produced by this Statement object should be made available for retrieval.

Parameters:
sql must be an SQL INSERT,UPDATE or DELETE statement or an SQL statement that returns nothing
autoGeneratedKeys a flag indicating whether auto-generated keys should be made available for retrieval; one of the following constants: Statement.RETURN_GENERATED_KEYS Statement.NO_GENERATED_KEYS
Returns:
either the row count for INSERT, UPDATE or DELETE statements, or 0 for SQL statements that return nothing
Exceptions:
SQLException if a database access error occurs, the given SQL statement returns a ResultSet object, or the given constant is not one of those allowed
Since:
JDK 1.4

Implements java.sql.Statement.

Definition at line 774 of file org/objectweb/cjdbc/driver/Statement.java.

References org.objectweb.cjdbc.driver.Statement.executeUpdate().

00776   {
00777     generatedKeysFlag = autoGeneratedKeys;
00778     return executeUpdate(sql);
00779   }

int org.objectweb.cjdbc.driver.Statement.executeUpdate String  sql  )  throws SQLException
 

Execute a SQL INSERT, UPDATE or DELETE statement. In addition SQL statements that return nothing such as SQL DDL statements can be executed

Parameters:
sql a SQL statement
Returns:
either a row count, or 0 for SQL commands
Exceptions:
SQLException if a database access error occurs

Implements java.sql.Statement.

Definition at line 325 of file org/objectweb/cjdbc/driver/Statement.java.

References org.objectweb.cjdbc.driver.Statement.executeUpdateWithSkeleton().

Referenced by org.objectweb.cjdbc.driver.Statement.execute(), and org.objectweb.cjdbc.driver.Statement.executeUpdate().

00326   {
00327     return executeUpdateWithSkeleton(null, sql.trim());
00328   }

int org.objectweb.cjdbc.driver.Statement.executeUpdateWithSkeleton String  sqlSkeleton,
String  sqlQuery
throws SQLException [protected]
 

Execute a SQL INSERT, UPDATE or DELETE statement. In addition SQL statements that return nothing such as SQL DDL statements can be executed

Parameters:
sqlSkeleton the SQL request squeleton or null
sqlQuery a static SQL statement that is already trimed
Returns:
either a row count, or 0 for SQL commands
Exceptions:
SQLException if a database access error occurs

Definition at line 339 of file org/objectweb/cjdbc/driver/Statement.java.

References org.objectweb.cjdbc.driver.Connection.close(), org.objectweb.cjdbc.driver.Statement.connection, org.objectweb.cjdbc.driver.Statement.escapeProcessing, org.objectweb.cjdbc.driver.Connection.execWriteRequest(), org.objectweb.cjdbc.driver.Connection.execWriteRequestWithKeys(), org.objectweb.cjdbc.driver.Connection.execWriteStoredProcedure(), org.objectweb.cjdbc.driver.Statement.generatedKeys, org.objectweb.cjdbc.driver.Connection.isDriverProcessed(), org.objectweb.cjdbc.driver.Connection.needSqlSkeleton, org.objectweb.cjdbc.driver.Statement.result, org.objectweb.cjdbc.common.sql.AbstractRequest.setSqlSkeleton(), and org.objectweb.cjdbc.driver.Statement.updateCount.

Referenced by org.objectweb.cjdbc.driver.PreparedStatement.execute(), and org.objectweb.cjdbc.driver.Statement.executeUpdate().

00341   {
00342     if (result != null)
00343     { // Discard the previous result
00344       result.close();
00345       result = null;
00346     }
00347 
00348     // Check that the command starts with
00349     // insert/update/delete/create/drop/{call
00350     String lower = sqlQuery.substring(0,
00351         6 < sqlQuery.length() ? 6 : sqlQuery.length()).toLowerCase();
00352     AbstractWriteRequest request;
00353     if (lower.equals("insert"))
00354       request = new InsertRequest(sqlQuery, escapeProcessing, timeout,
00355           Connection.LINE_SEPARATOR);
00356     else if (lower.equals("update"))
00357       request = new UpdateRequest(sqlQuery, escapeProcessing, timeout,
00358           Connection.LINE_SEPARATOR);
00359     else if (lower.equals("delete"))
00360       request = new DeleteRequest(sqlQuery, escapeProcessing, timeout,
00361           Connection.LINE_SEPARATOR);
00362     else if (lower.startsWith("create"))
00363       request = new CreateRequest(sqlQuery, escapeProcessing, timeout,
00364           Connection.LINE_SEPARATOR);
00365     else if (lower.startsWith("drop"))
00366       request = new DropRequest(sqlQuery, escapeProcessing, timeout,
00367           Connection.LINE_SEPARATOR);
00368     else if (lower.startsWith("alter"))
00369       request = new AlterRequest(sqlQuery, escapeProcessing, timeout,
00370           Connection.LINE_SEPARATOR);
00371     else if (lower.startsWith("{call"))
00372     { // Call stored procedure and return
00373       StoredProcedure proc = new StoredProcedure(sqlQuery, escapeProcessing,
00374           timeout, Connection.LINE_SEPARATOR);
00375       if (connection.needSqlSkeleton || !connection.isDriverProcessed())
00376         proc.setSqlSkeleton(sqlSkeleton);
00377       updateCount = connection.execWriteStoredProcedure(proc);
00378       return updateCount;
00379     }
00380     else if (lower.startsWith("}call"))
00381     { // Call stored procedure and return. This hack is used to allow someone to
00382       // use execute() to call a write stored procedure.
00383       StoredProcedure proc = new StoredProcedure("{" + sqlQuery.substring(1),
00384           escapeProcessing, timeout, Connection.LINE_SEPARATOR);
00385       if (connection.needSqlSkeleton || !connection.isDriverProcessed())
00386         proc.setSqlSkeleton(sqlSkeleton);
00387       updateCount = connection.execWriteStoredProcedure(proc);
00388       return updateCount;
00389     }
00390     else
00391       throw new SQLException(
00392           "executeUpdate only accepts statements starting with insert/update/delete/create/drop/{call ("
00393               + sqlQuery + ")");
00394 
00395     if (connection.needSqlSkeleton || !connection.isDriverProcessed())
00396       request.setSqlSkeleton(sqlSkeleton);
00397 
00398     if (generatedKeysFlag == Statement.RETURN_GENERATED_KEYS)
00399     { // Get the auto generated key back
00400       generatedKeys = connection.execWriteRequestWithKeys(request);
00401 
00402       /*
00403        * Usually it is one autoincrement field and one generated key but if it
00404        * is not acceptable - better way to make another function for return
00405        * count of updates Or leave execWriteRequestWithKeys to return count and
00406        * add function for return ResultSet
00407        */
00408       return 1;
00409     }
00410     else
00411     { // No generated keys
00412       updateCount = connection.execWriteRequest(request);
00413       return updateCount;
00414     }
00415   }

java.sql.Connection org.objectweb.cjdbc.driver.Statement.getConnection  )  throws SQLException
 

Retrieve the connection that created this Statement object

Returns:
a java.sql.Connection object
Exceptions:
SQLException never

Implements java.sql.Statement.

Definition at line 423 of file org/objectweb/cjdbc/driver/Statement.java.

Referenced by org.objectweb.cjdbc.driver.DriverResultSet.getBytes().

00424   {
00425     return connection;
00426   }

int org.objectweb.cjdbc.driver.Statement.getFetchDirection  )  throws SQLException
 

Not supported yet.

Returns:
nothing
Exceptions:
SQLException not supported

Implements java.sql.Statement.

Definition at line 434 of file org/objectweb/cjdbc/driver/Statement.java.

00435   {
00436     throw new NotImplementedException("getFetchDirection()");
00437   }

int org.objectweb.cjdbc.driver.Statement.getFetchSize  )  throws SQLException
 

See also:
java.sql.Statement.getFetchSize()

Implements java.sql.Statement.

Definition at line 442 of file org/objectweb/cjdbc/driver/Statement.java.

Referenced by org.objectweb.cjdbc.driver.DriverResultSet.setStatement().

00443   {
00444     return fetchSize;
00445   }

java.sql.ResultSet org.objectweb.cjdbc.driver.Statement.getGeneratedKeys  )  throws SQLException
 

Retrieves any auto-generated keys created as a result of executing this Statement object. If this Statement object did not generate any keys, an empty ResultSet object is returned.

Returns:
a ResultSet object containing the auto-generated key(s) generated by the execution of this Statement object
Exceptions:
SQLException if a database access error occurs
Since:
JDK 1.4

Implements java.sql.Statement.

Definition at line 749 of file org/objectweb/cjdbc/driver/Statement.java.

00750   {
00751     return generatedKeys;
00752   }

int org.objectweb.cjdbc.driver.Statement.getMaxFieldSize  )  throws SQLException
 

The maxFieldSize limit (in bytes) is the maximum amount of data returned for any column value; it only applies to BINARY, VARBINARY,LONGVARBINARY,CHAR, VARCHAR and LONGVARCHAR columns. If the limit is exceeded, the excess data is silently discarded.

Note: We don't do anything with this value yet.

Returns:
the current max column size limit; zero means unlimited
Exceptions:
SQLException if a database access error occurs

Implements java.sql.Statement.

Definition at line 459 of file org/objectweb/cjdbc/driver/Statement.java.

00460   {
00461     return maxFieldSize;
00462   }

int org.objectweb.cjdbc.driver.Statement.getMaxRows  )  throws SQLException
 

The maxRows limit is set to limit the number of rows that any ResultSet can contain. If the limit is exceeded, the excess rows are silently dropped.

Returns:
the current maximum row limit; zero means unlimited
Exceptions:
SQLException if a database access error occurs

Implements java.sql.Statement.

Definition at line 472 of file org/objectweb/cjdbc/driver/Statement.java.

00473   {
00474     return maxRows;
00475   }

boolean org.objectweb.cjdbc.driver.Statement.getMoreResults int  current  )  throws SQLException
 

Moves to this Statement object's next result, deals with any current ResultSet object(s) according to the instructions specified by the given flag, and returns true if the next result is a ResultSet object.

There are no more results when the following is true:

        (!getMoreResults() && (getUpdateCount() == -1)

 

Parameters:
current one of the following Statement constants indicating what should happen to current ResultSet objects obtained using the method getResultSet</code: CLOSE_CURRENT_RESULT, KEEP_CURRENT_RESULT, or CLOSE_ALL_RESULTS
Returns:
true if the next result is a ResultSet object; false if it is an update count or there are no more results
Exceptions:
SQLException if a database access error occurs
Since:
JDK 1.4
See also:
execute(String)

Implements java.sql.Statement.

Definition at line 732 of file org/objectweb/cjdbc/driver/Statement.java.

00733   {
00734     throw new NotImplementedException("getMoreResults");
00735   }

boolean org.objectweb.cjdbc.driver.Statement.getMoreResults  )  throws SQLException
 

Multiple results are not suppoted so this method always return false and reset the update count to -1. Any open ResultSet is implicitly closed.

Returns:
false
Exceptions:
SQLException if an error occurs

Implements java.sql.Statement.

Definition at line 484 of file org/objectweb/cjdbc/driver/Statement.java.

References org.objectweb.cjdbc.driver.Connection.close(), org.objectweb.cjdbc.driver.Statement.result, and org.objectweb.cjdbc.driver.Statement.updateCount.

00485   {
00486     if (result != null)
00487       result.close();
00488     updateCount = -1;
00489     return false;
00490   }

int org.objectweb.cjdbc.driver.Statement.getQueryTimeout  )  throws SQLException
 

The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute. If the limit is exceeded, a SQLException is thrown.

Returns:
the current query timeout limit in seconds; 0 = unlimited
Exceptions:
SQLException if a database access error occurs

Implements java.sql.Statement.

Definition at line 500 of file org/objectweb/cjdbc/driver/Statement.java.

00501   {
00502     return timeout;
00503   }

java.sql.ResultSet org.objectweb.cjdbc.driver.Statement.getResultSet  )  throws SQLException
 

Returns the current result as a ResultSet.

Returns:
the current result set; null if there are no more
Exceptions:
SQLException never

Implements java.sql.Statement.

Definition at line 511 of file org/objectweb/cjdbc/driver/Statement.java.

Referenced by org.objectweb.cjdbc.driver.PreparedStatement.getMetaData().

00512   {
00513     return result;
00514   }

int org.objectweb.cjdbc.driver.Statement.getResultSetConcurrency  )  throws SQLException
 

Retrieve the concurrency mode for the ResultSet.

Returns:
CONCUR_READ_ONLY or CONCUR_UPDATABLE
Exceptions:
SQLException never

Implements java.sql.Statement.

Definition at line 523 of file org/objectweb/cjdbc/driver/Statement.java.

Referenced by org.objectweb.cjdbc.driver.DriverResultSet.setStatement().

00524   {
00525     return resultSetConcurrency;
00526   }

int org.objectweb.cjdbc.driver.Statement.getResultSetHoldability  )  throws SQLException
 

Retrieves the result set holdability for ResultSet objects generated by this Statement object.

Returns:
either ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
Exceptions:
SQLException if a database access error occurs
Since:
JDK 1.4

Implements java.sql.Statement.

Definition at line 951 of file org/objectweb/cjdbc/driver/Statement.java.

00952   {
00953     throw new NotImplementedException("getResultSetHoldability");
00954   }

int org.objectweb.cjdbc.driver.Statement.getResultSetType  )  throws SQLException
 

Retrieve the type of the generated ResultSet.

Returns:
one of TYPE_FORWARD_ONLY or TYPE_SCROLL_INSENSITIVE
Exceptions:
SQLException never

Implements java.sql.Statement.

Definition at line 535 of file org/objectweb/cjdbc/driver/Statement.java.

Referenced by org.objectweb.cjdbc.driver.DriverResultSet.setStatement().

00536   {
00537     return resultSetType;
00538   }

int org.objectweb.cjdbc.driver.Statement.getUpdateCount  )  throws SQLException
 

Returns the current result as an update count, if the result is a ResultSet or there are no more results, -1 is returned. It should only be called once per result.

Returns:
the current result as an update count.
Exceptions:
SQLException if a database access error occurs

Implements java.sql.Statement.

Definition at line 548 of file org/objectweb/cjdbc/driver/Statement.java.

00549   {
00550     return updateCount;
00551   }

SQLWarning org.objectweb.cjdbc.driver.Statement.getWarnings  )  throws SQLException
 

The first warning reported by calls on this Statement is returned. A Statement's execute methods clear its SQLWarning chain. Subsequent Statement warnings will be chained to this SQLWarning.

The Warning chain is automatically cleared each time a statement is (re)executed.

Note: if you are processing a ResultSet then any warnings associated with ResultSet reads will be chained on the ResultSet object.

Returns:
the first SQLWarning on null
Exceptions:
SQLException if a database access error occurs

Implements java.sql.Statement.

Definition at line 568 of file org/objectweb/cjdbc/driver/Statement.java.

00569   {
00570     return warnings;
00571   }

void org.objectweb.cjdbc.driver.Statement.setCursorName String  name  )  throws SQLException
 

Defines the SQL cursor name that will be used by subsequent execute methods. This name can then be used in SQL positioned update/delete statements to identify the current row in the ResultSet generated by this statement. If a database doesn't support positioned update/delete, this method is a no-op.

Parameters:
name the new cursor name
Exceptions:
SQLException not supported

Implements java.sql.Statement.

Definition at line 584 of file org/objectweb/cjdbc/driver/Statement.java.

00585   {
00586     cursorName = name;
00587   }

void org.objectweb.cjdbc.driver.Statement.setEscapeProcessing boolean  enable  )  throws SQLException
 

If escape scanning is on (the default), the driver will do escape substitution before sending the SQL to the database.

Parameters:
enable true to enable; false to disable
Exceptions:
SQLException if a database access error occurs

Implements java.sql.Statement.

Definition at line 596 of file org/objectweb/cjdbc/driver/Statement.java.

References org.objectweb.cjdbc.driver.Statement.escapeProcessing.

00597   {
00598     escapeProcessing = enable;
00599   }

void org.objectweb.cjdbc.driver.Statement.setFetchDirection int  direction  )  throws SQLException
 

This hint is silently ignored and assumes FETCH_FORWARD which is the way C-JDBC has been optimized for.

Parameters:
direction ignored
Exceptions:
SQLException not supported

Implements java.sql.Statement.

Definition at line 608 of file org/objectweb/cjdbc/driver/Statement.java.

00609   {
00610   }

void org.objectweb.cjdbc.driver.Statement.setFetchSize int  rows  )  throws SQLException
 

Set the default fetch size for the produced ResultSet.

Parameters:
rows ignored
Exceptions:
SQLException not supported

Implements java.sql.Statement.

Definition at line 618 of file org/objectweb/cjdbc/driver/Statement.java.

00619   {
00620     fetchSize = rows;
00621   }

void org.objectweb.cjdbc.driver.Statement.setMaxFieldSize int  max  )  throws SQLException
 

Sets the maxFieldSize.

Parameters:
max the new max column size limit; 0 means unlimited
Exceptions:
SQLException if a database access error occurs

Implements java.sql.Statement.

Definition at line 629 of file org/objectweb/cjdbc/driver/Statement.java.

00630   {
00631     maxFieldSize = max;
00632   }

void org.objectweb.cjdbc.driver.Statement.setMaxRows int  max  )  throws SQLException
 

Sets the maximum number of rows.

Parameters:
max the new max rows limit; 0 means unlimited
Exceptions:
SQLException if a database access error occurs

Implements java.sql.Statement.

Definition at line 640 of file org/objectweb/cjdbc/driver/Statement.java.

00641   {
00642     maxRows = max;
00643   }

void org.objectweb.cjdbc.driver.Statement.setQueryTimeout int  seconds  )  throws SQLException
 

Sets the queryTimeout limit.

Parameters:
seconds the new query timeout limit in seconds (0 means no timeout)
Exceptions:
SQLException if a database access error occurs

Implements java.sql.Statement.

Definition at line 651 of file org/objectweb/cjdbc/driver/Statement.java.

00652   {
00653     timeout = seconds;
00654   }

void org.objectweb.cjdbc.driver.Statement.setResultSetConcurrency int  value  )  throws SQLException
 

Parameters:
value an int value
Exceptions:
SQLException if an error occurs

Definition at line 660 of file org/objectweb/cjdbc/driver/Statement.java.

Referenced by org.objectweb.cjdbc.driver.Connection.createStatement(), org.objectweb.cjdbc.driver.Connection.prepareCall(), and org.objectweb.cjdbc.driver.Connection.prepareStatement().

00661   {
00662     switch (value)
00663     {
00664       case ResultSet.CONCUR_READ_ONLY:
00665       case ResultSet.CONCUR_UPDATABLE:
00666         resultSetConcurrency = value;
00667         break;
00668       default:
00669         throw new SQLException("Invalid ResultSet " +
00670             "concurrency mode: " + value);
00671     }
00672   }

void org.objectweb.cjdbc.driver.Statement.setResultSetType int  value  )  throws SQLException
 

Parameters:
value an int value
Exceptions:
SQLException if an error occurs

Definition at line 678 of file org/objectweb/cjdbc/driver/Statement.java.

Referenced by org.objectweb.cjdbc.driver.Connection.createStatement(), org.objectweb.cjdbc.driver.Connection.prepareCall(), and org.objectweb.cjdbc.driver.Connection.prepareStatement().

00679   {
00680     switch (value)
00681     {
00682       case ResultSet.TYPE_FORWARD_ONLY:
00683       case ResultSet.TYPE_SCROLL_INSENSITIVE:
00684         resultSetType = value;
00685         break;
00686       case ResultSet.TYPE_SCROLL_SENSITIVE:
00687         throw new SQLException(
00688             "TYPE_SCROLL_SENSITIVE is not a supported ResultSet type");
00689       default:
00690         throw new SQLException("Invalid ResultSet type");
00691     }
00692   }


Member Data Documentation

Connection org.objectweb.cjdbc.driver.Statement.connection = null [protected]
 

The connection that created us

Definition at line 65 of file org/objectweb/cjdbc/driver/Statement.java.

Referenced by org.objectweb.cjdbc.driver.Statement.close(), org.objectweb.cjdbc.driver.DriverResultSet.close(), org.objectweb.cjdbc.driver.Statement.executeQuery(), org.objectweb.cjdbc.driver.Statement.executeUpdateWithSkeleton(), org.objectweb.cjdbc.driver.DriverResultSet.getBoolean(), org.objectweb.cjdbc.driver.DriverResultSet.getBytes(), org.objectweb.cjdbc.driver.DriverResultSet.getObject(), org.objectweb.cjdbc.driver.DriverResultSet.next(), and org.objectweb.cjdbc.driver.Statement.Statement().

boolean org.objectweb.cjdbc.driver.Statement.escapeProcessing = true [protected]
 

Should the driver to escape processing before sending to the DB?

Definition at line 102 of file org/objectweb/cjdbc/driver/Statement.java.

Referenced by org.objectweb.cjdbc.driver.Statement.executeQuery(), org.objectweb.cjdbc.driver.Statement.executeUpdateWithSkeleton(), and org.objectweb.cjdbc.driver.Statement.setEscapeProcessing().

ResultSet org.objectweb.cjdbc.driver.Statement.generatedKeys = null [protected]
 

Auto generated keys

Definition at line 105 of file org/objectweb/cjdbc/driver/Statement.java.

Referenced by org.objectweb.cjdbc.driver.Statement.executeUpdateWithSkeleton().

ResultSet org.objectweb.cjdbc.driver.Statement.result = null [protected]
 

The current result for a read request

Definition at line 74 of file org/objectweb/cjdbc/driver/Statement.java.

Referenced by org.objectweb.cjdbc.driver.Statement.close(), org.objectweb.cjdbc.driver.Statement.execute(), org.objectweb.cjdbc.driver.Statement.executeBatch(), org.objectweb.cjdbc.driver.Statement.executeQuery(), org.objectweb.cjdbc.driver.Statement.executeUpdateWithSkeleton(), and org.objectweb.cjdbc.driver.Statement.getMoreResults().

int org.objectweb.cjdbc.driver.Statement.updateCount = -1 [protected]
 

The update count for a write request

Definition at line 77 of file org/objectweb/cjdbc/driver/Statement.java.

Referenced by org.objectweb.cjdbc.driver.Statement.execute(), org.objectweb.cjdbc.driver.Statement.executeQuery(), org.objectweb.cjdbc.driver.Statement.executeUpdateWithSkeleton(), and org.objectweb.cjdbc.driver.Statement.getMoreResults().


The documentation for this class was generated from the following file:
Generated on Mon Apr 11 22:05:07 2005 for C-JDBC by  doxygen 1.3.9.1