vortex.sql
Class vortexStatement

java.lang.Object
  |
  +--vortex.sql.vortexStatement
Direct Known Subclasses:
vortexPreparedStatement

public class vortexStatement
extends java.lang.Object
implements java.sql.Statement

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.

See Also:
Connection.createStatement(), ResultSet

Field Summary
protected  java.lang.String cName
          Cursor' name
protected  java.sql.Connection conn
          Connection object
protected  dbCursor lcur
          dbCursor object
protected  dbChannel ldb
          DBChannel object
protected  vortexRecord record
          Record object
protected  java.sql.ResultSet result
          ResultSet object
 
Constructor Summary
vortexStatement()
           
vortexStatement(java.sql.Connection con, dbChannel db, int type, int concurrency)
           
 
Method Summary
 void cancel()
          Cancel can be used by one thread to cancel a statement that is being executed by another thread.
 void clearWarnings()
          After this call getWarnings returns null until a new warning is reported for this Statement.
 void close()
          In many cases, it is desirable to immediately release a Statements's database and JDBC resources instead of waiting for this to happen when it is automatically closed; the close method provides this immediate release.
 boolean execute(java.lang.String sql)
          Execute a SQL statement that may return multiple results.
 java.sql.ResultSet executeQuery(java.lang.String sql)
          Execute a SQL statement that returns a single ResultSet.
 int executeUpdate(java.lang.String sql)
          Execute a SQL INSERT, UPDATE or DELETE statement.
 int getMaxFieldSize()
          This does not apply to VORTEXjdbc 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.
 int getMaxRows()
          This does not apply to VORTEXjdbc The maxRows limit is the maximum number of rows that a ResultSet can contain.
 boolean getMoreResults()
          getMoreResults moves to a Statement's next result.
 int getQueryTimeout()
          This does not apply to VORTEXjdbc The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute.
 java.sql.ResultSet getResultSet()
          getResultSet returns the current result as a ResultSet.
 int getUpdateCount()
          getUpdateCount returns the current result, which should be an integer value.
 java.sql.SQLWarning getWarnings()
          The first warning reported by calls on this Statement is returned.
 void setCursorName(java.lang.String name)
          setCursorname defines the SQL cursor name that will be used by subsequent Statement execute methods.
 void setEscapeProcessing(boolean enable)
          This does not apply to VORTEXjdbc If escape scanning is on (the default) the driver will do escape substitution before sending the SQL to the database.
 void setMaxFieldSize(int max)
          This does not apply to VORTEXjdbc The maxFieldSize limit (in bytes) is set to limit the size of data that can be returned for any column value; it only applies to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR fields.
 void setMaxRows(int max)
          This does not apply to VORTEXjdbc The maxRows limit is set to limit the number of rows that any ResultSet can contain.
 void setQueryTimeout(int seconds)
          This does not apply to VORTEXjdbc The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cName

protected java.lang.String cName
Cursor' name

conn

protected java.sql.Connection conn
Connection object

ldb

protected dbChannel ldb
DBChannel object

lcur

protected dbCursor lcur
dbCursor object

result

protected java.sql.ResultSet result
ResultSet object

record

protected vortexRecord record
Record object
Constructor Detail

vortexStatement

public vortexStatement(java.sql.Connection con,
                       dbChannel db,
                       int type,
                       int concurrency)
                throws java.sql.SQLException

vortexStatement

public vortexStatement()
                throws java.sql.SQLException
Method Detail

executeQuery

public java.sql.ResultSet executeQuery(java.lang.String sql)
                                throws java.sql.SQLException
Execute a SQL statement that returns a single ResultSet.
Specified by:
executeQuery in interface java.sql.Statement
Parameters:
sql - typically this is a static SQL SELECT statement
Returns:
the table of data produced by the SQL statement
Throws:
java.sql.SQLException - thrown in the event the dbFetch fails

executeUpdate

public int executeUpdate(java.lang.String sql)
                  throws java.sql.SQLException
Execute a SQL INSERT, UPDATE or DELETE statement. In addition, SQL statements that return nothing such as SQL DDL statements can be executed.
Specified by:
executeUpdate in interface java.sql.Statement
Parameters:
sql - a SQL INSERT, UPDATE or DELETE statement or a SQL statement that returns nothing
Returns:
either the row count for INSERT, UPDATE or DELETE; or 0 for SQL statements that return nothing
Throws:
java.sql.SQLException - thrown in the event the DB action fails

close

public void close()
           throws java.sql.SQLException
In many cases, it is desirable to immediately release a Statements'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.

Specified by:
close in interface java.sql.Statement
Throws:
java.sql.SQLException - Not apply

getMaxFieldSize

public int getMaxFieldSize()
                    throws java.sql.SQLException
This does not apply to VORTEXjdbc

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.

Specified by:
getMaxFieldSize in interface java.sql.Statement
Returns:
the current max column size limit; zero means unlimited
Throws:
java.sql.SQLException - Not apply

setMaxFieldSize

public void setMaxFieldSize(int max)
                     throws java.sql.SQLException
This does not apply to VORTEXjdbc

The maxFieldSize limit (in bytes) is set to limit the size of data that can be returned for any column value; it only applies to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR fields. If the limit is exceeded, the excess data is silently discarded.

Specified by:
setMaxFieldSize in interface java.sql.Statement
Parameters:
max - the new max column size limit; zero means unlimited
Throws:
java.sql.SQLException - Not apply

getMaxRows

public int getMaxRows()
               throws java.sql.SQLException
This does not apply to VORTEXjdbc

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

Specified by:
getMaxRows in interface java.sql.Statement
Returns:
the current max row limit; zero means unlimited
Throws:
java.sql.SQLException - Not apply

setMaxRows

public void setMaxRows(int max)
                throws java.sql.SQLException
This does not apply to VORTEXjdbc

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.

Specified by:
setMaxRows in interface java.sql.Statement
Parameters:
max - the new max rows limit; zero means unlimited
Throws:
java.sql.SQLException - Not apply

setEscapeProcessing

public void setEscapeProcessing(boolean enable)
                         throws java.sql.SQLException
This does not apply to VORTEXjdbc

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

Specified by:
setEscapeProcessing in interface java.sql.Statement
Parameters:
enable - true to enable; false to disable
Throws:
java.sql.SQLException - Not apply

getQueryTimeout

public int getQueryTimeout()
                    throws java.sql.SQLException
This does not apply to VORTEXjdbc

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.

Specified by:
getQueryTimeout in interface java.sql.Statement
Returns:
the current query timeout limit in seconds; zero means unlimited
Throws:
java.sql.SQLException - Not apply

setQueryTimeout

public void setQueryTimeout(int seconds)
                     throws java.sql.SQLException
This does not apply to VORTEXjdbc

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.

Specified by:
setQueryTimeout in interface java.sql.Statement
Parameters:
seconds - the new query timeout limit in seconds; zero means unlimited
Throws:
java.sql.SQLException - Not apply

cancel

public void cancel()
            throws java.sql.SQLException
Cancel can be used by one thread to cancel a statement that is being executed by another thread.
Specified by:
cancel in interface java.sql.Statement
Throws:
java.sql.SQLException - Not apply

getWarnings

public java.sql.SQLWarning getWarnings()
                                throws java.sql.SQLException
The first warning reported by calls on this Statement is returned. A Statment'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.

Specified by:
getWarnings in interface java.sql.Statement
Returns:
the first SQLWarning or null
Throws:
java.sql.SQLException - Not apply

clearWarnings

public void clearWarnings()
                   throws java.sql.SQLException
After this call getWarnings returns null until a new warning is reported for this Statement.
Specified by:
clearWarnings in interface java.sql.Statement
Throws:
java.sql.SQLException - Not apply

setCursorName

public void setCursorName(java.lang.String name)
                   throws java.sql.SQLException
setCursorname defines the SQL cursor name that will be used by subsequent Statement 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 the database doesn't support positioned update/delete, this method is a noop.

Note: By definition, positioned update/delete execution must be done by a different Statement than the one which generated the ResultSet being used for positioning. Also, cursor names must be unique within a Connection.

Specified by:
setCursorName in interface java.sql.Statement
Parameters:
name - the new cursor name.
Throws:
java.sql.SQLException - Not apply

execute

public boolean execute(java.lang.String sql)
                throws java.sql.SQLException
Execute a SQL statement that may return multiple results. Under some (uncommon) situations a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this, unless you're executing a stored procedure that you know may return multiple results, or unless you're dynamically executing an unknown SQL string. The "execute", "getMoreResults", "getResultSet" and "getUpdateCount" methods let you navigate through multiple results. The "execute" method executes a SQL statement and indicates the form of the first result. You can then use getResultSet or getUpdateCount to retrieve the result, and getMoreResults to move to any subsequent result(s).
Specified by:
execute in interface java.sql.Statement
Parameters:
sql - any SQL statement
Returns:
true if the first result is a ResultSet; false if it is an integer
Throws:
java.sql.SQLException - threw exceptions on all DB actions
See Also:
getResultSet(), getUpdateCount(), getMoreResults()

getResultSet

public java.sql.ResultSet getResultSet()
                                throws java.sql.SQLException
getResultSet returns the current result as a ResultSet. It should only be called once per result.
Specified by:
getResultSet in interface java.sql.Statement
Returns:
the current result as a ResultSet; null if it is an integer
Throws:
java.sql.SQLException - Not apply
See Also:
execute(java.lang.String)

getUpdateCount

public int getUpdateCount()
                   throws java.sql.SQLException
getUpdateCount returns the current result, which should be an integer value. It should only be called once per result.

The only way to tell for sure that the result is an update count is to first test to see if it is a ResultSet. If it is not a ResultSet it is an update count.

Specified by:
getUpdateCount in interface java.sql.Statement
Returns:
the current result as an integer; zero if it is a ResultSet
Throws:
java.sql.SQLException - Not apply
See Also:
execute(java.lang.String)

getMoreResults

public boolean getMoreResults()
                       throws java.sql.SQLException
getMoreResults moves to a Statement's next result. It returns true if this result is a ResultSet. getMoreResults also implicitly closes any current ResultSet obtained with getResultSet.
Specified by:
getMoreResults in interface java.sql.Statement
Returns:
true if the next result is a ResultSet; false if it is an integer
Throws:
java.sql.SQLException - threw exception on all DB actions
See Also:
execute(java.lang.String)