ISQLServerStatement
, AutoCloseable
, Statement
, Wrapper
SQLServerPreparedStatement
public class SQLServerStatement extends Object implements ISQLServerStatement
Implementation Notes
Fetching Result sets
The queries first rowset is available immediately after the executeQuery. The first rs.next() does not make a server round trip. For non server side resultsets the entire result set is in the rowset. For server side result sets the number of rows in the rowset is set with nFetchSize
The API javadoc for JDBC API methods that this class implements are not repeated here. Please see Sun's JDBC API interfaces javadoc for those details.
Modifier and Type | Field | Description |
---|---|---|
protected SQLServerStatementColumnEncryptionSetting |
stmtColumnEncriptionSetting |
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
Modifier and Type | Method | Description |
---|---|---|
void |
addBatch(String sql) |
|
void |
cancel() |
|
void |
clearBatch() |
|
void |
clearWarnings() |
|
void |
close() |
|
void |
closeOnCompletion() |
|
boolean |
execute(String sql) |
Execute an update or query.
|
boolean |
execute(String sql,
int autoGeneratedKeys) |
|
boolean |
execute(String sql,
int[] columnIndexes) |
|
boolean |
execute(String sql,
String[] columnNames) |
|
int[] |
executeBatch() |
Send a batch of statements to the database.
|
long[] |
executeLargeBatch() |
|
long |
executeLargeUpdate(String sql) |
Execute a JDBC update
|
long |
executeLargeUpdate(String sql,
int autoGeneratedKeys) |
|
long |
executeLargeUpdate(String sql,
int[] columnIndexes) |
|
long |
executeLargeUpdate(String sql,
String[] columnNames) |
|
ResultSet |
executeQuery(String sql) |
Execute a result set query
|
int |
executeUpdate(String sql) |
Execute a JDBC update
|
int |
executeUpdate(String sql,
int autoGeneratedKeys) |
|
int |
executeUpdate(String sql,
int[] columnIndexes) |
|
int |
executeUpdate(String sql,
String[] columnNames) |
|
Connection |
getConnection() |
Return the statement's connection
|
int |
getFetchDirection() |
|
int |
getFetchSize() |
|
ResultSet |
getGeneratedKeys() |
|
long |
getLargeMaxRows() |
|
long |
getLargeUpdateCount() |
|
int |
getMaxFieldSize() |
|
int |
getMaxRows() |
|
boolean |
getMoreResults() |
Check for more results in the TDS stream
|
boolean |
getMoreResults(int mode) |
|
int |
getQueryTimeout() |
|
String |
getResponseBuffering() |
Retrieves the response buffering mode for this SQLServerStatement object.
|
ResultSet |
getResultSet() |
|
int |
getResultSetConcurrency() |
|
int |
getResultSetHoldability() |
|
int |
getResultSetType() |
|
int |
getUpdateCount() |
|
SQLWarning |
getWarnings() |
|
boolean |
isClosed() |
|
boolean |
isCloseOnCompletion() |
|
boolean |
isPoolable() |
|
boolean |
isWrapperFor(Class<?> iface) |
|
void |
setCursorName(String name) |
|
void |
setEscapeProcessing(boolean enable) |
|
void |
setFetchDirection(int nDir) |
|
void |
setFetchSize(int rows) |
|
void |
setLargeMaxRows(long max) |
|
void |
setMaxFieldSize(int max) |
|
void |
setMaxRows(int max) |
|
void |
setPoolable(boolean poolable) |
|
void |
setQueryTimeout(int seconds) |
|
void |
setResponseBuffering(String value) |
Sets the response buffering mode for this SQLServerStatement object to case-insensitive String full or adaptive.
|
String |
toString() |
The statement's id for logging info
|
<T> T |
unwrap(Class<T> iface) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, isSimpleIdentifier
protected SQLServerStatementColumnEncryptionSetting stmtColumnEncriptionSetting
public String toString()
public void close() throws SQLServerException
close
in interface AutoCloseable
close
in interface Statement
SQLServerException
public void closeOnCompletion() throws SQLException
closeOnCompletion
in interface Statement
SQLException
public ResultSet executeQuery(String sql) throws SQLServerException, SQLTimeoutException
executeQuery
in interface Statement
sql
- the SQL querySQLServerException
- The SQL was invalid.SQLTimeoutException
public int executeUpdate(String sql) throws SQLServerException, SQLTimeoutException
executeUpdate
in interface Statement
sql
- the SQL querySQLServerException
- The SQL was invalid.SQLTimeoutException
public long executeLargeUpdate(String sql) throws SQLServerException, SQLTimeoutException
executeLargeUpdate
in interface Statement
sql
- the SQL querySQLServerException
- The SQL was invalid.SQLTimeoutException
public boolean execute(String sql) throws SQLServerException, SQLTimeoutException
execute
in interface Statement
sql
- The update or query.SQLServerException
- The SQL statement was not valid.SQLTimeoutException
public final int getMaxFieldSize() throws SQLServerException
getMaxFieldSize
in interface Statement
SQLServerException
public final void setMaxFieldSize(int max) throws SQLServerException
setMaxFieldSize
in interface Statement
SQLServerException
public final int getMaxRows() throws SQLServerException
getMaxRows
in interface Statement
SQLServerException
public final long getLargeMaxRows() throws SQLServerException
getLargeMaxRows
in interface Statement
SQLServerException
public final void setMaxRows(int max) throws SQLServerException
setMaxRows
in interface Statement
SQLServerException
public final void setLargeMaxRows(long max) throws SQLServerException
setLargeMaxRows
in interface Statement
SQLServerException
public final void setEscapeProcessing(boolean enable) throws SQLServerException
setEscapeProcessing
in interface Statement
SQLServerException
public final int getQueryTimeout() throws SQLServerException
getQueryTimeout
in interface Statement
SQLServerException
public final void setQueryTimeout(int seconds) throws SQLServerException
setQueryTimeout
in interface Statement
SQLServerException
public final void cancel() throws SQLServerException
cancel
in interface Statement
SQLServerException
public final SQLWarning getWarnings() throws SQLServerException
getWarnings
in interface Statement
SQLServerException
public final void clearWarnings() throws SQLServerException
clearWarnings
in interface Statement
SQLServerException
public final void setCursorName(String name) throws SQLServerException
setCursorName
in interface Statement
SQLServerException
public final ResultSet getResultSet() throws SQLServerException
getResultSet
in interface Statement
SQLServerException
public final int getUpdateCount() throws SQLServerException
getUpdateCount
in interface Statement
SQLServerException
public final long getLargeUpdateCount() throws SQLServerException
getLargeUpdateCount
in interface Statement
SQLServerException
public final boolean getMoreResults() throws SQLServerException
getMoreResults
in interface Statement
SQLServerException
public final void setFetchDirection(int nDir) throws SQLServerException
setFetchDirection
in interface Statement
SQLServerException
public final int getFetchDirection() throws SQLServerException
getFetchDirection
in interface Statement
SQLServerException
public final void setFetchSize(int rows) throws SQLServerException
setFetchSize
in interface Statement
SQLServerException
public final int getFetchSize() throws SQLServerException
getFetchSize
in interface Statement
SQLServerException
public final int getResultSetConcurrency() throws SQLServerException
getResultSetConcurrency
in interface Statement
SQLServerException
public final int getResultSetType() throws SQLServerException
getResultSetType
in interface Statement
SQLServerException
public void addBatch(String sql) throws SQLServerException
addBatch
in interface Statement
SQLServerException
public void clearBatch() throws SQLServerException
clearBatch
in interface Statement
SQLServerException
public int[] executeBatch() throws SQLServerException, BatchUpdateException, SQLTimeoutException
executeBatch
in interface Statement
SQLServerException
BatchUpdateException
SQLTimeoutException
public long[] executeLargeBatch() throws SQLServerException, BatchUpdateException, SQLTimeoutException
executeLargeBatch
in interface Statement
SQLServerException
BatchUpdateException
SQLTimeoutException
public final Connection getConnection() throws SQLServerException
getConnection
in interface Statement
SQLServerException
- when an error occurspublic final int getResultSetHoldability() throws SQLException
getResultSetHoldability
in interface Statement
SQLException
public final boolean execute(String sql, int autoGeneratedKeys) throws SQLServerException, SQLTimeoutException
execute
in interface Statement
SQLServerException
SQLTimeoutException
public final boolean execute(String sql, int[] columnIndexes) throws SQLServerException, SQLTimeoutException
execute
in interface Statement
SQLServerException
SQLTimeoutException
public final boolean execute(String sql, String[] columnNames) throws SQLServerException, SQLTimeoutException
execute
in interface Statement
SQLServerException
SQLTimeoutException
public final int executeUpdate(String sql, int autoGeneratedKeys) throws SQLServerException, SQLTimeoutException
executeUpdate
in interface Statement
SQLServerException
SQLTimeoutException
public final long executeLargeUpdate(String sql, int autoGeneratedKeys) throws SQLServerException, SQLTimeoutException
executeLargeUpdate
in interface Statement
SQLServerException
SQLTimeoutException
public final int executeUpdate(String sql, int[] columnIndexes) throws SQLServerException, SQLTimeoutException
executeUpdate
in interface Statement
SQLServerException
SQLTimeoutException
public final long executeLargeUpdate(String sql, int[] columnIndexes) throws SQLServerException, SQLTimeoutException
executeLargeUpdate
in interface Statement
SQLServerException
SQLTimeoutException
public final int executeUpdate(String sql, String[] columnNames) throws SQLServerException, SQLTimeoutException
executeUpdate
in interface Statement
SQLServerException
SQLTimeoutException
public final long executeLargeUpdate(String sql, String[] columnNames) throws SQLServerException, SQLTimeoutException
executeLargeUpdate
in interface Statement
SQLServerException
SQLTimeoutException
public final ResultSet getGeneratedKeys() throws SQLServerException
getGeneratedKeys
in interface Statement
SQLServerException
public final boolean getMoreResults(int mode) throws SQLServerException
getMoreResults
in interface Statement
SQLServerException
public boolean isClosed() throws SQLException
isClosed
in interface Statement
SQLException
public boolean isCloseOnCompletion() throws SQLException
isCloseOnCompletion
in interface Statement
SQLException
public boolean isPoolable() throws SQLException
isPoolable
in interface Statement
SQLException
public void setPoolable(boolean poolable) throws SQLException
setPoolable
in interface Statement
SQLException
public boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor
in interface Wrapper
SQLException
public <T> T unwrap(Class<T> iface) throws SQLException
unwrap
in interface Wrapper
SQLException
public final void setResponseBuffering(String value) throws SQLServerException
ISQLServerStatement
Response buffering controls the driver's buffering of responses from SQL Server.
Possible values are:
"full" - Fully buffer the response at execution time.
"adaptive" - Data Pipe adaptive buffering
setResponseBuffering
in interface ISQLServerStatement
value
- A String that contains the response buffering mode. The valid mode can be one of the following case-insensitive Strings: full or
adaptive.SQLServerException
- If there are any errors in setting the response buffering mode.public final String getResponseBuffering() throws SQLServerException
ISQLServerStatement
getResponseBuffering
in interface ISQLServerStatement
SQLServerException
- If there are any errors in retrieving the response buffering mode.Copyright © 2018 Microsoft Corporation. All rights reserved.