ISQLServerPreparedStatement
, ISQLServerStatement
, AutoCloseable
, PreparedStatement
, Statement
, Wrapper
SQLServerCallableStatement
public class SQLServerPreparedStatement extends SQLServerStatement implements ISQLServerPreparedStatement
SQLServerPreparedStatement prepares a statement using SQL Server's sp_prepexec and re-uses the returned statement handle for each subsequent execution of the statement (typically using different parameters provided by the user)
SQLServerPreparedStatement supports batching whereby a set of prepared statements are executed in a single database round trip to improve runtime performance.
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.
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() |
|
void |
addBatch(String sql) |
|
void |
clearBatch() |
|
void |
clearParameters() |
|
boolean |
execute() |
|
boolean |
execute(String sql) |
|
int[] |
executeBatch() |
Send a batch of statements to the database.
|
long[] |
executeLargeBatch() |
|
long |
executeLargeUpdate() |
|
ResultSet |
executeQuery() |
|
ResultSet |
executeQuery(String sql) |
|
int |
executeUpdate() |
|
int |
executeUpdate(String sql) |
|
ResultSetMetaData |
getMetaData() |
|
ParameterMetaData |
getParameterMetaData() |
|
ParameterMetaData |
getParameterMetaData(boolean forceRefresh) |
Returns parameter metadata for the prepared statement.
|
int |
getPreparedStatementHandle() |
The server handle for this prepared statement.
|
void |
setArray(int i,
Array x) |
|
void |
setAsciiStream(int parameterIndex,
InputStream x) |
|
void |
setAsciiStream(int n,
InputStream x,
int length) |
|
void |
setAsciiStream(int parameterIndex,
InputStream x,
long length) |
|
void |
setBigDecimal(int paramterIndex,
BigDecimal x) |
|
void |
setBigDecimal(int paramterIndex,
BigDecimal x,
int precision,
int scale) |
Sets the designated parameter to the given
java.math.BigDecimal value. |
void |
setBigDecimal(int paramterIndex,
BigDecimal x,
int precision,
int scale,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.math.BigDecimal value. |
void |
setBinaryStream(int parameterIndex,
InputStream x) |
|
void |
setBinaryStream(int n,
InputStream x,
int length) |
|
void |
setBinaryStream(int parameterIndex,
InputStream x,
long length) |
|
void |
setBlob(int parameterIndex,
InputStream inputStream) |
|
void |
setBlob(int parameterIndex,
InputStream inputStream,
long length) |
|
void |
setBlob(int i,
Blob x) |
|
void |
setBoolean(int n,
boolean x) |
|
void |
setBoolean(int n,
boolean x,
boolean forceEncrypt) |
Sets the designated parameter to the given Java
boolean value. |
void |
setByte(int n,
byte x) |
|
void |
setByte(int n,
byte x,
boolean forceEncrypt) |
Sets the designated parameter to the given Java
byte value. |
void |
setBytes(int n,
byte[] x) |
|
void |
setBytes(int n,
byte[] x,
boolean forceEncrypt) |
Sets the designated parameter to the given Java array of bytes.
|
void |
setCharacterStream(int parameterIndex,
Reader reader) |
|
void |
setCharacterStream(int n,
Reader reader,
int length) |
|
void |
setCharacterStream(int parameterIndex,
Reader reader,
long length) |
|
void |
setClob(int parameterIndex,
Reader reader) |
|
void |
setClob(int parameterIndex,
Reader reader,
long length) |
|
void |
setClob(int parameterIndex,
Clob clobValue) |
|
void |
setDate(int n,
Date x) |
|
void |
setDate(int n,
Date x,
Calendar cal) |
|
void |
setDate(int n,
Date x,
Calendar cal,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.sql.Date value, using the given Calendar object. |
void |
setDateTime(int n,
Timestamp x) |
Sets the designated parameter to the given
java.sql.Timestamp value |
void |
setDateTime(int n,
Timestamp x,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.sql.Timestamp value |
void |
setDateTimeOffset(int n,
DateTimeOffset x) |
Sets the designated parameter to the given
microsoft.sql.DateTimeOffset value. |
void |
setDateTimeOffset(int n,
DateTimeOffset x,
int scale) |
Sets the designated parameter to the given
microsoft.sql.DatetimeOffset value |
void |
setDateTimeOffset(int n,
DateTimeOffset x,
int scale,
boolean forceEncrypt) |
Sets the designated parameter to the given
microsoft.sql.DatetimeOffset value |
void |
setDouble(int n,
double x) |
|
void |
setDouble(int n,
double x,
boolean forceEncrypt) |
Sets the designated parameter to the given Java
double value. |
void |
setFloat(int n,
float x) |
|
void |
setFloat(int n,
float x,
boolean forceEncrypt) |
Sets the designated parameter to the given Java
float value. |
void |
setGeography(int n,
Geography x) |
Sets the designated parameter to the given
microsoft.sql.Geography Class object. |
void |
setGeometry(int n,
Geometry x) |
Sets the designated parameter to the given
microsoft.sql.Geometry Class object. |
void |
setInt(int n,
int value) |
|
void |
setInt(int n,
int value,
boolean forceEncrypt) |
Sets the designated parameter to the given Java
int value. |
void |
setLong(int n,
long x) |
|
void |
setLong(int n,
long x,
boolean forceEncrypt) |
Sets the designated parameter to the given Java
long value. |
void |
setMoney(int n,
BigDecimal x) |
Sets the designated parameter to the given
java.math.BigDecimal value. |
void |
setMoney(int n,
BigDecimal x,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.math.BigDecimal value. |
void |
setNCharacterStream(int parameterIndex,
Reader value) |
|
void |
setNCharacterStream(int parameterIndex,
Reader value,
long length) |
|
void |
setNClob(int parameterIndex,
Reader reader) |
|
void |
setNClob(int parameterIndex,
Reader reader,
long length) |
|
void |
setNClob(int parameterIndex,
NClob value) |
|
void |
setNString(int parameterIndex,
String value) |
|
void |
setNString(int parameterIndex,
String value,
boolean forceEncrypt) |
Sets the designated parameter to the given
String object. |
void |
setNull(int index,
int jdbcType) |
|
void |
setNull(int paramIndex,
int sqlType,
String typeName) |
|
void |
setObject(int index,
Object obj) |
|
void |
setObject(int n,
Object obj,
int jdbcType) |
|
void |
setObject(int parameterIndex,
Object x,
int targetSqlType,
int scaleOrLength) |
|
void |
setObject(int parameterIndex,
Object x,
int targetSqlType,
Integer precision,
int scale) |
Sets the value of the designated parameter with the given object.
|
void |
setObject(int parameterIndex,
Object x,
int targetSqlType,
Integer precision,
int scale,
boolean forceEncrypt) |
Sets the value of the designated parameter with the given object.
|
void |
setObject(int index,
Object obj,
SQLType jdbcType) |
|
void |
setObject(int parameterIndex,
Object x,
SQLType targetSqlType,
int scaleOrLength) |
|
void |
setObject(int parameterIndex,
Object x,
SQLType targetSqlType,
Integer precision,
Integer scale) |
Sets the value of the designated parameter with the given object.
|
void |
setObject(int parameterIndex,
Object x,
SQLType targetSqlType,
Integer precision,
Integer scale,
boolean forceEncrypt) |
Sets the value of the designated parameter with the given object.
|
void |
setRef(int i,
Ref x) |
|
void |
setRowId(int parameterIndex,
RowId x) |
|
void |
setShort(int index,
short x) |
|
void |
setShort(int index,
short x,
boolean forceEncrypt) |
Sets the designated parameter to the given Java
short value. |
void |
setSmallDateTime(int n,
Timestamp x) |
Sets the designated parameter to the given
java.sql.Timestamp value |
void |
setSmallDateTime(int n,
Timestamp x,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.sql.Timestamp value |
void |
setSmallMoney(int n,
BigDecimal x) |
Sets the designated parameter to the given
java.math.BigDecimal value. |
void |
setSmallMoney(int n,
BigDecimal x,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.math.BigDecimal value. |
void |
setSQLXML(int parameterIndex,
SQLXML xmlObject) |
|
void |
setString(int index,
String str) |
|
void |
setString(int index,
String str,
boolean forceEncrypt) |
Sets the designated parameter to the given Java
String value. |
void |
setStructured(int n,
String tvpName,
ISQLServerDataRecord tvpBulkRecord) |
Populates a table valued parameter with a data table
|
void |
setStructured(int n,
String tvpName,
SQLServerDataTable tvpDataTable) |
Populates a table valued parameter with a data table
|
void |
setStructured(int n,
String tvpName,
ResultSet tvpResultSet) |
Populates a table valued parameter with a data table
|
void |
setTime(int n,
Time x) |
|
void |
setTime(int n,
Time x,
int scale) |
Sets the designated parameter to the given
java.sql.Time value |
void |
setTime(int n,
Time x,
int scale,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.sql.Time value |
void |
setTime(int n,
Time x,
Calendar cal) |
|
void |
setTime(int n,
Time x,
Calendar cal,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.sql.Time value. |
void |
setTimestamp(int n,
Timestamp x) |
|
void |
setTimestamp(int n,
Timestamp x,
int scale) |
Sets the designated parameter to the given
java.sql.Timestamp value |
void |
setTimestamp(int n,
Timestamp x,
int scale,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.sql.Timestamp value |
void |
setTimestamp(int n,
Timestamp x,
Calendar cal) |
|
void |
setTimestamp(int n,
Timestamp x,
Calendar cal,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.sql.Timestamp value. |
void |
setUnicodeStream(int n,
InputStream x,
int length) |
Deprecated.
|
void |
setUniqueIdentifier(int index,
String guid) |
Sets the designated parameter to the given String.
|
void |
setUniqueIdentifier(int index,
String guid,
boolean forceEncrypt) |
Sets the designated parameter to the given String.
|
void |
setURL(int parameterIndex,
URL x) |
getCancelQueryTimeout, getResponseBuffering, setCancelQueryTimeout, setResponseBuffering
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
cancel, clearWarnings, close, closeOnCompletion, execute, execute, execute, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeUpdate, executeUpdate, executeUpdate, getCancelQueryTimeout, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResponseBuffering, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getStmtColumnEncriptionSetting, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isPoolable, isWrapperFor, setCancelQueryTimeout, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout, setResponseBuffering, toString, unwrap
cancel, clearWarnings, close, closeOnCompletion, enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, execute, execute, execute, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isPoolable, isSimpleIdentifier, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout
isWrapperFor, unwrap
public int getPreparedStatementHandle() throws SQLServerException
ISQLServerPreparedStatement
getPreparedStatementHandle
in interface ISQLServerPreparedStatement
SQLServerException
- when an error occurspublic final void clearParameters() throws SQLServerException
clearParameters
in interface PreparedStatement
SQLServerException
public ResultSet executeQuery() throws SQLServerException, SQLTimeoutException
executeQuery
in interface PreparedStatement
SQLServerException
SQLTimeoutException
public int executeUpdate() throws SQLServerException, SQLTimeoutException
executeUpdate
in interface PreparedStatement
SQLServerException
SQLTimeoutException
public long executeLargeUpdate() throws SQLServerException, SQLTimeoutException
executeLargeUpdate
in interface PreparedStatement
SQLServerException
SQLTimeoutException
public boolean execute() throws SQLServerException, SQLTimeoutException
execute
in interface PreparedStatement
SQLServerException
SQLTimeoutException
public final ResultSetMetaData getMetaData() throws SQLServerException
getMetaData
in interface PreparedStatement
SQLServerException
public final void setAsciiStream(int parameterIndex, InputStream x) throws SQLException
setAsciiStream
in interface PreparedStatement
SQLException
public final void setAsciiStream(int n, InputStream x, int length) throws SQLServerException
setAsciiStream
in interface PreparedStatement
SQLServerException
public final void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException
setAsciiStream
in interface PreparedStatement
SQLException
public final void setBigDecimal(int paramterIndex, BigDecimal x) throws SQLServerException
setBigDecimal
in interface PreparedStatement
SQLServerException
public final void setBigDecimal(int paramterIndex, BigDecimal x, int precision, int scale) throws SQLServerException
ISQLServerPreparedStatement
java.math.BigDecimal
value. The driver converts this to an SQL NUMERIC
value when it sends it to the database.setBigDecimal
in interface ISQLServerPreparedStatement
paramterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter valueprecision
- the precision of the columnscale
- the scale of the columnSQLServerException
- when an error occurspublic final void setBigDecimal(int paramterIndex, BigDecimal x, int precision, int scale, boolean forceEncrypt) throws SQLServerException
ISQLServerPreparedStatement
java.math.BigDecimal
value. The driver converts this to an SQL NUMERIC
value when it sends it to the database.setBigDecimal
in interface ISQLServerPreparedStatement
paramterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter valueprecision
- the precision of the columnscale
- the scale of the columnforceEncrypt
- If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column is encrypted and Always
Encrypted is enabled on the connection or on the statement. If the boolean forceEncrypt is set to false, the driver will not force
encryption on parameters.SQLServerException
- when an error occurspublic final void setMoney(int n, BigDecimal x) throws SQLServerException
ISQLServerPreparedStatement
java.math.BigDecimal
value. The driver converts this to an SQL NUMERIC
value when it sends it to the database.setMoney
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valueSQLServerException
- when an error occurspublic final void setMoney(int n, BigDecimal x, boolean forceEncrypt) throws SQLServerException
ISQLServerPreparedStatement
java.math.BigDecimal
value. The driver converts this to an SQL NUMERIC
value when it sends it to the database.setMoney
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valueforceEncrypt
- If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column is encrypted and Always
Encrypted is enabled on the connection or on the statement. If the boolean forceEncrypt is set to false, the driver will not force
encryption on parameters.SQLServerException
- when an error occurspublic final void setSmallMoney(int n, BigDecimal x) throws SQLServerException
ISQLServerPreparedStatement
java.math.BigDecimal
value. The driver converts this to an SQL NUMERIC
value when it sends it to the database.setSmallMoney
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valueSQLServerException
- when an error occurspublic final void setSmallMoney(int n, BigDecimal x, boolean forceEncrypt) throws SQLServerException
ISQLServerPreparedStatement
java.math.BigDecimal
value. The driver converts this to an SQL NUMERIC
value when it sends it to the database.setSmallMoney
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valueforceEncrypt
- If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column is encrypted and Always
Encrypted is enabled on the connection or on the statement. If the boolean forceEncrypt is set to false, the driver will not force
encryption on parameters.SQLServerException
- when an error occurspublic final void setBinaryStream(int parameterIndex, InputStream x) throws SQLException
setBinaryStream
in interface PreparedStatement
SQLException
public final void setBinaryStream(int n, InputStream x, int length) throws SQLServerException
setBinaryStream
in interface PreparedStatement
SQLServerException
public final void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException
setBinaryStream
in interface PreparedStatement
SQLException
public final void setBoolean(int n, boolean x) throws SQLServerException
setBoolean
in interface PreparedStatement
SQLServerException
public final void setBoolean(int n, boolean x, boolean forceEncrypt) throws SQLServerException
ISQLServerPreparedStatement
boolean
value. The driver converts this to an SQL BIT
or
BOOLEAN
value when it sends it to the database.setBoolean
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valueforceEncrypt
- If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column is encrypted and Always
Encrypted is enabled on the connection or on the statement. If the boolean forceEncrypt is set to false, the driver will not force
encryption on parameters.SQLServerException
- when an error occurspublic final void setByte(int n, byte x) throws SQLServerException
setByte
in interface PreparedStatement
SQLServerException
public final void setByte(int n, byte x, boolean forceEncrypt) throws SQLServerException
ISQLServerPreparedStatement
byte
value. The driver converts this to an SQL TINYINT
value when it
sends it to the database.setByte
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valueforceEncrypt
- If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column is encrypted and Always
Encrypted is enabled on the connection or on the statement. If the boolean forceEncrypt is set to false, the driver will not force
encryption on parameters.SQLServerException
- when an error occurspublic final void setBytes(int n, byte[] x) throws SQLServerException
setBytes
in interface PreparedStatement
SQLServerException
public final void setBytes(int n, byte[] x, boolean forceEncrypt) throws SQLServerException
ISQLServerPreparedStatement
VARBINARY
or
LONGVARBINARY
(depending on the argument's size relative to the driver's limits on VARBINARY
values) when it sends it
to the database.setBytes
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valueforceEncrypt
- If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column is encrypted and Always
Encrypted is enabled on the connection or on the statement. If the boolean forceEncrypt is set to false, the driver will not force
encryption on parameters.SQLServerException
- when an error occurspublic final void setUniqueIdentifier(int index, String guid) throws SQLServerException
ISQLServerPreparedStatement
GUID
setUniqueIdentifier
in interface ISQLServerPreparedStatement
index
- the first parameter is 1, the second is 2, ...guid
- string representation of the uniqueIdentifier valueSQLServerException
- when an error occurspublic final void setUniqueIdentifier(int index, String guid, boolean forceEncrypt) throws SQLServerException
ISQLServerPreparedStatement
GUID
setUniqueIdentifier
in interface ISQLServerPreparedStatement
index
- the first parameter is 1, the second is 2, ...guid
- string representation of the uniqueIdentifier valueforceEncrypt
- If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column is encrypted and Always
Encrypted is enabled on the connection or on the statement. If the boolean forceEncrypt is set to false, the driver will not force
encryption on parameters.SQLServerException
- when an error occurspublic final void setDouble(int n, double x) throws SQLServerException
setDouble
in interface PreparedStatement
SQLServerException
public final void setDouble(int n, double x, boolean forceEncrypt) throws SQLServerException
ISQLServerPreparedStatement
double
value. The driver converts this to an SQL DOUBLE
value when it
sends it to the database.setDouble
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valueforceEncrypt
- If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column is encrypted and Always
Encrypted is enabled on the connection or on the statement. If the boolean forceEncrypt is set to false, the driver will not force
encryption on parameters.SQLServerException
- when an error occurspublic final void setFloat(int n, float x) throws SQLServerException
setFloat
in interface PreparedStatement
SQLServerException
public final void setFloat(int n, float x, boolean forceEncrypt) throws SQLServerException
ISQLServerPreparedStatement
float
value. The driver converts this to an SQL REAL
value when it
sends it to the database.setFloat
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valueforceEncrypt
- If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column is encrypted and Always
Encrypted is enabled on the connection or on the statement. If the boolean forceEncrypt is set to false, the driver will not force
encryption on parameters.SQLServerException
- when an error occurspublic final void setGeometry(int n, Geometry x) throws SQLServerException
ISQLServerPreparedStatement
microsoft.sql.Geometry
Class object. The driver converts this to an SQL
REAL
value when it sends it to the database.setGeometry
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valueSQLServerException
- when an error occurspublic final void setGeography(int n, Geography x) throws SQLServerException
ISQLServerPreparedStatement
microsoft.sql.Geography
Class object. The driver converts this to an SQL
REAL
value when it sends it to the database.setGeography
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valueSQLServerException
- when an error occurspublic final void setInt(int n, int value) throws SQLServerException
setInt
in interface PreparedStatement
SQLServerException
public final void setInt(int n, int value, boolean forceEncrypt) throws SQLServerException
ISQLServerPreparedStatement
int
value. The driver converts this to an SQL INTEGER
value when it
sends it to the database.setInt
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...value
- the parameter valueforceEncrypt
- If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column is encrypted and Always
Encrypted is enabled on the connection or on the statement. If the boolean forceEncrypt is set to false, the driver will not force
encryption on parameters.SQLServerException
- when an error occurspublic final void setLong(int n, long x) throws SQLServerException
setLong
in interface PreparedStatement
SQLServerException
public final void setLong(int n, long x, boolean forceEncrypt) throws SQLServerException
ISQLServerPreparedStatement
long
value. The driver converts this to an SQL BIGINT
value when it
sends it to the database.setLong
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valueforceEncrypt
- If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column is encrypted and Always
Encrypted is enabled on the connection or on the statement. If the boolean forceEncrypt is set to false, the driver will not force
encryption on parameters.SQLServerException
- when an error occurspublic final void setNull(int index, int jdbcType) throws SQLServerException
setNull
in interface PreparedStatement
SQLServerException
public final void setObject(int index, Object obj) throws SQLServerException
setObject
in interface PreparedStatement
SQLServerException
public final void setObject(int n, Object obj, int jdbcType) throws SQLServerException
setObject
in interface PreparedStatement
SQLServerException
public final void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLServerException
setObject
in interface PreparedStatement
SQLServerException
public final void setObject(int parameterIndex, Object x, int targetSqlType, Integer precision, int scale) throws SQLServerException
ISQLServerPreparedStatement
Sets the value of the designated parameter with the given object.
The given Java object will be converted to the given targetSqlType before being sent to the database.
If the object has a custom mapping (is of a class implementing the interface SQLData
), the JDBC driver should call the method
SQLData.writeSQL
to write it to the SQL data stream. If, on the other hand, the object is of a class implementing
Ref
, Blob
, Clob
, NClob
, Struct
, java.net.URL
, or
Array
, the driver should pass it to the database as a value of the corresponding SQL type.
Note that this method may be used to pass database-specific abstract data types.
setObject
in interface ISQLServerPreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the object containing the input parameter valuetargetSqlType
- the SQL type (as defined in java.sql.Types) to be sent to the database. The scale argument may further qualify this type.precision
- the precision of the columnscale
- scale of the columnSQLServerException
- when an error occurspublic final void setObject(int parameterIndex, Object x, int targetSqlType, Integer precision, int scale, boolean forceEncrypt) throws SQLServerException
ISQLServerPreparedStatement
Sets the value of the designated parameter with the given object.
The given Java object will be converted to the given targetSqlType before being sent to the database.
If the object has a custom mapping (is of a class implementing the interface SQLData
), the JDBC driver should call the method
SQLData.writeSQL
to write it to the SQL data stream. If, on the other hand, the object is of a class implementing
Ref
, Blob
, Clob
, NClob
, Struct
, java.net.URL
, or
Array
, the driver should pass it to the database as a value of the corresponding SQL type.
Note that this method may be used to pass database-specific abstract data types.
setObject
in interface ISQLServerPreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the object containing the input parameter valuetargetSqlType
- the SQL type (as defined in java.sql.Types) to be sent to the database. The scale argument may further qualify this type.precision
- the precision of the columnscale
- scale of the columnforceEncrypt
- If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column is encrypted and Always
Encrypted is enabled on the connection or on the statement. If the boolean forceEncrypt is set to false, the driver will not force
encryption on parameters.SQLServerException
- when an error occurspublic final void setObject(int index, Object obj, SQLType jdbcType) throws SQLServerException
setObject
in interface PreparedStatement
SQLServerException
public final void setObject(int parameterIndex, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLServerException
setObject
in interface PreparedStatement
SQLServerException
public final void setObject(int parameterIndex, Object x, SQLType targetSqlType, Integer precision, Integer scale) throws SQLServerException
ISQLServerPreparedStatement
PreparedStatement.setObject(int parameterIndex, Object x, SQLType targetSqlType, int scaleOrLength)
, except that it assumes a
scale of zero.
The default implementation will throw SQLFeatureNotSupportedException
setObject
in interface ISQLServerPreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the object containing the input parameter valuetargetSqlType
- the SQL type to be sent to the databaseprecision
- the precision of the columnscale
- the scale of the columnSQLServerException
- if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method
is called on a closed PreparedStatement
public final void setObject(int parameterIndex, Object x, SQLType targetSqlType, Integer precision, Integer scale, boolean forceEncrypt) throws SQLServerException
ISQLServerPreparedStatement
PreparedStatement.setObject(int parameterIndex, Object x, SQLType targetSqlType, int scaleOrLength)
, except that it assumes a
scale of zero.
The default implementation will throw SQLFeatureNotSupportedException
setObject
in interface ISQLServerPreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the object containing the input parameter valuetargetSqlType
- the SQL type to be sent to the databaseprecision
- the precision of the columnscale
- the scale of the columnforceEncrypt
- If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column is encrypted and Always
Encrypted is enabled on the connection or on the statement. If the boolean forceEncrypt is set to false, the driver will not force
encryption on parameters.SQLServerException
- if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method
is called on a closed PreparedStatement
public final void setShort(int index, short x) throws SQLServerException
setShort
in interface PreparedStatement
SQLServerException
public final void setShort(int index, short x, boolean forceEncrypt) throws SQLServerException
ISQLServerPreparedStatement
short
value. The driver converts this to an SQL SMALLINT
value when
it sends it to the database.setShort
in interface ISQLServerPreparedStatement
index
- the first parameter is 1, the second is 2, ...x
- the parameter valueforceEncrypt
- If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column is encrypted and Always
Encrypted is enabled on the connection or on the statement. If the boolean forceEncrypt is set to false, the driver will not force
encryption on parameters.SQLServerException
- when an error occurspublic final void setString(int index, String str) throws SQLServerException
setString
in interface PreparedStatement
SQLServerException
public final void setString(int index, String str, boolean forceEncrypt) throws SQLServerException
ISQLServerPreparedStatement
String
value. The driver converts this to an SQL VARCHAR
or
LONGVARCHAR
value (depending on the argument's size relative to the driver's limits on VARCHAR
values) when it sends
it to the database.setString
in interface ISQLServerPreparedStatement
index
- the first parameter is 1, the second is 2, ...str
- the parameter valueforceEncrypt
- If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column is encrypted and Always
Encrypted is enabled on the connection or on the statement. If the boolean forceEncrypt is set to false, the driver will not force
encryption on parameters.SQLServerException
- when an error occurspublic final void setNString(int parameterIndex, String value) throws SQLException
setNString
in interface PreparedStatement
SQLException
public final void setNString(int parameterIndex, String value, boolean forceEncrypt) throws SQLServerException
ISQLServerPreparedStatement
String
object. The driver converts this to a SQL NCHAR
or
NVARCHAR
or LONGNVARCHAR
value (depending on the argument's size relative to the driver's limits on
NVARCHAR
values) when it sends it to the database.setNString
in interface ISQLServerPreparedStatement
parameterIndex
- of the first parameter is 1, the second is 2, ...value
- the parameter valueforceEncrypt
- If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column is encrypted and Always
Encrypted is enabled on the connection or on the statement. If the boolean forceEncrypt is set to false, the driver will not force
encryption on parameters.SQLServerException
- when an error occurspublic final void setTime(int n, Time x) throws SQLServerException
setTime
in interface PreparedStatement
SQLServerException
public final void setTime(int n, Time x, int scale) throws SQLServerException
ISQLServerPreparedStatement
java.sql.Time
valuesetTime
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valuescale
- the scale of the columnSQLServerException
- when an error occurspublic final void setTime(int n, Time x, int scale, boolean forceEncrypt) throws SQLServerException
ISQLServerPreparedStatement
java.sql.Time
valuesetTime
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valuescale
- the scale of the columnforceEncrypt
- If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column is encrypted and Always
Encrypted is enabled on the connection or on the statement. If the boolean forceEncrypt is set to false, the driver will not force
encryption on parameters.SQLServerException
- when an error occurspublic final void setTimestamp(int n, Timestamp x) throws SQLServerException
setTimestamp
in interface PreparedStatement
SQLServerException
public final void setTimestamp(int n, Timestamp x, int scale) throws SQLServerException
ISQLServerPreparedStatement
java.sql.Timestamp
valuesetTimestamp
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valuescale
- the scale of the columnSQLServerException
- when an error occurspublic final void setTimestamp(int n, Timestamp x, int scale, boolean forceEncrypt) throws SQLServerException
ISQLServerPreparedStatement
java.sql.Timestamp
valuesetTimestamp
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valuescale
- the scale of the columnforceEncrypt
- If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column is encrypted and Always
Encrypted is enabled on the connection or on the statement. If the boolean forceEncrypt is set to false, the driver will not force
encryption on parameters.SQLServerException
- when an error occurspublic final void setDateTimeOffset(int n, DateTimeOffset x) throws SQLServerException
ISQLServerPreparedStatement
microsoft.sql.DateTimeOffset
value.setDateTimeOffset
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valueSQLServerException
- if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method
is called on a closed PreparedStatement
public final void setDateTimeOffset(int n, DateTimeOffset x, int scale) throws SQLServerException
ISQLServerPreparedStatement
microsoft.sql.DatetimeOffset
valuesetDateTimeOffset
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valuescale
- the scale of the columnSQLServerException
- when an error occurspublic final void setDateTimeOffset(int n, DateTimeOffset x, int scale, boolean forceEncrypt) throws SQLServerException
ISQLServerPreparedStatement
microsoft.sql.DatetimeOffset
valuesetDateTimeOffset
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valuescale
- the scale of the columnforceEncrypt
- If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column is encrypted and Always
Encrypted is enabled on the connection or on the statement. If the boolean forceEncrypt is set to false, the driver will not force
encryption on parameters.SQLServerException
- when an error occurspublic final void setDate(int n, Date x) throws SQLServerException
setDate
in interface PreparedStatement
SQLServerException
public final void setDateTime(int n, Timestamp x) throws SQLServerException
ISQLServerPreparedStatement
java.sql.Timestamp
valuesetDateTime
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valueSQLServerException
- when an error occurspublic final void setDateTime(int n, Timestamp x, boolean forceEncrypt) throws SQLServerException
ISQLServerPreparedStatement
java.sql.Timestamp
valuesetDateTime
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valueforceEncrypt
- If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column is encrypted and Always
Encrypted is enabled on the connection or on the statement. If the boolean forceEncrypt is set to false, the driver will not force
encryption on parameters.SQLServerException
- when an error occurspublic final void setSmallDateTime(int n, Timestamp x) throws SQLServerException
ISQLServerPreparedStatement
java.sql.Timestamp
valuesetSmallDateTime
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valueSQLServerException
- when an error occurspublic final void setSmallDateTime(int n, Timestamp x, boolean forceEncrypt) throws SQLServerException
ISQLServerPreparedStatement
java.sql.Timestamp
valuesetSmallDateTime
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valueforceEncrypt
- If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column is encrypted and Always
Encrypted is enabled on the connection or on the statement. If the boolean forceEncrypt is set to false, the driver will not force
encryption on parameters.SQLServerException
- when an error occurspublic final void setStructured(int n, String tvpName, SQLServerDataTable tvpDataTable) throws SQLServerException
ISQLServerPreparedStatement
setStructured
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...tvpName
- the name of the table valued parametertvpDataTable
- the source datatable objectSQLServerException
- when an error occurspublic final void setStructured(int n, String tvpName, ResultSet tvpResultSet) throws SQLServerException
ISQLServerPreparedStatement
setStructured
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...tvpName
- the name of the table valued parametertvpResultSet
- the source resultset objectSQLServerException
- when an error occurspublic final void setStructured(int n, String tvpName, ISQLServerDataRecord tvpBulkRecord) throws SQLServerException
ISQLServerPreparedStatement
setStructured
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...tvpName
- the name of the table valued parametertvpBulkRecord
- an ISQLServerDataRecord objectSQLServerException
- when an error occurs@Deprecated public final void setUnicodeStream(int n, InputStream x, int length) throws SQLException
setUnicodeStream
in interface PreparedStatement
SQLException
public final void addBatch() throws SQLServerException
addBatch
in interface PreparedStatement
SQLServerException
public final void clearBatch() throws SQLServerException
clearBatch
in interface Statement
clearBatch
in class SQLServerStatement
SQLServerException
public int[] executeBatch() throws SQLServerException, BatchUpdateException, SQLTimeoutException
SQLServerStatement
executeBatch
in interface Statement
executeBatch
in class SQLServerStatement
SQLServerException
BatchUpdateException
SQLTimeoutException
public long[] executeLargeBatch() throws SQLServerException, BatchUpdateException, SQLTimeoutException
executeLargeBatch
in interface Statement
executeLargeBatch
in class SQLServerStatement
SQLServerException
BatchUpdateException
SQLTimeoutException
public final void setCharacterStream(int parameterIndex, Reader reader) throws SQLException
setCharacterStream
in interface PreparedStatement
SQLException
public final void setCharacterStream(int n, Reader reader, int length) throws SQLServerException
setCharacterStream
in interface PreparedStatement
SQLServerException
public final void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException
setCharacterStream
in interface PreparedStatement
SQLException
public final void setNCharacterStream(int parameterIndex, Reader value) throws SQLException
setNCharacterStream
in interface PreparedStatement
SQLException
public final void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException
setNCharacterStream
in interface PreparedStatement
SQLException
public final void setRef(int i, Ref x) throws SQLException
setRef
in interface PreparedStatement
SQLException
public final void setBlob(int i, Blob x) throws SQLException
setBlob
in interface PreparedStatement
SQLException
public final void setBlob(int parameterIndex, InputStream inputStream) throws SQLException
setBlob
in interface PreparedStatement
SQLException
public final void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException
setBlob
in interface PreparedStatement
SQLException
public final void setClob(int parameterIndex, Clob clobValue) throws SQLException
setClob
in interface PreparedStatement
SQLException
public final void setClob(int parameterIndex, Reader reader) throws SQLException
setClob
in interface PreparedStatement
SQLException
public final void setClob(int parameterIndex, Reader reader, long length) throws SQLException
setClob
in interface PreparedStatement
SQLException
public final void setNClob(int parameterIndex, NClob value) throws SQLException
setNClob
in interface PreparedStatement
SQLException
public final void setNClob(int parameterIndex, Reader reader) throws SQLException
setNClob
in interface PreparedStatement
SQLException
public final void setNClob(int parameterIndex, Reader reader, long length) throws SQLException
setNClob
in interface PreparedStatement
SQLException
public final void setArray(int i, Array x) throws SQLException
setArray
in interface PreparedStatement
SQLException
public final void setDate(int n, Date x, Calendar cal) throws SQLServerException
setDate
in interface PreparedStatement
SQLServerException
public final void setDate(int n, Date x, Calendar cal, boolean forceEncrypt) throws SQLServerException
ISQLServerPreparedStatement
java.sql.Date
value, using the given Calendar
object. The driver uses the
Calendar
object to construct an SQL DATE
value, which the driver then sends to the database. With a
Calendar
object, the driver can calculate the date taking into account a custom timezone. If no Calendar
object is
specified, the driver uses the default timezone, which is that of the virtual machine running the application.setDate
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valuecal
- the Calendar
object the driver will use to construct the dateforceEncrypt
- If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column is encrypted and Always
Encrypted is enabled on the connection or on the statement. If the boolean forceEncrypt is set to false, the driver will not force
encryption on parameters.SQLServerException
- when an error occurspublic final void setTime(int n, Time x, Calendar cal) throws SQLServerException
setTime
in interface PreparedStatement
SQLServerException
public final void setTime(int n, Time x, Calendar cal, boolean forceEncrypt) throws SQLServerException
ISQLServerPreparedStatement
java.sql.Time
value. The driver converts this to an SQL TIME
value when it
sends it to the database.setTime
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valuecal
- the Calendar
object the driver will use to construct the dateforceEncrypt
- If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column is encrypted and Always
Encrypted is enabled on the connection or on the statement. If the boolean forceEncrypt is set to false, the driver will not force
encryption on parameters.SQLServerException
- when an error occurspublic final void setTimestamp(int n, Timestamp x, Calendar cal) throws SQLServerException
setTimestamp
in interface PreparedStatement
SQLServerException
public final void setTimestamp(int n, Timestamp x, Calendar cal, boolean forceEncrypt) throws SQLServerException
ISQLServerPreparedStatement
java.sql.Timestamp
value. The driver converts this to an SQL TIMESTAMP
value when it sends it to the database.setTimestamp
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valuecal
- the Calendar
object the driver will use to construct the dateforceEncrypt
- If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column is encrypted and Always
Encrypted is enabled on the connection or on the statement. If the boolean forceEncrypt is set to false, the driver will not force
encryption on parameters.SQLServerException
- when an error occurspublic final void setNull(int paramIndex, int sqlType, String typeName) throws SQLServerException
setNull
in interface PreparedStatement
SQLServerException
public final ParameterMetaData getParameterMetaData(boolean forceRefresh) throws SQLServerException
ISQLServerPreparedStatement
getParameterMetaData
in interface ISQLServerPreparedStatement
forceRefresh
- :
If true the cache will not be used to retrieve the metadata.SQLServerException
- when an error occurspublic final ParameterMetaData getParameterMetaData() throws SQLServerException
getParameterMetaData
in interface PreparedStatement
SQLServerException
public final void setURL(int parameterIndex, URL x) throws SQLException
setURL
in interface PreparedStatement
SQLException
public final void setRowId(int parameterIndex, RowId x) throws SQLException
setRowId
in interface PreparedStatement
SQLException
public final void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException
setSQLXML
in interface PreparedStatement
SQLException
public final int executeUpdate(String sql) throws SQLServerException
executeUpdate
in interface Statement
executeUpdate
in class SQLServerStatement
SQLServerException
public final boolean execute(String sql) throws SQLServerException
execute
in interface Statement
execute
in class SQLServerStatement
SQLServerException
public final ResultSet executeQuery(String sql) throws SQLServerException
executeQuery
in interface Statement
executeQuery
in class SQLServerStatement
SQLServerException
public void addBatch(String sql) throws SQLServerException
addBatch
in interface Statement
addBatch
in class SQLServerStatement
SQLServerException
Copyright © 2018 Microsoft Corporation. All rights reserved.