ISQLServerStatement
, java.lang.AutoCloseable
, java.sql.Statement
, java.sql.Wrapper
SQLServerPreparedStatement
public class SQLServerStatement extends java.lang.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 |
Modifier and Type | Method | Description |
---|---|---|
void |
addBatch(java.lang.String sql) |
|
void |
cancel() |
|
void |
clearBatch() |
|
void |
clearWarnings() |
|
void |
close() |
|
void |
closeOnCompletion() |
|
boolean |
execute(java.lang.String sql) |
|
boolean |
execute(java.lang.String sql,
int autoGeneratedKeys) |
|
boolean |
execute(java.lang.String sql,
int[] columnIndexes) |
|
boolean |
execute(java.lang.String sql,
java.lang.String[] columnNames) |
|
int[] |
executeBatch() |
Sends a batch of statements to the database.
|
long[] |
executeLargeBatch() |
|
long |
executeLargeUpdate(java.lang.String sql) |
|
long |
executeLargeUpdate(java.lang.String sql,
int autoGeneratedKeys) |
|
long |
executeLargeUpdate(java.lang.String sql,
int[] columnIndexes) |
|
long |
executeLargeUpdate(java.lang.String sql,
java.lang.String[] columnNames) |
|
java.sql.ResultSet |
executeQuery(java.lang.String sql) |
|
int |
executeUpdate(java.lang.String sql) |
|
int |
executeUpdate(java.lang.String sql,
int autoGeneratedKeys) |
|
int |
executeUpdate(java.lang.String sql,
int[] columnIndexes) |
|
int |
executeUpdate(java.lang.String sql,
java.lang.String[] columnNames) |
|
int |
getCancelQueryTimeout() |
Returns the
cancelQueryTimeout property set on this SQLServerStatement object. |
java.sql.Connection |
getConnection() |
Returns the statement's connection.
|
int |
getFetchDirection() |
|
int |
getFetchSize() |
|
java.sql.ResultSet |
getGeneratedKeys() |
|
long |
getLargeMaxRows() |
|
long |
getLargeUpdateCount() |
|
int |
getMaxFieldSize() |
|
int |
getMaxRows() |
|
boolean |
getMoreResults() |
Returns more results in the TDS stream.
|
boolean |
getMoreResults(int mode) |
|
int |
getQueryTimeout() |
|
java.lang.String |
getResponseBuffering() |
Returns the response buffering mode for this SQLServerStatement object.
|
java.sql.ResultSet |
getResultSet() |
|
int |
getResultSetConcurrency() |
|
int |
getResultSetHoldability() |
|
int |
getResultSetType() |
|
protected SQLServerStatementColumnEncryptionSetting |
getStmtColumnEncriptionSetting() |
|
int |
getUpdateCount() |
|
java.sql.SQLWarning |
getWarnings() |
|
boolean |
isClosed() |
|
boolean |
isCloseOnCompletion() |
|
boolean |
isPoolable() |
|
boolean |
isWrapperFor(java.lang.Class<?> iface) |
|
void |
setCancelQueryTimeout(int seconds) |
Sets the
cancelQueryTimeout property on this SQLServerStatement object to cancel
queryTimeout set on Connection or Statement level. |
void |
setCursorName(java.lang.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(java.lang.String value) |
Sets the response buffering mode for this SQLServerStatement object to case-insensitive String full or adaptive.
|
java.lang.String |
toString() |
Returns the statement's id for logging info
|
<T> T |
unwrap(java.lang.Class<T> iface) |
protected SQLServerStatementColumnEncryptionSetting stmtColumnEncriptionSetting
protected SQLServerStatementColumnEncryptionSetting getStmtColumnEncriptionSetting()
public java.lang.String toString()
toString
in class java.lang.Object
public void close() throws SQLServerException
close
in interface java.lang.AutoCloseable
close
in interface java.sql.Statement
SQLServerException
public void closeOnCompletion() throws java.sql.SQLException
closeOnCompletion
in interface java.sql.Statement
java.sql.SQLException
public java.sql.ResultSet executeQuery(java.lang.String sql) throws SQLServerException, java.sql.SQLTimeoutException
executeQuery
in interface java.sql.Statement
SQLServerException
java.sql.SQLTimeoutException
public int executeUpdate(java.lang.String sql) throws SQLServerException, java.sql.SQLTimeoutException
executeUpdate
in interface java.sql.Statement
SQLServerException
java.sql.SQLTimeoutException
public long executeLargeUpdate(java.lang.String sql) throws SQLServerException, java.sql.SQLTimeoutException
executeLargeUpdate
in interface java.sql.Statement
SQLServerException
java.sql.SQLTimeoutException
public boolean execute(java.lang.String sql) throws SQLServerException, java.sql.SQLTimeoutException
execute
in interface java.sql.Statement
SQLServerException
java.sql.SQLTimeoutException
public final int getMaxFieldSize() throws SQLServerException
getMaxFieldSize
in interface java.sql.Statement
SQLServerException
public final void setMaxFieldSize(int max) throws SQLServerException
setMaxFieldSize
in interface java.sql.Statement
SQLServerException
public final int getMaxRows() throws SQLServerException
getMaxRows
in interface java.sql.Statement
SQLServerException
public final long getLargeMaxRows() throws SQLServerException
getLargeMaxRows
in interface java.sql.Statement
SQLServerException
public final void setMaxRows(int max) throws SQLServerException
setMaxRows
in interface java.sql.Statement
SQLServerException
public final void setLargeMaxRows(long max) throws SQLServerException
setLargeMaxRows
in interface java.sql.Statement
SQLServerException
public final void setEscapeProcessing(boolean enable) throws SQLServerException
setEscapeProcessing
in interface java.sql.Statement
SQLServerException
public final int getQueryTimeout() throws SQLServerException
getQueryTimeout
in interface java.sql.Statement
SQLServerException
public final void setQueryTimeout(int seconds) throws SQLServerException
setQueryTimeout
in interface java.sql.Statement
SQLServerException
public final int getCancelQueryTimeout() throws SQLServerException
ISQLServerStatement
cancelQueryTimeout
property set on this SQLServerStatement object.getCancelQueryTimeout
in interface ISQLServerStatement
SQLServerException
- if any error occurspublic final void setCancelQueryTimeout(int seconds) throws SQLServerException
ISQLServerStatement
cancelQueryTimeout
property on this SQLServerStatement object to cancel
queryTimeout
set on Connection
or Statement
level.setCancelQueryTimeout
in interface ISQLServerStatement
seconds
- Time duration in seconds.SQLServerException
- if any error occurspublic final void cancel() throws SQLServerException
cancel
in interface java.sql.Statement
SQLServerException
public final java.sql.SQLWarning getWarnings() throws SQLServerException
getWarnings
in interface java.sql.Statement
SQLServerException
public final void clearWarnings() throws SQLServerException
clearWarnings
in interface java.sql.Statement
SQLServerException
public final void setCursorName(java.lang.String name) throws SQLServerException
setCursorName
in interface java.sql.Statement
SQLServerException
public final java.sql.ResultSet getResultSet() throws SQLServerException
getResultSet
in interface java.sql.Statement
SQLServerException
public final int getUpdateCount() throws SQLServerException
getUpdateCount
in interface java.sql.Statement
SQLServerException
public final long getLargeUpdateCount() throws SQLServerException
getLargeUpdateCount
in interface java.sql.Statement
SQLServerException
public final boolean getMoreResults() throws SQLServerException
getMoreResults
in interface java.sql.Statement
SQLServerException
public final void setFetchDirection(int nDir) throws SQLServerException
setFetchDirection
in interface java.sql.Statement
SQLServerException
public final int getFetchDirection() throws SQLServerException
getFetchDirection
in interface java.sql.Statement
SQLServerException
public final void setFetchSize(int rows) throws SQLServerException
setFetchSize
in interface java.sql.Statement
SQLServerException
public final int getFetchSize() throws SQLServerException
getFetchSize
in interface java.sql.Statement
SQLServerException
public final int getResultSetConcurrency() throws SQLServerException
getResultSetConcurrency
in interface java.sql.Statement
SQLServerException
public final int getResultSetType() throws SQLServerException
getResultSetType
in interface java.sql.Statement
SQLServerException
public void addBatch(java.lang.String sql) throws SQLServerException
addBatch
in interface java.sql.Statement
SQLServerException
public void clearBatch() throws SQLServerException
clearBatch
in interface java.sql.Statement
SQLServerException
public int[] executeBatch() throws SQLServerException, java.sql.BatchUpdateException, java.sql.SQLTimeoutException
executeBatch
in interface java.sql.Statement
SQLServerException
java.sql.BatchUpdateException
java.sql.SQLTimeoutException
public long[] executeLargeBatch() throws SQLServerException, java.sql.BatchUpdateException, java.sql.SQLTimeoutException
executeLargeBatch
in interface java.sql.Statement
SQLServerException
java.sql.BatchUpdateException
java.sql.SQLTimeoutException
public final java.sql.Connection getConnection() throws SQLServerException
getConnection
in interface java.sql.Statement
SQLServerException
- when an error occurspublic final int getResultSetHoldability() throws java.sql.SQLException
getResultSetHoldability
in interface java.sql.Statement
java.sql.SQLException
public final boolean execute(java.lang.String sql, int autoGeneratedKeys) throws SQLServerException, java.sql.SQLTimeoutException
execute
in interface java.sql.Statement
SQLServerException
java.sql.SQLTimeoutException
public final boolean execute(java.lang.String sql, int[] columnIndexes) throws SQLServerException, java.sql.SQLTimeoutException
execute
in interface java.sql.Statement
SQLServerException
java.sql.SQLTimeoutException
public final boolean execute(java.lang.String sql, java.lang.String[] columnNames) throws SQLServerException, java.sql.SQLTimeoutException
execute
in interface java.sql.Statement
SQLServerException
java.sql.SQLTimeoutException
public final int executeUpdate(java.lang.String sql, int autoGeneratedKeys) throws SQLServerException, java.sql.SQLTimeoutException
executeUpdate
in interface java.sql.Statement
SQLServerException
java.sql.SQLTimeoutException
public final long executeLargeUpdate(java.lang.String sql, int autoGeneratedKeys) throws SQLServerException, java.sql.SQLTimeoutException
executeLargeUpdate
in interface java.sql.Statement
SQLServerException
java.sql.SQLTimeoutException
public final int executeUpdate(java.lang.String sql, int[] columnIndexes) throws SQLServerException, java.sql.SQLTimeoutException
executeUpdate
in interface java.sql.Statement
SQLServerException
java.sql.SQLTimeoutException
public final long executeLargeUpdate(java.lang.String sql, int[] columnIndexes) throws SQLServerException, java.sql.SQLTimeoutException
executeLargeUpdate
in interface java.sql.Statement
SQLServerException
java.sql.SQLTimeoutException
public final int executeUpdate(java.lang.String sql, java.lang.String[] columnNames) throws SQLServerException, java.sql.SQLTimeoutException
executeUpdate
in interface java.sql.Statement
SQLServerException
java.sql.SQLTimeoutException
public final long executeLargeUpdate(java.lang.String sql, java.lang.String[] columnNames) throws SQLServerException, java.sql.SQLTimeoutException
executeLargeUpdate
in interface java.sql.Statement
SQLServerException
java.sql.SQLTimeoutException
public final java.sql.ResultSet getGeneratedKeys() throws SQLServerException
getGeneratedKeys
in interface java.sql.Statement
SQLServerException
public final boolean getMoreResults(int mode) throws java.sql.SQLException
getMoreResults
in interface java.sql.Statement
java.sql.SQLException
public boolean isClosed() throws java.sql.SQLException
isClosed
in interface java.sql.Statement
java.sql.SQLException
public boolean isCloseOnCompletion() throws java.sql.SQLException
isCloseOnCompletion
in interface java.sql.Statement
java.sql.SQLException
public boolean isPoolable() throws java.sql.SQLException
isPoolable
in interface java.sql.Statement
java.sql.SQLException
public void setPoolable(boolean poolable) throws java.sql.SQLException
setPoolable
in interface java.sql.Statement
java.sql.SQLException
public boolean isWrapperFor(java.lang.Class<?> iface) throws java.sql.SQLException
isWrapperFor
in interface java.sql.Wrapper
java.sql.SQLException
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException
unwrap
in interface java.sql.Wrapper
java.sql.SQLException
public final void setResponseBuffering(java.lang.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 java.lang.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.