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 and Description |
---|---|
void |
addBatch() |
void |
addBatch(String sql) |
void |
clearBatch() |
void |
clearParameters() |
boolean |
execute()
Execute a query or non query statement.
|
boolean |
execute(String sql)
Execute an update or query.
|
int[] |
executeBatch()
Send a batch of statements to the database.
|
long[] |
executeLargeBatch() |
long |
executeLargeUpdate() |
ResultSet |
executeQuery()
Execute a query.
|
ResultSet |
executeQuery(String sql)
Execute a result set query
|
int |
executeUpdate() |
int |
executeUpdate(String sql)
Execute a JDBC update
|
ResultSetMetaData |
getMetaData() |
ParameterMetaData |
getParameterMetaData() |
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 n,
BigDecimal x) |
void |
setBigDecimal(int n,
BigDecimal x,
int precision,
int scale)
Sets the designated parameter to the given
java.math.BigDecimal value. |
void |
setBigDecimal(int n,
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 i,
Blob x) |
void |
setBlob(int parameterIndex,
InputStream inputStream) |
void |
setBlob(int parameterIndex,
InputStream inputStream,
long length) |
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,
Clob clobValue) |
void |
setClob(int parameterIndex,
Reader reader) |
void |
setClob(int parameterIndex,
Reader reader,
long length) |
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 |
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,
NClob value) |
void |
setNClob(int parameterIndex,
Reader reader) |
void |
setNClob(int parameterIndex,
Reader reader,
long length) |
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 |
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,
ResultSet tvpResultSet)
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 |
setTime(int n,
Time x) |
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 |
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 |
setTimestamp(int n,
Timestamp x) |
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 |
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 |
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) |
cancel, clearWarnings, close, closeOnCompletion, execute, execute, execute, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResponseBuffering, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isPoolable, isWrapperFor, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout, setResponseBuffering, toString, unwrap
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
setObject, setObject
getResponseBuffering, setResponseBuffering
cancel, clearWarnings, close, closeOnCompletion, 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, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout
isWrapperFor, unwrap
public final void clearParameters() throws SQLServerException
clearParameters
in interface PreparedStatement
SQLServerException
public ResultSet executeQuery() throws SQLServerException
executeQuery
in interface PreparedStatement
SQLServerException
- when an error occurspublic int executeUpdate() throws SQLServerException
executeUpdate
in interface PreparedStatement
SQLServerException
public long executeLargeUpdate() throws SQLServerException
executeLargeUpdate
in interface PreparedStatement
SQLServerException
public boolean execute() throws SQLServerException
execute
in interface PreparedStatement
SQLServerException
- when an error occurspublic 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 n, BigDecimal x) throws SQLServerException
setBigDecimal
in interface PreparedStatement
SQLServerException
public final void setBigDecimal(int n, BigDecimal x, int precision, int scale) throws SQLServerException
java.math.BigDecimal
value. The driver converts this to an SQL NUMERIC
value when it sends it to the database.n
- 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 n, BigDecimal x, int precision, int scale, boolean forceEncrypt) throws SQLServerException
java.math.BigDecimal
value. The driver converts this to an SQL NUMERIC
value when it sends it to the database.n
- 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
java.math.BigDecimal
value. The driver converts this to an SQL NUMERIC
value when it sends it to the database.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
java.math.BigDecimal
value. The driver converts this to an SQL NUMERIC
value when it sends it to the database.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
java.math.BigDecimal
value. The driver converts this to an SQL NUMERIC
value when it sends it to the database.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
java.math.BigDecimal
value. The driver converts this to an SQL NUMERIC
value when it sends it to the database.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
boolean
value. The driver converts this to an SQL BIT
or
BOOLEAN
value when it sends it to the database.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
byte
value. The driver converts this to an SQL TINYINT
value when it
sends it to the database.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
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.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
GUID
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
GUID
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
double
value. The driver converts this to an SQL DOUBLE
value when it
sends it to the database.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
float
value. The driver converts this to an SQL REAL
value when it
sends it to the database.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 setInt(int n, int value) throws SQLServerException
setInt
in interface PreparedStatement
SQLServerException
public final void setInt(int n, int value, boolean forceEncrypt) throws SQLServerException
int
value. The driver converts this to an SQL INTEGER
value when it
sends it to the database.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
long
value. The driver converts this to an SQL BIGINT
value when it
sends it to the database.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
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.
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
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.
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 setShort(int index, short x) throws SQLServerException
setShort
in interface PreparedStatement
SQLServerException
public final void setShort(int index, short x, boolean forceEncrypt) throws SQLServerException
short
value. The driver converts this to an SQL SMALLINT
value when
it sends it to the database.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
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.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 SQLException
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.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.SQLException
- 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
java.sql.Time
valuen
- 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
java.sql.Time
valuen
- 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
java.sql.Timestamp
valuen
- 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
java.sql.Timestamp
valuen
- 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 SQLException
microsoft.sql.DatetimeOffset
valuesetDateTimeOffset
in interface ISQLServerPreparedStatement
n
- the first parameter is 1, the second is 2, ...x
- the parameter valueSQLException
- if an error occurs.public final void setDateTimeOffset(int n, DateTimeOffset x, int scale) throws SQLException
microsoft.sql.DatetimeOffset
valuen
- the first parameter is 1, the second is 2, ...x
- the parameter valuescale
- the scale of the columnSQLException
- when an error occurspublic final void setDateTimeOffset(int n, DateTimeOffset x, int scale, boolean forceEncrypt) throws SQLException
microsoft.sql.DatetimeOffset
valuen
- 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.SQLException
- 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
java.sql.Timestamp
valuen
- 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
java.sql.Timestamp
valuen
- 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
java.sql.Timestamp
valuen
- 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
java.sql.Timestamp
valuen
- 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
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
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
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
SQLServerStatement
executeBatch
in interface Statement
executeBatch
in class SQLServerStatement
SQLServerException
BatchUpdateException
public long[] executeLargeBatch() throws SQLServerException, BatchUpdateException
executeLargeBatch
in interface Statement
executeLargeBatch
in class SQLServerStatement
SQLServerException
BatchUpdateException
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 SQLServerException
setRef
in interface PreparedStatement
SQLServerException
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 SQLServerException
setArray
in interface PreparedStatement
SQLServerException
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
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.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
java.sql.Time
value. The driver converts this to an SQL TIME
value when it
sends it to the database.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
java.sql.Timestamp
value. The driver converts this to an SQL TIMESTAMP
value when it sends it to the database.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() throws SQLServerException
getParameterMetaData
in interface PreparedStatement
SQLServerException
public final void setURL(int parameterIndex, URL x) throws SQLServerException
setURL
in interface PreparedStatement
SQLServerException
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
SQLServerStatement
executeUpdate
in interface Statement
executeUpdate
in class SQLServerStatement
sql
- the SQL querySQLServerException
- The SQL was invalid.public final boolean execute(String sql) throws SQLServerException
SQLServerStatement
execute
in interface Statement
execute
in class SQLServerStatement
sql
- The update or query.SQLServerException
- The SQL statement was not valid.public final ResultSet executeQuery(String sql) throws SQLServerException
SQLServerStatement
executeQuery
in interface Statement
executeQuery
in class SQLServerStatement
sql
- the SQL querySQLServerException
- The SQL was invalid.public void addBatch(String sql) throws SQLServerException
addBatch
in interface Statement
addBatch
in class SQLServerStatement
SQLServerException
Copyright © 2017 Microsoft Corporation. All rights reserved.