|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.wham.jdbc.Statement
The object used for executing a static SQL statement and obtaining the results produced by it. Creation date: (11/21/2002 11:05:35 AM)
Constructor Summary | |
Statement(Connection con)
Statement constructor comment. |
Method Summary | |
void |
addBatch(java.lang.String sql)
JDBC 2.0 Adds a SQL command to the current batch of commmands for the statement. |
void |
cancel()
Cancels this Statement object if both the DBMS and
driver support aborting an SQL statement. |
void |
clearBatch()
JDBC 2.0 Makes the set of commands in the current batch empty. |
void |
clearWarnings()
Clears all the warnings reported on this Statement
object. |
void |
close()
Releases this Statement object's database
and JDBC resources immediately instead of waiting for
this to happen when it is automatically closed. |
boolean |
execute(java.lang.String sql)
Executes a SQL statement that may return multiple results. |
int[] |
executeBatch()
JDBC 2.0 Submits a batch of commands to the database for execution. |
java.sql.ResultSet |
executeQuery(java.lang.String sql)
Executes a SQL statement that returns a single ResultSet. |
int |
executeUpdate(java.lang.String sql)
Executes an SQL INSERT, UPDATE or DELETE statement. |
java.sql.Connection |
getConnection()
JDBC 2.0 Returns the Connection object
that produced this Statement object. |
int |
getFetchDirection()
JDBC 2.0 Retrieves the direction for fetching rows from database tables that is the default for result sets generated from this Statement object. |
int |
getFetchSize()
JDBC 2.0 Retrieves the number of result set rows that is the default fetch size for result sets generated from this Statement object. |
int |
getMaxFieldSize()
Returns the maximum number of bytes allowed for any column value. |
int |
getMaxRows()
Retrieves the maximum number of rows that a ResultSet can contain. |
boolean |
getMoreResults()
Moves to a Statement's next result. |
int |
getQueryTimeout()
Retrieves the number of seconds the driver will wait for a Statement to execute. |
java.sql.ResultSet |
getResultSet()
Returns the current result as a ResultSet object. |
int |
getResultSetConcurrency()
JDBC 2.0 Retrieves the result set concurrency. |
int |
getResultSetType()
JDBC 2.0 Determine the result set type. |
int |
getUpdateCount()
Returns the current result as an update count; if the result is a ResultSet or there are no more results, -1 is returned. |
java.sql.SQLWarning |
getWarnings()
Retrieves the first warning reported by calls on this Statement. |
void |
setCursorName(java.lang.String name)
Defines the SQL cursor name that will be used by subsequent Statement execute methods. |
void |
setEscapeProcessing(boolean enable)
Sets escape processing on or off. |
void |
setFetchDirection(int direction)
JDBC 2.0 Gives the driver a hint as to the direction in which the rows in a result set will be processed. |
void |
setFetchSize(int rows)
JDBC 2.0 Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed. |
void |
setMaxFieldSize(int max)
Sets the limit for the maximum number of bytes in a column to the given number of bytes. |
void |
setMaxRows(int max)
Sets the limit for the maximum number of rows that any ResultSet can contain to the given number. |
void |
setQueryTimeout(int seconds)
Sets the number of seconds the driver will wait for a Statement to execute to the given number of seconds. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public Statement(Connection con) throws java.sql.SQLException
Method Detail |
public void addBatch(java.lang.String sql) throws java.sql.SQLException
sql
- typically this is a static SQL INSERT or UPDATE statementpublic void cancel() throws java.sql.SQLException
Statement
object if both the DBMS and
driver support aborting an SQL statement.
This method can be used by one thread to cancel a statement that
is being executed by another thread.public void clearBatch() throws java.sql.SQLException
public void clearWarnings() throws java.sql.SQLException
Statement
object. After a call to this method,
the method getWarnings
will return
null until a new warning is reported for this Statement.public void close() throws java.sql.SQLException
Statement
object's database
and JDBC resources immediately instead of waiting for
this to happen when it is automatically closed.
It is generally good practice to release resources as soon as
you are finished with them to avoid tying up database
resources.
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.
public boolean execute(java.lang.String sql) throws java.sql.SQLException
execute
,
getMoreResults
, getResultSet
,
and getUpdateCount
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).sql
- any SQL statementgetResultSet()
,
getUpdateCount()
,
getMoreResults()
public int[] executeBatch() throws java.sql.SQLException
public java.sql.ResultSet executeQuery(java.lang.String sql) throws java.sql.SQLException
sql
- typically this is a static SQL SELECT statementpublic int executeUpdate(java.lang.String sql) throws java.sql.SQLException
sql
- a SQL INSERT, UPDATE or DELETE statement or a SQL
statement that returns nothingpublic java.sql.Connection getConnection() throws java.sql.SQLException
Connection
object
that produced this Statement
object.public int getFetchDirection() throws java.sql.SQLException
Statement
object.
If this Statement
object has not set
a fetch direction by calling the method setFetchDirection
,
the return value is implementation-specific.Statement
objectpublic int getFetchSize() throws java.sql.SQLException
Statement
object.
If this Statement
object has not set
a fetch size by calling the method setFetchSize
,
the return value is implementation-specific.Statement
objectpublic int getMaxFieldSize() throws java.sql.SQLException
public int getMaxRows() throws java.sql.SQLException
public boolean getMoreResults() throws java.sql.SQLException
execute(java.lang.String)
public int getQueryTimeout() throws java.sql.SQLException
public java.sql.ResultSet getResultSet() throws java.sql.SQLException
ResultSet
object.
This method should be called only once per result.execute(java.lang.String)
public int getResultSetConcurrency() throws java.sql.SQLException
public int getResultSetType() throws java.sql.SQLException
public int getUpdateCount() throws java.sql.SQLException
execute(java.lang.String)
public java.sql.SQLWarning getWarnings() throws java.sql.SQLException
The warning chain is automatically cleared each time a statement is (re)executed.
Note: If you are processing a ResultSet, any warnings associated with ResultSet reads will be chained on the ResultSet object.
public void setCursorName(java.lang.String name) throws java.sql.SQLException
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. To insure that a cursor has the proper isolation
level to support updates, the cursor's SELECT statement should be
of the form 'select for update ...'. If the 'for update' phrase is
omitted, positioned updates may fail.
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.
name
- the new cursor name, which must be unique within
a connectionpublic void setEscapeProcessing(boolean enable) throws java.sql.SQLException
enable
- true to enable; false to disablepublic void setFetchDirection(int direction) throws java.sql.SQLException
Note that this method sets the default fetch direction for
result sets generated by this Statement
object.
Each result set has its own methods for getting and setting
its own fetch direction.
direction
- the initial direction for processing rowspublic void setFetchSize(int rows) throws java.sql.SQLException
rows
- the number of rows to fetchpublic void setMaxFieldSize(int max) throws java.sql.SQLException
max
- the new max column size limit; zero means unlimitedpublic void setMaxRows(int max) throws java.sql.SQLException
max
- the new max rows limit; zero means unlimitedpublic void setQueryTimeout(int seconds) throws java.sql.SQLException
seconds
- the new query timeout limit in seconds; zero means
unlimited
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2019 , WhamTech, Inc. All rights reserved. This
document is provided for information purposes only and the contents hereof are
subject to change without notice. Names may be
trademarks of their respective owners.