All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.imaginary.sql.msql.MsqlStatement

com.imaginary.sql.msql.MsqlStatement

public class MsqlStatement
The MsqlStatement class implements the JDBC Statement interface. This class represents any SQL statement. This class does minimal locking designed simply around its asynchronous result set processing. Applications should make sure either that multiple threads do not share a Statement or that they do careful synchronization. When synchronizing on the statement, be careful not to grab any long-held locks on it or you might prevent data loading.
Last modified $Date: 1999/07/09 23:16:38 $

Version:
$Revision: 1.1.2.1.2.2 $
Author:
George Reese (borg@imaginary.com)

Variable Index

 o log

Method Index

 o addBatch(String)
Adds a SQL string to the list of SQL statements that should be executed as part of the next batch operation.
 o cancel()
mSQL statement processing must run through to its natural conclusion.
 o clearBatch()
Clears the batch list.
 o clearWarnings()
mSQL does not generated any warnings, so this method is always a NO-OP.
 o close()
Closes the statement.
 o execute(String)
Sends some random SQL to the database
 o executeBatch()
Executes the batch statements added to this Statement via addBatch().
 o executeQuery(String)
Executes a query and returns a result set matching the type and concurrency characteristics of this Statement.
 o executeUpdate(String)
Sends an UPDATE to the database.
 o getConnection()
This method has changed between mSQL-JDBC 1.x and 2.x to reflect the fact that this is actually a JDBC method as of JDBC 2.0.
 o getEncoding()
 o getMaxFieldSize()
 o getMaxRows()
 o getMoreResults()
 o getQueryTimeout()
The query timeout is the number of seconds a statement should wait before aborting the execution of a statement.
 o getResultSet()
Call this method after using the execute() method to send SQL to the database and finding that a result set was created.
 o getUpdateCount()
Call this method after using the execute() method to send SQL to the database and finding that rows were updated.
 o getWarnings()
mSQL does not generate warnings, so this method always returns null.
 o setCursorName(String)
This method is required by the JDBC 2.0 specification but is not a supported feature of mSQL.
 o setEscapeProcessing(boolean)
Toggles on and off escape substitution before sending SQL to the database.
 o setMaxFieldSize(int)
Sets the maximum field size for certain data types.
 o setMaxRows(int)
Sets the maximum number of rows to be returned by results generated by this statement.
 o setQueryTimeout(int)
This is a NO-OP since mSQL queries must run to their conclusion.

Variables

 o log
 protected MsqlLog log

Methods

 o addBatch
 public void addBatch(String sql) throws SQLException
Adds a SQL string to the list of SQL statements that should be executed as part of the next batch operation. These statements should only ever be updates.

Parameters:
sql - the SQL statement to be added to the batch
Throws: SQLException
this is never thrown
 o cancel
 public void cancel() throws SQLException
mSQL statement processing must run through to its natural conclusion. This method thus simply waits until it is safe to use this Statement for other things. In other words, its behaviour is consistent with JDBC compliant drivers but it is not exactly what the JDBC authors had in mind for a cancel operation.

Throws: SQLException
this is never thrown
 o clearBatch
 public void clearBatch() throws SQLException
Clears the batch list.

Throws: SQLException
this is never thrown
 o clearWarnings
 public void clearWarnings() throws SQLException
mSQL does not generated any warnings, so this method is always a NO-OP.

Throws: SQLException
this is never thrown
 o close
 public void close() throws SQLException
Closes the statement. This method will wait until all results have been loaded from the database in order to avoid screwing up the mSQL protocol.

Throws: SQLException
this should never actually be thrown
 o execute
 public boolean execute(String sql) throws SQLException
Sends some random SQL to the database

Parameters:
sql - the SQL to be sent to the database
Returns:
true if the SQL produced a result set
Throws: SQLException
an error occurred talking to the database
 o executeBatch
 public int[] executeBatch() throws SQLException
Executes the batch statements added to this Statement via addBatch().

Returns:
an array of update counts for each batch
Throws: SQLException
one or more of the batch processes failed
 o executeQuery
 public synchronized ResultSet executeQuery(String sql) throws SQLException
Executes a query and returns a result set matching the type and concurrency characteristics of this Statement.

Parameters:
sql - the SQL to send to the database
Returns:
a ResultSet matching the query
Throws: SQLException
an erroroccurred talking to the database
 o executeUpdate
 public int executeUpdate(String sql) throws SQLException
Sends an UPDATE to the database.

Parameters:
sql - the UPDATE SQL
Returns:
the numberof affected rows
Throws: SQLException
an error occurred talking to the database
 o getConnection
 public Connection getConnection()
This method has changed between mSQL-JDBC 1.x and 2.x to reflect the fact that this is actually a JDBC method as of JDBC 2.0. This change should have no effect on even the most poorly designed users of mSQL-JDBC.

Returns:
the MsqlConnection that owns this Statement
 o getEncoding
 public String getEncoding()
Returns:
the encoding for this application
 o getMaxFieldSize
 public int getMaxFieldSize() throws SQLException
Returns:
the maximum field size allowed for BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR columns
Throws: SQLException
this is never thrown
 o getMaxRows
 public int getMaxRows() throws SQLException
Returns:
the maximum number of rows for a result set created by this statement
Throws: SQLException
this is never thrown
 o getMoreResults
 public boolean getMoreResults() throws SQLException
Returns:
true if there are more results to process
Throws: SQLException
this will not be thrown
 o getQueryTimeout
 public int getQueryTimeout() throws SQLException
The query timeout is the number of seconds a statement should wait before aborting the execution of a statement. If the limit is encountered, processing ends and an exception is thrown.

Returns:
the query timeout
Throws: SQLException
this is never thrown
 o getResultSet
 public ResultSet getResultSet() throws SQLException
Call this method after using the execute() method to send SQL to the database and finding that a result set was created. Watch your synchronization in this event. If you call execute() and then another thread uses this Statement to issue a new query before you call getResultSet(), you will find no results.

Returns:
a result set matching the most recent query
Throws: SQLException
no result set was waiting
 o getUpdateCount
 public int getUpdateCount() throws SQLException
Call this method after using the execute() method to send SQL to the database and finding that rows were updated. This method will tell you how many rows were modified. Watch your synchronization in this event. If you call execute() and then another thread uses this Statement to issue new SQL before you call getUpdateCount(), you will get a meaningless answer.

Returns:
the number of rows affected by the last SQL sent to execute()
 o getWarnings
 public final SQLWarning getWarnings() throws SQLException
mSQL does not generate warnings, so this method always returns null.

Returns:
null
Throws: SQLException
this is never thrown
 o setQueryTimeout
 public void setQueryTimeout(int unused) throws SQLException
This is a NO-OP since mSQL queries must run to their conclusion.

Parameters:
unused - the number of seconds the Statement should wait
Throws: SQLException
this is never thrown
 o setCursorName
 public void setCursorName(String unused) throws SQLException
This method is required by the JDBC 2.0 specification but is not a supported feature of mSQL. It is therefore a NO-OP as specified by the JDBC 2.0 specification.

Parameters:
unused - the name of the cursor
Throws: SQLException
this is never thrown
 o setEscapeProcessing
 public void setEscapeProcessing(boolean enable) throws SQLException
Toggles on and off escape substitution before sending SQL to the database. The driver does not yet support this.

Parameters:
enable - indicate whether to enable or disable escape processing
Throws: SQLException
escape processing not supported
 o setMaxFieldSize
 public void setMaxFieldSize(int max) throws SQLException
Sets the maximum field size for certain data types. If data of that type is retrieved from the database and it exceeds this value, the excess data will be silently discarded.

Parameters:
max - the maximum field size
Throws: SQLException
this is never thrown
 o setMaxRows
 public void setMaxRows(int max) throws SQLException
Sets the maximum number of rows to be returned by results generated by this statement. It will silently discard excess rows.

Parameters:
max - the maximum number of rows
Throws: SQLException
this is never thrown

All Packages  Class Hierarchy  This Package  Previous  Next  Index