Class SQLServerPreparedStatement
- All Implemented Interfaces:
ISQLServerPreparedStatement,ISQLServerStatement,Serializable,AutoCloseable,PreparedStatement,Statement,Wrapper
- Direct Known Subclasses:
SQLServerCallableStatement
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.
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from class com.microsoft.sqlserver.jdbc.SQLServerStatement
stmtColumnEncriptionSettingFields inherited from interface java.sql.Statement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBatch()voidvoidvoidbooleanexecute()booleanint[]Sends a batch of statements to the database.long[]longexecuteQuery(String sql)intintexecuteUpdate(String sql)getParameterMetaData(boolean forceRefresh)Returns parameter metadata for the prepared statement.intThe server handle for this prepared statement.booleanReturns the current flag value for useFmtOnly.voidvoidsetAsciiStream(int parameterIndex, InputStream x)voidsetAsciiStream(int n, InputStream x, int length)voidsetAsciiStream(int parameterIndex, InputStream x, long length)voidsetBigDecimal(int parameterIndex, BigDecimal x)voidsetBigDecimal(int parameterIndex, BigDecimal x, int precision, int scale)Sets the designated parameter to the givenjava.math.BigDecimalvalue.voidsetBigDecimal(int parameterIndex, BigDecimal x, int precision, int scale, boolean forceEncrypt)Sets the designated parameter to the givenjava.math.BigDecimalvalue.voidsetBinaryStream(int parameterIndex, InputStream x)voidsetBinaryStream(int n, InputStream x, int length)voidsetBinaryStream(int parameterIndex, InputStream x, long length)voidsetBlob(int parameterIndex, InputStream inputStream)voidsetBlob(int parameterIndex, InputStream inputStream, long length)voidvoidsetBoolean(int n, boolean x)voidsetBoolean(int n, boolean x, boolean forceEncrypt)Sets the designated parameter to the given Javabooleanvalue.voidsetByte(int n, byte x)voidsetByte(int n, byte x, boolean forceEncrypt)Sets the designated parameter to the given Javabytevalue.voidsetBytes(int n, byte[] x)voidsetBytes(int n, byte[] x, boolean forceEncrypt)Sets the designated parameter to the given Java array of bytes.voidsetCharacterStream(int parameterIndex, Reader reader)voidsetCharacterStream(int n, Reader reader, int length)voidsetCharacterStream(int parameterIndex, Reader reader, long length)voidvoidvoidvoidvoidvoidSets the designated parameter to the givenjava.sql.Datevalue, using the givenCalendarobject.voidsetDateTime(int n, Timestamp x)Sets the designated parameter to the givenjava.sql.Timestampvalue.voidsetDateTime(int n, Timestamp x, boolean forceEncrypt)Sets the designated parameter to the givenjava.sql.Timestampvalue.voidsetDateTimeOffset(int n, DateTimeOffset x)Sets the designated parameter to the givenmicrosoft.sql.DateTimeOffsetvalue.voidsetDateTimeOffset(int n, DateTimeOffset x, int scale)Sets the designated parameter to the givenmicrosoft.sql.DatetimeOffsetvalue.voidsetDateTimeOffset(int n, DateTimeOffset x, int scale, boolean forceEncrypt)Sets the designated parameter to the givenmicrosoft.sql.DatetimeOffsetvalue.voidsetDouble(int n, double x)voidsetDouble(int n, double x, boolean forceEncrypt)Sets the designated parameter to the given Javadoublevalue.voidsetFloat(int n, float x)voidsetFloat(int n, float x, boolean forceEncrypt)Sets the designated parameter to the given Javafloatvalue.voidsetGeography(int n, Geography x)Sets the designated parameter to the givenmicrosoft.sql.GeographyClass object.voidsetGeometry(int n, Geometry x)Sets the designated parameter to the givenmicrosoft.sql.GeometryClass object.voidsetInt(int n, int value)voidsetInt(int n, int value, boolean forceEncrypt)Sets the designated parameter to the given Javaintvalue.voidsetLong(int n, long x)voidsetLong(int n, long x, boolean forceEncrypt)Sets the designated parameter to the given Javalongvalue.voidsetMoney(int n, BigDecimal x)Sets the designated parameter to the givenjava.math.BigDecimalvalue.voidsetMoney(int n, BigDecimal x, boolean forceEncrypt)Sets the designated parameter to the givenjava.math.BigDecimalvalue.voidsetNCharacterStream(int parameterIndex, Reader value)voidsetNCharacterStream(int parameterIndex, Reader value, long length)voidvoidvoidvoidsetNString(int parameterIndex, String value)voidsetNString(int parameterIndex, String value, boolean forceEncrypt)Sets the designated parameter to the givenStringobject.voidsetNull(int index, int jdbcType)voidvoidvoidvoidvoidSets the value of the designated parameter with the given object.voidsetObject(int parameterIndex, Object x, int targetSqlType, Integer precision, int scale, boolean forceEncrypt)Sets the value of the designated parameter with the given object.voidvoidvoidSets the value of the designated parameter with the given object.voidsetObject(int parameterIndex, Object x, SQLType targetSqlType, Integer precision, Integer scale, boolean forceEncrypt)Sets the value of the designated parameter with the given object.voidvoidvoidsetShort(int index, short x)voidsetShort(int index, short x, boolean forceEncrypt)Sets the designated parameter to the given Javashortvalue.voidsetSmallDateTime(int n, Timestamp x)Sets the designated parameter to the givenjava.sql.Timestampvalue.voidsetSmallDateTime(int n, Timestamp x, boolean forceEncrypt)Sets the designated parameter to the givenjava.sql.Timestampvalue.voidsetSmallMoney(int n, BigDecimal x)Sets the designated parameter to the givenjava.math.BigDecimalvalue.voidsetSmallMoney(int n, BigDecimal x, boolean forceEncrypt)Sets the designated parameter to the givenjava.math.BigDecimalvalue.voidvoidvoidSets the designated parameter to the given JavaStringvalue.voidsetStructured(int n, String tvpName, ISQLServerDataRecord tvpBulkRecord)Sets the server bulk record to populate a table valued parameter.voidsetStructured(int n, String tvpName, SQLServerDataTable tvpDataTable)Sets the data table to populates a table valued parameter.voidsetStructured(int n, String tvpName, ResultSet tvpResultSet)Sets the result set to populate a table-valued parameter.voidvoidSets the designated parameter to the givenjava.sql.Timevalue.voidSets the designated parameter to the givenjava.sql.Timevalue.voidvoidSets the designated parameter to the givenjava.sql.Timevalue.voidsetTimestamp(int n, Timestamp x)voidsetTimestamp(int n, Timestamp x, int scale)Sets the designated parameter to the givenjava.sql.Timestampvalue.voidsetTimestamp(int n, Timestamp x, int scale, boolean forceEncrypt)Sets the designated parameter to the givenjava.sql.Timestampvalue.voidsetTimestamp(int n, Timestamp x, Calendar cal)voidsetTimestamp(int n, Timestamp x, Calendar cal, boolean forceEncrypt)Sets the designated parameter to the givenjava.sql.Timestampvalue.voidsetUnicodeStream(int n, InputStream x, int length)Deprecated.voidsetUniqueIdentifier(int index, String guid)Sets the designated parameter to the given String.voidsetUniqueIdentifier(int index, String guid, boolean forceEncrypt)Sets the designated parameter to the given String.voidvoidsetUseFmtOnly(boolean useFmtOnly)Specifies the flag to use FMTONLY for parameter metadata queries.Methods inherited from class com.microsoft.sqlserver.jdbc.SQLServerStatement
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, unwrapMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.microsoft.sqlserver.jdbc.ISQLServerStatement
getCancelQueryTimeout, getResponseBuffering, setCancelQueryTimeout, setResponseBufferingMethods inherited from interface java.sql.Statement
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, setQueryTimeoutMethods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
-
Method Details
-
getPreparedStatementHandle
Description copied from interface:ISQLServerPreparedStatementThe server handle for this prepared statement. If a value < 1 is returned no handle has been created.- Specified by:
getPreparedStatementHandlein interfaceISQLServerPreparedStatement- Returns:
- Per the description.
- Throws:
SQLServerException- when an error occurs
-
clearParameters
- Specified by:
clearParametersin interfacePreparedStatement- Throws:
SQLServerException
-
executeQuery
- Specified by:
executeQueryin interfacePreparedStatement- Throws:
SQLServerExceptionSQLTimeoutException
-
executeUpdate
- Specified by:
executeUpdatein interfacePreparedStatement- Throws:
SQLServerExceptionSQLTimeoutException
-
executeLargeUpdate
- Specified by:
executeLargeUpdatein interfacePreparedStatement- Throws:
SQLServerExceptionSQLTimeoutException
-
execute
- Specified by:
executein interfacePreparedStatement- Throws:
SQLServerExceptionSQLTimeoutException
-
getMetaData
- Specified by:
getMetaDatain interfacePreparedStatement- Throws:
SQLServerExceptionSQLTimeoutException
-
setAsciiStream
- Specified by:
setAsciiStreamin interfacePreparedStatement- Throws:
SQLException
-
setAsciiStream
- Specified by:
setAsciiStreamin interfacePreparedStatement- Throws:
SQLServerException
-
setAsciiStream
public final void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException- Specified by:
setAsciiStreamin interfacePreparedStatement- Throws:
SQLException
-
setBigDecimal
- Specified by:
setBigDecimalin interfacePreparedStatement- Throws:
SQLServerException
-
setBigDecimal
public final void setBigDecimal(int parameterIndex, BigDecimal x, int precision, int scale) throws SQLServerExceptionDescription copied from interface:ISQLServerPreparedStatementSets the designated parameter to the givenjava.math.BigDecimalvalue. The driver converts this to an SQLNUMERICvalue when it sends it to the database.- Specified by:
setBigDecimalin interfaceISQLServerPreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter valueprecision- the precision of the columnscale- the scale of the column- Throws:
SQLServerException- when an error occurs
-
setBigDecimal
public final void setBigDecimal(int parameterIndex, BigDecimal x, int precision, int scale, boolean forceEncrypt) throws SQLServerExceptionDescription copied from interface:ISQLServerPreparedStatementSets the designated parameter to the givenjava.math.BigDecimalvalue. The driver converts this to an SQLNUMERICvalue when it sends it to the database.- Specified by:
setBigDecimalin interfaceISQLServerPreparedStatement- Parameters:
parameterIndex- 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.- Throws:
SQLServerException- when an error occurs
-
setMoney
Description copied from interface:ISQLServerPreparedStatementSets the designated parameter to the givenjava.math.BigDecimalvalue. The driver converts this to an SQLNUMERICvalue when it sends it to the database.- Specified by:
setMoneyin interfaceISQLServerPreparedStatement- Parameters:
n- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
SQLServerException- when an error occurs
-
setMoney
Description copied from interface:ISQLServerPreparedStatementSets the designated parameter to the givenjava.math.BigDecimalvalue. The driver converts this to an SQLNUMERICvalue when it sends it to the database.- Specified by:
setMoneyin interfaceISQLServerPreparedStatement- Parameters:
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.- Throws:
SQLServerException- when an error occurs
-
setSmallMoney
Description copied from interface:ISQLServerPreparedStatementSets the designated parameter to the givenjava.math.BigDecimalvalue. The driver converts this to an SQLNUMERICvalue when it sends it to the database.- Specified by:
setSmallMoneyin interfaceISQLServerPreparedStatement- Parameters:
n- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
SQLServerException- when an error occurs
-
setSmallMoney
public final void setSmallMoney(int n, BigDecimal x, boolean forceEncrypt) throws SQLServerExceptionDescription copied from interface:ISQLServerPreparedStatementSets the designated parameter to the givenjava.math.BigDecimalvalue. The driver converts this to an SQLNUMERICvalue when it sends it to the database.- Specified by:
setSmallMoneyin interfaceISQLServerPreparedStatement- Parameters:
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.- Throws:
SQLServerException- when an error occurs
-
setBinaryStream
- Specified by:
setBinaryStreamin interfacePreparedStatement- Throws:
SQLException
-
setBinaryStream
- Specified by:
setBinaryStreamin interfacePreparedStatement- Throws:
SQLServerException
-
setBinaryStream
public final void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException- Specified by:
setBinaryStreamin interfacePreparedStatement- Throws:
SQLException
-
setBoolean
- Specified by:
setBooleanin interfacePreparedStatement- Throws:
SQLServerException
-
setBoolean
Description copied from interface:ISQLServerPreparedStatementSets the designated parameter to the given Javabooleanvalue. The driver converts this to an SQLBITorBOOLEANvalue when it sends it to the database.- Specified by:
setBooleanin interfaceISQLServerPreparedStatement- Parameters:
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.- Throws:
SQLServerException- when an error occurs
-
setByte
- Specified by:
setBytein interfacePreparedStatement- Throws:
SQLServerException
-
setByte
Description copied from interface:ISQLServerPreparedStatementSets the designated parameter to the given Javabytevalue. The driver converts this to an SQLTINYINTvalue when it sends it to the database.- Specified by:
setBytein interfaceISQLServerPreparedStatement- Parameters:
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.- Throws:
SQLServerException- when an error occurs
-
setBytes
- Specified by:
setBytesin interfacePreparedStatement- Throws:
SQLServerException
-
setBytes
Description copied from interface:ISQLServerPreparedStatementSets the designated parameter to the given Java array of bytes. The driver converts this to an SQLVARBINARYorLONGVARBINARY(depending on the argument's size relative to the driver's limits onVARBINARYvalues) when it sends it to the database.- Specified by:
setBytesin interfaceISQLServerPreparedStatement- Parameters:
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.- Throws:
SQLServerException- when an error occurs
-
setUniqueIdentifier
Description copied from interface:ISQLServerPreparedStatementSets the designated parameter to the given String. The driver converts this to an SQLGUID- Specified by:
setUniqueIdentifierin interfaceISQLServerPreparedStatement- Parameters:
index- the first parameter is 1, the second is 2, ...guid- string representation of the uniqueIdentifier value- Throws:
SQLServerException- when an error occurs
-
setUniqueIdentifier
public final void setUniqueIdentifier(int index, String guid, boolean forceEncrypt) throws SQLServerExceptionDescription copied from interface:ISQLServerPreparedStatementSets the designated parameter to the given String. The driver converts this to an SQLGUID- Specified by:
setUniqueIdentifierin interfaceISQLServerPreparedStatement- Parameters:
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.- Throws:
SQLServerException- when an error occurs
-
setDouble
- Specified by:
setDoublein interfacePreparedStatement- Throws:
SQLServerException
-
setDouble
Description copied from interface:ISQLServerPreparedStatementSets the designated parameter to the given Javadoublevalue. The driver converts this to an SQLDOUBLEvalue when it sends it to the database.- Specified by:
setDoublein interfaceISQLServerPreparedStatement- Parameters:
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.- Throws:
SQLServerException- when an error occurs
-
setFloat
- Specified by:
setFloatin interfacePreparedStatement- Throws:
SQLServerException
-
setFloat
Description copied from interface:ISQLServerPreparedStatementSets the designated parameter to the given Javafloatvalue. The driver converts this to an SQLREALvalue when it sends it to the database.- Specified by:
setFloatin interfaceISQLServerPreparedStatement- Parameters:
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.- Throws:
SQLServerException- when an error occurs
-
setGeometry
Description copied from interface:ISQLServerPreparedStatementSets the designated parameter to the givenmicrosoft.sql.GeometryClass object. The driver converts this to an SQLREALvalue when it sends it to the database.- Specified by:
setGeometryin interfaceISQLServerPreparedStatement- Parameters:
n- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
SQLServerException- when an error occurs
-
setGeography
Description copied from interface:ISQLServerPreparedStatementSets the designated parameter to the givenmicrosoft.sql.GeographyClass object. The driver converts this to an SQLREALvalue when it sends it to the database.- Specified by:
setGeographyin interfaceISQLServerPreparedStatement- Parameters:
n- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
SQLServerException- when an error occurs
-
setInt
- Specified by:
setIntin interfacePreparedStatement- Throws:
SQLServerException
-
setInt
Description copied from interface:ISQLServerPreparedStatementSets the designated parameter to the given Javaintvalue. The driver converts this to an SQLINTEGERvalue when it sends it to the database.- Specified by:
setIntin interfaceISQLServerPreparedStatement- Parameters:
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.- Throws:
SQLServerException- when an error occurs
-
setLong
- Specified by:
setLongin interfacePreparedStatement- Throws:
SQLServerException
-
setLong
Description copied from interface:ISQLServerPreparedStatementSets the designated parameter to the given Javalongvalue. The driver converts this to an SQLBIGINTvalue when it sends it to the database.- Specified by:
setLongin interfaceISQLServerPreparedStatement- Parameters:
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.- Throws:
SQLServerException- when an error occurs
-
setNull
- Specified by:
setNullin interfacePreparedStatement- Throws:
SQLServerException
-
setObject
- Specified by:
setObjectin interfacePreparedStatement- Throws:
SQLServerException
-
setObject
- Specified by:
setObjectin interfacePreparedStatement- Throws:
SQLServerException
-
setObject
public final void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLServerException- Specified by:
setObjectin interfacePreparedStatement- Throws:
SQLServerException
-
setObject
public final void setObject(int parameterIndex, Object x, int targetSqlType, Integer precision, int scale) throws SQLServerExceptionDescription copied from interface:ISQLServerPreparedStatementSets 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 methodSQLData.writeSQLto write it to the SQL data stream. If, on the other hand, the object is of a class implementingRef,Blob,Clob,NClob,Struct,java.net.URL, orArray, 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.
- Specified by:
setObjectin interfaceISQLServerPreparedStatement- Parameters:
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 column- Throws:
SQLServerException- when an error occurs
-
setObject
public final void setObject(int parameterIndex, Object x, int targetSqlType, Integer precision, int scale, boolean forceEncrypt) throws SQLServerExceptionDescription copied from interface:ISQLServerPreparedStatementSets 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 methodSQLData.writeSQLto write it to the SQL data stream. If, on the other hand, the object is of a class implementingRef,Blob,Clob,NClob,Struct,java.net.URL, orArray, 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.
- Specified by:
setObjectin interfaceISQLServerPreparedStatement- Parameters:
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.- Throws:
SQLServerException- when an error occurs
-
setObject
- Specified by:
setObjectin interfacePreparedStatement- Throws:
SQLServerException
-
setObject
public final void setObject(int parameterIndex, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLServerException- Specified by:
setObjectin interfacePreparedStatement- Throws:
SQLServerException
-
setObject
public final void setObject(int parameterIndex, Object x, SQLType targetSqlType, Integer precision, Integer scale) throws SQLServerExceptionDescription copied from interface:ISQLServerPreparedStatementSets the value of the designated parameter with the given object. This method is similar toPreparedStatement.setObject(int parameterIndex, Object x, SQLType targetSqlType, int scaleOrLength), except that it assumes a scale of zero.The default implementation will throw
SQLFeatureNotSupportedException- Specified by:
setObjectin interfaceISQLServerPreparedStatement- Parameters:
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 column- Throws:
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 closedPreparedStatement
-
setObject
public final void setObject(int parameterIndex, Object x, SQLType targetSqlType, Integer precision, Integer scale, boolean forceEncrypt) throws SQLServerExceptionDescription copied from interface:ISQLServerPreparedStatementSets the value of the designated parameter with the given object. This method is similar toPreparedStatement.setObject(int parameterIndex, Object x, SQLType targetSqlType, int scaleOrLength), except that it assumes a scale of zero.The default implementation will throw
SQLFeatureNotSupportedException- Specified by:
setObjectin interfaceISQLServerPreparedStatement- Parameters:
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.- Throws:
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 closedPreparedStatement
-
setShort
- Specified by:
setShortin interfacePreparedStatement- Throws:
SQLServerException
-
setShort
Description copied from interface:ISQLServerPreparedStatementSets the designated parameter to the given Javashortvalue. The driver converts this to an SQLSMALLINTvalue when it sends it to the database.- Specified by:
setShortin interfaceISQLServerPreparedStatement- Parameters:
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.- Throws:
SQLServerException- when an error occurs
-
setString
- Specified by:
setStringin interfacePreparedStatement- Throws:
SQLServerException
-
setString
Description copied from interface:ISQLServerPreparedStatementSets the designated parameter to the given JavaStringvalue. The driver converts this to an SQLVARCHARorLONGVARCHARvalue (depending on the argument's size relative to the driver's limits onVARCHARvalues) when it sends it to the database.- Specified by:
setStringin interfaceISQLServerPreparedStatement- Parameters:
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.- Throws:
SQLServerException- when an error occurs
-
setNString
- Specified by:
setNStringin interfacePreparedStatement- Throws:
SQLException
-
setNString
public final void setNString(int parameterIndex, String value, boolean forceEncrypt) throws SQLServerExceptionDescription copied from interface:ISQLServerPreparedStatementSets the designated parameter to the givenStringobject. The driver converts this to a SQLNCHARorNVARCHARorLONGNVARCHARvalue (depending on the argument's size relative to the driver's limits onNVARCHARvalues) when it sends it to the database.- Specified by:
setNStringin interfaceISQLServerPreparedStatement- Parameters:
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.- Throws:
SQLServerException- when an error occurs
-
setTime
- Specified by:
setTimein interfacePreparedStatement- Throws:
SQLServerException
-
setTime
Description copied from interface:ISQLServerPreparedStatementSets the designated parameter to the givenjava.sql.Timevalue.- Specified by:
setTimein interfaceISQLServerPreparedStatement- Parameters:
n- the first parameter is 1, the second is 2, ...x- the parameter valuescale- the scale of the column- Throws:
SQLServerException- when an error occurs
-
setTime
public final void setTime(int n, Time x, int scale, boolean forceEncrypt) throws SQLServerExceptionDescription copied from interface:ISQLServerPreparedStatementSets the designated parameter to the givenjava.sql.Timevalue.- Specified by:
setTimein interfaceISQLServerPreparedStatement- Parameters:
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.- Throws:
SQLServerException- when an error occurs
-
setTimestamp
- Specified by:
setTimestampin interfacePreparedStatement- Throws:
SQLServerException
-
setTimestamp
Description copied from interface:ISQLServerPreparedStatementSets the designated parameter to the givenjava.sql.Timestampvalue.- Specified by:
setTimestampin interfaceISQLServerPreparedStatement- Parameters:
n- the first parameter is 1, the second is 2, ...x- the parameter valuescale- the scale of the column- Throws:
SQLServerException- when an error occurs
-
setTimestamp
public final void setTimestamp(int n, Timestamp x, int scale, boolean forceEncrypt) throws SQLServerExceptionDescription copied from interface:ISQLServerPreparedStatementSets the designated parameter to the givenjava.sql.Timestampvalue.- Specified by:
setTimestampin interfaceISQLServerPreparedStatement- Parameters:
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.- Throws:
SQLServerException- when an error occurs
-
setDateTimeOffset
Description copied from interface:ISQLServerPreparedStatementSets the designated parameter to the givenmicrosoft.sql.DateTimeOffsetvalue.- Specified by:
setDateTimeOffsetin interfaceISQLServerPreparedStatement- Parameters:
n- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
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 closedPreparedStatement
-
setDateTimeOffset
Description copied from interface:ISQLServerPreparedStatementSets the designated parameter to the givenmicrosoft.sql.DatetimeOffsetvalue.- Specified by:
setDateTimeOffsetin interfaceISQLServerPreparedStatement- Parameters:
n- the first parameter is 1, the second is 2, ...x- the parameter valuescale- the scale of the column- Throws:
SQLServerException- when an error occurs
-
setDateTimeOffset
public final void setDateTimeOffset(int n, DateTimeOffset x, int scale, boolean forceEncrypt) throws SQLServerExceptionDescription copied from interface:ISQLServerPreparedStatementSets the designated parameter to the givenmicrosoft.sql.DatetimeOffsetvalue.- Specified by:
setDateTimeOffsetin interfaceISQLServerPreparedStatement- Parameters:
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.- Throws:
SQLServerException- when an error occurs
-
setDate
- Specified by:
setDatein interfacePreparedStatement- Throws:
SQLServerException
-
setDateTime
Description copied from interface:ISQLServerPreparedStatementSets the designated parameter to the givenjava.sql.Timestampvalue.- Specified by:
setDateTimein interfaceISQLServerPreparedStatement- Parameters:
n- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
SQLServerException- when an error occurs
-
setDateTime
Description copied from interface:ISQLServerPreparedStatementSets the designated parameter to the givenjava.sql.Timestampvalue.- Specified by:
setDateTimein interfaceISQLServerPreparedStatement- Parameters:
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.- Throws:
SQLServerException- when an error occurs
-
setSmallDateTime
Description copied from interface:ISQLServerPreparedStatementSets the designated parameter to the givenjava.sql.Timestampvalue.- Specified by:
setSmallDateTimein interfaceISQLServerPreparedStatement- Parameters:
n- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
SQLServerException- when an error occurs
-
setSmallDateTime
public final void setSmallDateTime(int n, Timestamp x, boolean forceEncrypt) throws SQLServerExceptionDescription copied from interface:ISQLServerPreparedStatementSets the designated parameter to the givenjava.sql.Timestampvalue.- Specified by:
setSmallDateTimein interfaceISQLServerPreparedStatement- Parameters:
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.- Throws:
SQLServerException- when an error occurs
-
setStructured
public final void setStructured(int n, String tvpName, SQLServerDataTable tvpDataTable) throws SQLServerExceptionDescription copied from interface:ISQLServerPreparedStatementSets the data table to populates a table valued parameter.- Specified by:
setStructuredin interfaceISQLServerPreparedStatement- Parameters:
n- the first parameter is 1, the second is 2, ...tvpName- the name of the table valued parametertvpDataTable- the source datatable object- Throws:
SQLServerException- when an error occurs
-
setStructured
public final void setStructured(int n, String tvpName, ResultSet tvpResultSet) throws SQLServerExceptionDescription copied from interface:ISQLServerPreparedStatementSets the result set to populate a table-valued parameter.- Specified by:
setStructuredin interfaceISQLServerPreparedStatement- Parameters:
n- the first parameter is 1, the second is 2, ...tvpName- the name of the table valued parametertvpResultSet- the source resultset object- Throws:
SQLServerException- when an error occurs
-
setStructured
public final void setStructured(int n, String tvpName, ISQLServerDataRecord tvpBulkRecord) throws SQLServerExceptionDescription copied from interface:ISQLServerPreparedStatementSets the server bulk record to populate a table valued parameter.- Specified by:
setStructuredin interfaceISQLServerPreparedStatement- Parameters:
n- the first parameter is 1, the second is 2, ...tvpName- the name of the table valued parametertvpBulkRecord- an ISQLServerDataRecord object- Throws:
SQLServerException- when an error occurs
-
setUnicodeStream
@Deprecated public final void setUnicodeStream(int n, InputStream x, int length) throws SQLExceptionDeprecated.- Specified by:
setUnicodeStreamin interfacePreparedStatement- Throws:
SQLException
-
addBatch
- Specified by:
addBatchin interfacePreparedStatement- Throws:
SQLServerException
-
clearBatch
- Specified by:
clearBatchin interfaceStatement- Overrides:
clearBatchin classSQLServerStatement- Throws:
SQLServerException
-
executeBatch
Description copied from class:SQLServerStatementSends a batch of statements to the database.- Specified by:
executeBatchin interfaceStatement- Overrides:
executeBatchin classSQLServerStatement- Throws:
SQLServerExceptionBatchUpdateExceptionSQLTimeoutException
-
executeLargeBatch
public long[] executeLargeBatch() throws SQLServerException, BatchUpdateException, SQLTimeoutException- Specified by:
executeLargeBatchin interfaceStatement- Overrides:
executeLargeBatchin classSQLServerStatement- Throws:
SQLServerExceptionBatchUpdateExceptionSQLTimeoutException
-
setUseFmtOnly
Description copied from interface:ISQLServerPreparedStatementSpecifies the flag to use FMTONLY for parameter metadata queries.- Specified by:
setUseFmtOnlyin interfaceISQLServerPreparedStatement- Parameters:
useFmtOnly- boolean value for 'useFmtOnly'.- Throws:
SQLServerException- when the connection is closed.
-
getUseFmtOnly
Description copied from interface:ISQLServerPreparedStatementReturns the current flag value for useFmtOnly.- Specified by:
getUseFmtOnlyin interfaceISQLServerPreparedStatement- Returns:
- 'useFmtOnly' property value.
- Throws:
SQLServerException- when the connection is closed.
-
setCharacterStream
- Specified by:
setCharacterStreamin interfacePreparedStatement- Throws:
SQLException
-
setCharacterStream
- Specified by:
setCharacterStreamin interfacePreparedStatement- Throws:
SQLServerException
-
setCharacterStream
public final void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException- Specified by:
setCharacterStreamin interfacePreparedStatement- Throws:
SQLException
-
setNCharacterStream
- Specified by:
setNCharacterStreamin interfacePreparedStatement- Throws:
SQLException
-
setNCharacterStream
public final void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException- Specified by:
setNCharacterStreamin interfacePreparedStatement- Throws:
SQLException
-
setRef
- Specified by:
setRefin interfacePreparedStatement- Throws:
SQLException
-
setBlob
- Specified by:
setBlobin interfacePreparedStatement- Throws:
SQLException
-
setBlob
- Specified by:
setBlobin interfacePreparedStatement- Throws:
SQLException
-
setBlob
public final void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException- Specified by:
setBlobin interfacePreparedStatement- Throws:
SQLException
-
setClob
- Specified by:
setClobin interfacePreparedStatement- Throws:
SQLException
-
setClob
- Specified by:
setClobin interfacePreparedStatement- Throws:
SQLException
-
setClob
- Specified by:
setClobin interfacePreparedStatement- Throws:
SQLException
-
setNClob
- Specified by:
setNClobin interfacePreparedStatement- Throws:
SQLException
-
setNClob
- Specified by:
setNClobin interfacePreparedStatement- Throws:
SQLException
-
setNClob
- Specified by:
setNClobin interfacePreparedStatement- Throws:
SQLException
-
setArray
- Specified by:
setArrayin interfacePreparedStatement- Throws:
SQLException
-
setDate
- Specified by:
setDatein interfacePreparedStatement- Throws:
SQLServerException
-
setDate
public final void setDate(int n, Date x, Calendar cal, boolean forceEncrypt) throws SQLServerExceptionDescription copied from interface:ISQLServerPreparedStatementSets the designated parameter to the givenjava.sql.Datevalue, using the givenCalendarobject. The driver uses theCalendarobject to construct an SQLDATEvalue, which the driver then sends to the database. With aCalendarobject, the driver can calculate the date taking into account a custom timezone. If noCalendarobject is specified, the driver uses the default timezone, which is that of the virtual machine running the application.- Specified by:
setDatein interfaceISQLServerPreparedStatement- Parameters:
n- the first parameter is 1, the second is 2, ...x- the parameter valuecal- theCalendarobject 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.- Throws:
SQLServerException- when an error occurs
-
setTime
- Specified by:
setTimein interfacePreparedStatement- Throws:
SQLServerException
-
setTime
public final void setTime(int n, Time x, Calendar cal, boolean forceEncrypt) throws SQLServerExceptionDescription copied from interface:ISQLServerPreparedStatementSets the designated parameter to the givenjava.sql.Timevalue. The driver converts this to an SQLTIMEvalue when it sends it to the database.- Specified by:
setTimein interfaceISQLServerPreparedStatement- Parameters:
n- the first parameter is 1, the second is 2, ...x- the parameter valuecal- theCalendarobject 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.- Throws:
SQLServerException- when an error occurs
-
setTimestamp
- Specified by:
setTimestampin interfacePreparedStatement- Throws:
SQLServerException
-
setTimestamp
public final void setTimestamp(int n, Timestamp x, Calendar cal, boolean forceEncrypt) throws SQLServerExceptionDescription copied from interface:ISQLServerPreparedStatementSets the designated parameter to the givenjava.sql.Timestampvalue. The driver converts this to an SQLTIMESTAMPvalue when it sends it to the database.- Specified by:
setTimestampin interfaceISQLServerPreparedStatement- Parameters:
n- the first parameter is 1, the second is 2, ...x- the parameter valuecal- theCalendarobject 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.- Throws:
SQLServerException- when an error occurs
-
setNull
- Specified by:
setNullin interfacePreparedStatement- Throws:
SQLServerException
-
getParameterMetaData
public final ParameterMetaData getParameterMetaData(boolean forceRefresh) throws SQLServerExceptionDescription copied from interface:ISQLServerPreparedStatementReturns parameter metadata for the prepared statement.- Specified by:
getParameterMetaDatain interfaceISQLServerPreparedStatement- Parameters:
forceRefresh- If true the cache will not be used to retrieve the metadata.- Returns:
- Per the description.
- Throws:
SQLServerException- when an error occurs
-
getParameterMetaData
- Specified by:
getParameterMetaDatain interfacePreparedStatement- Throws:
SQLServerException
-
setURL
- Specified by:
setURLin interfacePreparedStatement- Throws:
SQLException
-
setRowId
- Specified by:
setRowIdin interfacePreparedStatement- Throws:
SQLException
-
setSQLXML
- Specified by:
setSQLXMLin interfacePreparedStatement- Throws:
SQLException
-
executeUpdate
- Specified by:
executeUpdatein interfaceStatement- Overrides:
executeUpdatein classSQLServerStatement- Throws:
SQLServerException
-
execute
- Specified by:
executein interfaceStatement- Overrides:
executein classSQLServerStatement- Throws:
SQLServerException
-
executeQuery
- Specified by:
executeQueryin interfaceStatement- Overrides:
executeQueryin classSQLServerStatement- Throws:
SQLServerException
-
addBatch
- Specified by:
addBatchin interfaceStatement- Overrides:
addBatchin classSQLServerStatement- Throws:
SQLServerException
-