java.sql
Interface Statement
java.lang.Object
|
+--java.sql.Statement
public interface Statement
This interface provides a mechanism for executing SQL statements.
Author:- Aaron M. Renn (arenn@urbanophile.com)
CLOSE_ALL_RESULTS
public static final int CLOSE_ALL_RESULTS
CLOSE_CURRENT_RESULT
public static final int CLOSE_CURRENT_RESULT
This interface provides a mechanism for executing SQL statements.
Author:- Aaron M. Renn (arenn@urbanophile.com)
EXECUTE_FAILED
public static final int EXECUTE_FAILED
KEEP_CURRENT_RESULT
public static final int KEEP_CURRENT_RESULT
NO_GENERATED_KEYS
public static final int NO_GENERATED_KEYS
RETURN_GENERATED_KEYS
public static final int RETURN_GENERATED_KEYS
SUCCESS_NO_INFO
public static final int SUCCESS_NO_INFO
addBatch
public void addBatch(java.lang.String sql)
This method adds a SQL statement to a SQL batch. A driver is not
required to implement this method.
Parameters:
Throws:
cancel
public void cancel()
This method cancels an outstanding statement, if the database supports
that operation.
Throws:
clearBatch
public void clearBatch()
This method clears out any SQL statements that have been populated in
the current batch. A driver is not required to implement this method.
Throws:
clearWarnings
public void clearWarnings()
This method clears any SQL warnings that have been attached to this
statement.
Throws:
close
public void close()
This method closes the statement and frees any associated resources.
Throws:
execute
public boolean execute(java.lang.String sql)
This method executes an arbitrary SQL statement of any time. The
methods getResultSet
, getMoreResults
and
getUpdateCount
retrieve the results.
Parameters:
Returns:
true
if a result set was returned, false
if an update count was returned.
Throws:
execute
public boolean execute(java.lang.String sql, int autoGeneratedKeys)
Since:Parameters:
execute
public boolean execute(java.lang.String sql, int[] columnIndexes)
Since:Parameters:
execute
public boolean execute(java.lang.String sql, java.lang.String[] columnNames)
Since:Parameters:
executeBatch
public int[] executeBatch()
This method executes the SQL batch and returns an array of update
counts - one for each SQL statement in the batch - ordered in the same
order the statements were added to the batch. A driver is not required
to implement this method.
Returns:
- An array of update counts for this batch.
Throws:
executeQuery
public ResultSet executeQuery(java.lang.String sql)
This method executes the specified SQL SELECT statement and returns a
(possibly empty) ResultSet
with the results of the query.
Parameters:
Returns:
- The result set of the SQL statement.
Throws:
executeUpdate
public int executeUpdate(java.lang.String sql)
This method executes the specified SQL INSERT, UPDATE, or DELETE statement
and returns the number of rows affected, which may be 0.
Parameters:
Returns:
- The number of rows affected by the SQL statement.
Throws:
executeUpdate
public int executeUpdate(java.lang.String sql, int autoGeneratedKeys)
Since:Parameters:
executeUpdate
public int executeUpdate(java.lang.String sql, int[] columnIndexes)
Since:Parameters:
executeUpdate
public int executeUpdate(java.lang.String sql, java.lang.String[] columnNames)
Since:Parameters:
getConnection
public Connection getConnection()
This method returns the Connection
instance that was
used to create this object.
Returns:
- The connection used to create this object.
Throws:
getFetchDirection
public int getFetchDirection()
This method returns the current direction that the driver thinks the
result set will be accessed int.
Returns:
- The direction the result set will be accessed in (????)
Throws:
getFetchSize
public int getFetchSize()
This method returns the number of rows the driver believes should be
fetched from the database at a time.
Returns:
- The number of rows that will be fetched from the database at a time.
Throws:
getGeneratedKeys
public ResultSet getGeneratedKeys()
Since:
getMaxFieldSize
public int getMaxFieldSize()
This method returns the maximum length of any column value in bytes.
Returns:
- The maximum length of any column value in bytes.
Throws:
getMaxRows
public int getMaxRows()
This method returns the maximum possible number of rows in a result set.
Returns:
- The maximum possible number of rows in a result set.
Throws:
getMoreResults
public boolean getMoreResults()
This method advances the result set pointer to the next result set,
which can then be retrieved using getResultSet
Returns:
true
if there is another result set,
false
otherwise (for example, the next result is an
update count).
Throws:
See Also:
getMoreResults
public boolean getMoreResults(int current)
Since:Parameters:
getQueryTimeout
public int getQueryTimeout()
The method returns the number of seconds a statement may be in process
before timing out. A value of 0 means there is no timeout.
Returns:
- The SQL statement timeout in seconds.
Throws:
getResultSet
public ResultSet getResultSet()
This method returns the result set of the SQL statement that was
executed. This should be called only once per result set returned.
Returns:
- The result set of the query, or
null
if there was
no result set (for example, if the statement was an UPDATE).
Throws:
See Also:
getResultSetConcurrency
public int getResultSetConcurrency()
This method returns the concurrency type of the result set for this
statement. This will be one of the concurrency types defined in
ResultSet
.
Returns:
- The concurrency type of the result set for this statement.
Throws:
See Also:
getResultSetHoldability
public int getResultSetHoldability()
Since:
getResultSetType
public int getResultSetType()
This method returns the result set type for this statement. This will
be one of the result set types defined in ResultSet
.
Returns:
- The result set type for this statement.
Throws:
See Also:
getUpdateCount
public int getUpdateCount()
This method returns the update count of the SQL statement that was
executed. This should be called only once per executed SQL statement.
Returns:
- The update count of the query, or -1 if there was no update
count (for example, if the statement was a SELECT).
Throws:
See Also:
getWarnings
public SQLWarning getWarnings()
This method returns the first SQL warning attached to this statement.
Subsequent warnings will be chained to this one.
Returns:
- The first SQL warning for this statement.
Throws:
setCursorName
public void setCursorName(java.lang.String name)
This method sets the cursor name that will be used by the result set.
Parameters:
Throws:
setEscapeProcessing
public void setEscapeProcessing(boolean enable)
This method sets the local escape processing mode on or off. The
default value is on.
Parameters:
Throws:
setFetchDirection
public void setFetchDirection(int direction)
This method informs the driver which direction the result set will
be accessed in.
Parameters:
Throws:
setFetchSize
public void setFetchSize(int rows)
This method informs the driver how many rows it should fetch from the
database at a time.
Parameters:
Throws:
setMaxFieldSize
public void setMaxFieldSize(int max)
This method sets the limit for the maximum length of any column in bytes.
Parameters:
Throws:
setMaxRows
public void setMaxRows(int max)
This method sets the maximum number of rows that can be present in a
result set.
Parameters:
Throws:
setQueryTimeout
public void setQueryTimeout(int seconds)
This method sets the number of seconds a statement may be in process
before timing out. A value of 0 means there is no timeout.
Parameters:
Throws: