|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sas.rio.MVAStatement
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 statement execute methods implicitly close a statment's current ResultSet if an open one exists.
Connection.createStatement()
,
ResultSet
Field Summary |
Fields inherited from interface java.sql.Statement |
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO |
Constructor Summary |
Method Summary | |
void |
addBatch(String sql)
JDBC 2.0 Adds a SQL command to the current batch of commmands for the statement. |
void |
cancel()
Cancel can be used by one thread to cancel a statement that is being executed by another thread. |
void |
clearBatch()
JDBC 2.0 Make the set of commands in the current batch empty. |
void |
clearWarnings()
Clears the warnings 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. |
void |
createTable(String libref,
String tableName,
Column[] columnObject,
String options)
RIO Creates a new table with the name specified in the tableName String. |
void |
deleteTable(String libref,
String tableName)
Deletes the table with the name specified in the tableName String. |
void |
deleteTable(String libref,
String tableName,
String tableType,
String alterPassword)
RIO Deletes the table for the specified tableType with the name specified in the tableName String. |
boolean |
execute(String sql)
Execute a SQL statement that may return multiple results. |
boolean |
execute(String sql,
int autoGeneratedKeys)
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. |
boolean |
execute(String sql,
int[] columnIndexes)
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. |
boolean |
execute(String sql,
String[] columnNames)
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. |
int[] |
executeBatch()
JDBC 2.0 Submit a batch of commands to the database for execution. |
ResultSet |
executeQuery(String query)
Execute a SQL statement that returns a single ResultSet. |
int |
executeUpdate(String sql)
Executes an SQL INSERT, UPDATE or DELETE statement. |
int |
executeUpdate(String sql,
int autoGeneratedKeys)
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. |
int |
executeUpdate(String sql,
int[] columnIndexes)
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. |
int |
executeUpdate(String sql,
String[] columnNames)
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. |
Connection |
getConnection()
JDBC 2.0 Return the Connection that produced the Statement. |
int |
getFetchDirection()
JDBC 2.0 Gets the result set fetch direction. |
int |
getFetchSize()
JDBC 2.0 Gets the fetch size. |
ResultSet |
getGeneratedKeys()
Retrieves any auto-generated keys created as a result of executing this Statement object. |
int |
getMaxFieldSize()
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()
The maxRows limit is the maximum number of rows that a ResultSet can contain. |
boolean |
getMoreResults()
Moves to a Statement's next result. |
boolean |
getMoreResults(int current)
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. |
int |
getQueryTimeout()
Gets the query timeout limit. |
ResultSet |
getResultSet()
Gets the current result as a ResultSet. |
int |
getResultSetConcurrency()
JDBC 2.0 Gets the result set concurrency type. |
int |
getResultSetHoldability()
Retrieves the result set holdability for ResultSet objects generated by this Statement object. |
int |
getResultSetType()
JDBC 2.0 Gets the result set type. |
ResultSet |
getTable(String libref,
String tableName)
RIO Gets an MVAResultSet object for the given table name.By default all the columns and all rows are selected. |
ResultSet |
getTable(String libref,
String tableName,
String tableType,
String[] password,
String options)
RIO Gets an MVAResultSet object for the given table name. |
int |
getUpdateCount()
Gets the current result as an update count.If the result is a ResultSet or there are no more results, -1 is returned. |
SQLWarning |
getWarnings()
Gets the warnings for this statement. |
void |
setCursorName(String name)
Sets the cursor name. |
void |
setEscapeProcessing(boolean enable)
If escape scanning is on (the default), the driver will do escape substitution before sending the SQL to the database. |
void |
setFetchDirection(int direction)
JDBC 2.0 Give a hint as to the direction in which the rows in a result set will be processed. |
void |
setFetchSize(int rows)
JDBC 2.0 Give 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)
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)
The maxRows limit is set to limit the number of rows that any ResultSet can contain. |
void |
setQueryTimeout(int seconds)
Sets the query timeout limit. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
Constructor Detail |
Method Detail |
public ResultSet executeQuery(String query) throws SQLException
executeQuery
in interface Statement
query
- Typically this is a static SQL SELECT statement.SQLException
- This exception is thrown if an MVAException is detected.public int executeUpdate(String sql) throws SQLException
executeUpdate
in interface Statement
sql
- A SQL INSERT, UPDATE or DELETE statement.SQLException
- This exception is thrown if an exception is detected.public void close() throws SQLException
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.
close
in interface Statement
SQLException
- This exception is thrown if an error condition is detected.public int getMaxFieldSize() throws SQLException
getMaxFieldSize
in interface Statement
SQLException
- This exception is required by the interface but it is never thrown.public void setMaxFieldSize(int max) throws SQLException
setMaxFieldSize
in interface Statement
max
- The new max column size limit. Zero means unlimited.SQLException
- This exception is thrown if the max field size is less than 0.public int getMaxRows() throws SQLException
getMaxRows
in interface Statement
SQLException
- This exception is required by the interface but it is never thrown.public void setMaxRows(int max) throws SQLException
setMaxRows
in interface Statement
max
- The new max rows limit. Zero means unlimited.SQLException
- This exception is thrown if the max rows is less than 0.public void setEscapeProcessing(boolean enable) throws SQLException
setEscapeProcessing
in interface Statement
enable
- The value for this parameter must be False.SQLException
- This exception is thrown if value of enable is True.public int getQueryTimeout() throws SQLException
getQueryTimeout
in interface Statement
SQLException
- if a database-access error occurs.public void setQueryTimeout(int seconds) throws SQLException
setQueryTimeout
in interface Statement
seconds
- The value of this parameter must be 0. Timeout is currently not supported.SQLException
- This exception is thrown if value of seconds is not equal to 0.public void cancel() throws SQLException
cancel
in interface Statement
SQLException
- This exception may be thrown.public SQLWarning getWarnings() throws SQLException
getWarnings
in interface Statement
SQLException
- This exception is required by the interface, but it is never thrown.public void clearWarnings() throws SQLException
clearWarnings
in interface Statement
SQLException
- This exception is required by the interface, but it is never thrown.public void setCursorName(String name) throws SQLException
setCursorName
in interface Statement
name
- The new cursor name.SQLException
- This exception is required by the interface, but it is never thrown.public boolean execute(String sql) throws SQLException
execute
in interface Statement
sql
- An SQL statementSQLException
- This exception is thrown if an MvaException is detected.getResultSet()
,
getUpdateCount()
,
getMoreResults()
public ResultSet getResultSet() throws SQLException
getResultSet
in interface Statement
SQLException
- This exception is required by the interface but it is never thrown.execute(java.lang.String)
public int getUpdateCount() throws SQLException
getUpdateCount
in interface Statement
SQLException
- This exception is required by the interface but it is never thrown.execute(java.lang.String)
public boolean getMoreResults() throws SQLException
getMoreResults
in interface Statement
SQLException
- This exception may be thrown.execute(java.lang.String)
public void setFetchDirection(int direction) throws SQLException
setFetchDirection
in interface Statement
direction
- The initial direction for processing rows.SQLException
- This exception is thrown if the direction
is not one of ResultSet.FETCH_FORWARD, ResultSet.FETCH_REVERSE, or
ResultSet.FETCH_UNKNOWN.public int getFetchDirection() throws SQLException
getFetchDirection
in interface Statement
SQLException
- This exception is required by the interface but it is never thrown.public void setFetchSize(int rows) throws SQLException
setFetchSize
in interface Statement
rows
- The number of rows to fetch.SQLException
- This exception is thrown if the
condition 0 <= rows <= this.getMaxRows() is not satisfied.public int getFetchSize() throws SQLException
getFetchSize
in interface Statement
SQLException
- This exception is required by the interface but it is never thrown.public int getResultSetConcurrency() throws SQLException
getResultSetConcurrency
in interface Statement
SQLException
- This exception is required by the interface but it is never thrown.public int getResultSetType() throws SQLException
getResultSetType
in interface Statement
SQLException
- This exception is required by the interface but it is never thrown.public void addBatch(String sql) throws SQLException
addBatch
in interface Statement
sql
- typically this is a static SQL INSERT or UPDATE statementSQLException
- if a database-access error occurs, or the
driver does not support batch statementspublic void clearBatch() throws SQLException
clearBatch
in interface Statement
SQLException
- if a database-access error occurs, or the
driver does not support batch statementspublic int[] executeBatch() throws SQLException, BatchUpdateException
executeBatch
in interface Statement
SQLException
- if a database-access error occurs, or the
driver does not support batch statementspublic Connection getConnection() throws SQLException
getConnection
in interface Statement
SQLException
- This exception is required by the interface but it is never thrown.public void createTable(String libref, String tableName, Column[] columnObject, String options) throws RIOException
createTable
in interface RIOStatementInterface
libref
- The libref name. Cannot be NULL.tableName
- The name of the table to be created. Table name cannot be NULL.columnObject
- A Column Object array containing column names and attributes. Column object
cannot be NULL.options
- A String of applicaaple SAS dataset options. May be NULL.RIOException
- This exception may be thrown.public ResultSet getTable(String libref, String tableName) throws RIOException
getTable
in interface RIOStatementInterface
libref
- The libref name. Cannot be NULL.tableName
- The name of the table. Table name cannot be NULL.
By default, the driver looks for a dataset to open, if one doesn't exist it looks for a
view to open. If both exist, it opens a dataset.RIOException
- This exception may be thrown.public ResultSet getTable(String libref, String tableName, String tableType, String[] password, String options) throws RIOException
getTable
in interface RIOStatementInterface
libref
- The libref name. Cannot be NULL.tableName
- The name of the table to be opened.tableType
- The type of the table to be opened.It could be "DATA" or "VIEW".
If NULL, the driver looks for a dataset to open, if one doesn't exist it looks for a
view to open. If both exist, it opens a dataset. This parameter is currently being ignored and
defaulted to NULL.password
- A String array of 3 elements specifying READ, WRITE and ALTER passwords if any.
This parameter can be NULL. The first element is the READ password, the second the WRITE password
and the third the ALTER password.options
- A String whose contents can be any SAS dataset options appropriate to the
underlying engine and library. This includes the WHERE clause. options can be NULL.RIOException
- This exception may be thrown.public void deleteTable(String libref, String tableName) throws RIOException
deleteTable
in interface RIOStatementInterface
libref
- The libref name. Cannot be NULL.tableName
- The name of the table to be deleted. By default,
the tableName dataset will be deleted.RIOException
- This exception may be thrown.public void deleteTable(String libref, String tableName, String tableType, String alterPassword) throws RIOException
deleteTable
in interface RIOStatementInterface
libref
- The libref name. Cannot be NULL.tableName
- The name of the table to be deleted.tableType
- The type of the table. It could be "DATA" or "VIEW" or any table type
available in the database. If NULL, the tableName dataset will be deleted.alterPassword
- The alter password.RIOException
- This exception may be thrown.public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException
executeUpdate
in interface Statement
SQLException
- Always thrown, to indicate that this method is not implemented.public int executeUpdate(String sql, int[] columnIndexes) throws SQLException
executeUpdate
in interface Statement
SQLException
- Always thrown, to indicate that this method is not implemented.public int executeUpdate(String sql, String[] columnNames) throws SQLException
executeUpdate
in interface Statement
SQLException
- Always thrown, to indicate that this method is not implemented.public boolean execute(String sql, int autoGeneratedKeys) throws SQLException
execute
in interface Statement
SQLException
- Always thrown, to indicate that this method is not implemented.public boolean execute(String sql, int[] columnIndexes) throws SQLException
execute
in interface Statement
SQLException
- Always thrown, to indicate that this method is not implemented.public boolean execute(String sql, String[] columnNames) throws SQLException
execute
in interface Statement
SQLException
- Always thrown, to indicate that this method is not implemented.public ResultSet getGeneratedKeys() throws SQLException
getGeneratedKeys
in interface Statement
SQLException
- Always thrown, to indicate that this method is not implemented.public boolean getMoreResults(int current) throws SQLException
getMoreResults
in interface Statement
SQLException
- Always thrown, to indicate that this method is not implemented.public int getResultSetHoldability() throws SQLException
getResultSetHoldability
in interface Statement
SQLException
- Always thrown, to indicate that this method is not implemented.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |