Class PreparedStatementWrapper
- java.lang.Object
-
- com.gargoylesoftware.base.resource.jdbc.StatementWrapper
-
- com.gargoylesoftware.base.resource.jdbc.PreparedStatementWrapper
-
- All Implemented Interfaces:
java.lang.AutoCloseable,java.sql.PreparedStatement,java.sql.Statement,java.sql.Wrapper
- Direct Known Subclasses:
CallableStatementWrapper
public class PreparedStatementWrapper extends StatementWrapper implements java.sql.PreparedStatement
A wrapper for a PreparedStatement- Version:
- $Revision: 1.3 $
-
-
Field Summary
Fields Modifier and Type Field Description private java.sql.PreparedStatementdelegate_
-
Constructor Summary
Constructors Constructor Description PreparedStatementWrapper(java.sql.PreparedStatement statement)Create a PreparedStatementWrapper
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddBatch()Adds a set of parameters to thisPreparedStatementobject's batch of commands.voidclearParameters()Clears the current parameter values immediately.booleanexecute()Executes any kind of SQL statement.java.sql.ResultSetexecuteQuery()Executes the SQL query in thisPreparedStatementobject and returns the result set generated by the query.intexecuteUpdate()Executes the SQL INSERT, UPDATE or DELETE statement in thisPreparedStatementobject.java.sql.ResultSetMetaDatagetMetaData()Gets the number, types and properties of aResultSetobject's columns.java.sql.ParameterMetaDatagetParameterMetaData()Retrieves the number, types and properties of thisPreparedStatementobject's parameters.voidsetArray(int i, java.sql.Array x)Sets the designated parameter to the givenArrayobject.voidsetAsciiStream(int parameterIndex, java.io.InputStream x)voidsetAsciiStream(int parameterIndex, java.io.InputStream x, int length)Sets the designated parameter to the given input stream, which will have the specified number of bytes.voidsetAsciiStream(int parameterIndex, java.io.InputStream x, long length)voidsetBigDecimal(int parameterIndex, java.math.BigDecimal x)Sets the designated parameter to ajava.math.BigDecimalvalue.voidsetBinaryStream(int parameterIndex, java.io.InputStream x)voidsetBinaryStream(int parameterIndex, java.io.InputStream x, int length)Sets the designated parameter to the given input stream, which will have the specified number of bytes.voidsetBinaryStream(int parameterIndex, java.io.InputStream x, long length)voidsetBlob(int parameterIndex, java.io.InputStream inputStream)voidsetBlob(int parameterIndex, java.io.InputStream inputStream, long length)voidsetBlob(int i, java.sql.Blob x)Sets the designated parameter to the givenBlobobject.voidsetBoolean(int parameterIndex, boolean x)Sets the designated parameter to a Javabooleanvalue.voidsetByte(int parameterIndex, byte x)Sets the designated parameter to a Javabytevalue.voidsetBytes(int parameterIndex, byte[] x)Sets the designated parameter to a Java array of bytes.voidsetCharacterStream(int parameterIndex, java.io.Reader reader)voidsetCharacterStream(int parameterIndex, java.io.Reader reader, int length)Sets the designated parameter to the givenReaderobject, which is the given number of characters long.voidsetCharacterStream(int parameterIndex, java.io.Reader reader, long length)voidsetClob(int parameterIndex, java.io.Reader reader)voidsetClob(int parameterIndex, java.io.Reader reader, long length)voidsetClob(int i, java.sql.Clob x)Sets the designated parameter to the givenClobobject.voidsetDate(int parameterIndex, java.sql.Date x)Sets the designated parameter to avalue.voidsetDate(int parameterIndex, java.sql.Date x, java.util.Calendar cal)Sets the designated parameter to the givenjava.sql.Datevalue, using the givenCalendarobject.voidsetDouble(int parameterIndex, double x)Sets the designated parameter to a Javadoublevalue.voidsetFloat(int parameterIndex, float x)Sets the designated parameter to a Javafloatvalue.voidsetInt(int parameterIndex, int x)Sets the designated parameter to a Javaintvalue.voidsetLong(int parameterIndex, long x)Sets the designated parameter to a Javalongvalue.voidsetNCharacterStream(int parameterIndex, java.io.Reader value)voidsetNCharacterStream(int parameterIndex, java.io.Reader value, long length)voidsetNClob(int parameterIndex, java.io.Reader reader)voidsetNClob(int parameterIndex, java.io.Reader reader, long length)voidsetNClob(int parameterIndex, java.sql.NClob value)voidsetNString(int parameterIndex, java.lang.String value)voidsetNull(int parameterIndex, int sqlType)Sets the designated parameter to SQLNULL.voidsetNull(int paramIndex, int sqlType, java.lang.String typeName)Sets the designated parameter to SQLNULL.voidsetObject(int parameterIndex, java.lang.Object x)Sets the value of the designated parameter using the given object.voidsetObject(int parameterIndex, java.lang.Object x, int targetSqlType)Sets the value of the designated parameter with the given object.voidsetObject(int parameterIndex, java.lang.Object x, int targetSqlType, int scale)Sets the value of the designated parameter with the given object.voidsetRef(int i, java.sql.Ref x)Sets the designated parameter to the givenREF(<structured-type>)value.voidsetRowId(int parameterIndex, java.sql.RowId x)voidsetShort(int parameterIndex, short x)Sets the designated parameter to a Javashortvalue.voidsetSQLXML(int parameterIndex, java.sql.SQLXML xmlObject)voidsetString(int parameterIndex, java.lang.String x)Sets the designated parameter to a JavaStringvalue.voidsetTime(int parameterIndex, java.sql.Time x)Sets the designated parameter to ajava.sql.Timevalue.voidsetTime(int parameterIndex, java.sql.Time x, java.util.Calendar cal)Sets the designated parameter to the givenjava.sql.Timevalue, using the givenCalendarobject.voidsetTimestamp(int parameterIndex, java.sql.Timestamp x)Sets the designated parameter to ajava.sql.Timestampvalue.voidsetTimestamp(int parameterIndex, java.sql.Timestamp x, java.util.Calendar cal)Sets the designated parameter to the givenjava.sql.Timestampvalue, using the givenCalendarobject.voidsetUnicodeStream(int parameterIndex, java.io.InputStream x, int length)Deprecated.voidsetURL(int parameterIndex, java.net.URL x)Sets the designated parameter to the givenjava.net.URLvalue.-
Methods inherited from class com.gargoylesoftware.base.resource.jdbc.StatementWrapper
addBatch, cancel, checkIsOpen, clearBatch, clearWarnings, close, closeOnCompletion, execute, execute, execute, execute, executeBatch, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getDelegate, getFetchDirection, getFetchSize, getGeneratedKeys, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isPoolable, isWrapperFor, setConnection, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout, unwrap, wrapResultSet
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.sql.PreparedStatement
executeLargeUpdate, setObject, setObject
-
Methods inherited from interface java.sql.Statement
addBatch, cancel, clearBatch, clearWarnings, close, closeOnCompletion, enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, execute, execute, execute, execute, executeBatch, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeQuery, executeUpdate, 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
-
-
-
-
Method Detail
-
setNull
public final void setNull(int parameterIndex, int sqlType) throws java.sql.SQLExceptionSets the designated parameter to SQLNULL.Note: You must specify the parameter's SQL type.
- Specified by:
setNullin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...sqlType- the SQL type code defined injava.sql.Types- Throws:
java.sql.SQLException- if a database access error occurs
-
setBoolean
public final void setBoolean(int parameterIndex, boolean x) throws java.sql.SQLExceptionSets the designated parameter to a Javabooleanvalue. The driver converts this to an SQLBITvalue when it sends it to the database.- Specified by:
setBooleanin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- if a database access error occurs
-
setByte
public final void setByte(int parameterIndex, byte x) throws java.sql.SQLExceptionSets the designated parameter to a Javabytevalue. The driver converts this to an SQLTINYINTvalue when it sends it to the database.- Specified by:
setBytein interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- if a database access error occurs
-
setShort
public final void setShort(int parameterIndex, short x) throws java.sql.SQLExceptionSets the designated parameter to a Javashortvalue. The driver converts this to an SQLSMALLINTvalue when it sends it to the database.- Specified by:
setShortin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- if a database access error occurs
-
setInt
public final void setInt(int parameterIndex, int x) throws java.sql.SQLExceptionSets the designated parameter to a Javaintvalue. The driver converts this to an SQLINTEGERvalue when it sends it to the database.- Specified by:
setIntin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- if a database access error occurs
-
setLong
public final void setLong(int parameterIndex, long x) throws java.sql.SQLExceptionSets the designated parameter to a Javalongvalue. The driver converts this to an SQLBIGINTvalue when it sends it to the database.- Specified by:
setLongin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- if a database access error occurs
-
setFloat
public final void setFloat(int parameterIndex, float x) throws java.sql.SQLExceptionSets the designated parameter to a Javafloatvalue. The driver converts this to an SQLFLOATvalue when it sends it to the database.- Specified by:
setFloatin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- if a database access error occurs
-
setDouble
public final void setDouble(int parameterIndex, double x) throws java.sql.SQLExceptionSets the designated parameter to a Javadoublevalue. The driver converts this to an SQLDOUBLEvalue when it sends it to the database.- Specified by:
setDoublein interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- if a database access error occurs
-
setBigDecimal
public final void setBigDecimal(int parameterIndex, java.math.BigDecimal x) throws java.sql.SQLExceptionSets the designated parameter to ajava.math.BigDecimalvalue. The driver converts this to an SQLNUMERICvalue when it sends it to the database.- Specified by:
setBigDecimalin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- if a database access error occurs
-
setString
public final void setString(int parameterIndex, java.lang.String x) throws java.sql.SQLExceptionSets the designated parameter to a 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 interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- if a database access error occurs
-
setBytes
public final void setBytes(int parameterIndex, byte[] x) throws java.sql.SQLExceptionSets the designated parameter to a 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 interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- if a database access error occurs
-
setDate
public final void setDate(int parameterIndex, java.sql.Date x) throws java.sql.SQLExceptionSets the designated parameter to avalue. The driver converts this to an SQLDATEvalue when it sends it to the database.- Specified by:
setDatein interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- if a database access error occurs
-
setTime
public final void setTime(int parameterIndex, java.sql.Time x) throws java.sql.SQLExceptionSets the designated parameter to ajava.sql.Timevalue. The driver converts this to an SQLTIMEvalue when it sends it to the database.- Specified by:
setTimein interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- if a database access error occurs
-
setTimestamp
public final void setTimestamp(int parameterIndex, java.sql.Timestamp x) throws java.sql.SQLExceptionSets the designated parameter to ajava.sql.Timestampvalue. The driver converts this to an SQLTIMESTAMPvalue when it sends it to the database.- Specified by:
setTimestampin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
java.sql.SQLException- if a database access error occurs
-
setAsciiStream
public final void setAsciiStream(int parameterIndex, java.io.InputStream x, int length) throws java.sql.SQLExceptionSets the designated parameter to the given input stream, which will have the specified number of bytes. When a very large ASCII value is input to aLONGVARCHARparameter, it may be more practical to send it via ajava.io.InputStream. Data will be read from the stream as needed until end-of-file is reached. The JDBC driver will do any necessary conversion from ASCII to the database char format.Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
- Specified by:
setAsciiStreamin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the Java input stream that contains the ASCII parameter valuelength- the number of bytes in the stream- Throws:
java.sql.SQLException- if a database access error occurs
-
setUnicodeStream
public final void setUnicodeStream(int parameterIndex, java.io.InputStream x, int length) throws java.sql.SQLExceptionDeprecated.Sets the designated parameter to the given input stream, which will have the specified number of bytes. When a very large UNICODE value is input to aLONGVARCHARparameter, it may be more practical to send it via ajava.io.InputStreamobject. The data will be read from the stream as needed until end-of-file is reached. The JDBC driver will do any necessary conversion from UNICODE to the database char format. The byte format of the Unicode stream must be Java UTF-8, as defined in the Java Virtual Machine Specification.Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
- Specified by:
setUnicodeStreamin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the java input stream which contains the UNICODE parameter valuelength- the number of bytes in the stream- Throws:
java.sql.SQLException- if a database access error occurs
-
setBinaryStream
public final void setBinaryStream(int parameterIndex, java.io.InputStream x, int length) throws java.sql.SQLExceptionSets the designated parameter to the given input stream, which will have the specified number of bytes. When a very large binary value is input to aLONGVARBINARYparameter, it may be more practical to send it via ajava.io.InputStreamobject. The data will be read from the stream as needed until end-of-file is reached.Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
- Specified by:
setBinaryStreamin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the java input stream which contains the binary parameter valuelength- the number of bytes in the stream- Throws:
java.sql.SQLException- if a database access error occurs
-
setObject
public final void setObject(int parameterIndex, java.lang.Object x, int targetSqlType, int scale) throws java.sql.SQLExceptionSets the value of the designated parameter with the given object. The second argument must be an object type; for integral values, the
java.langequivalent objects should be used.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 implementing Ref, Blob, Clob, Struct, 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 datatabase- specific abstract data types.
- Specified by:
setObjectin interfacejava.sql.PreparedStatement- 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.scale- for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types, this is the number of digits after the decimal point. For all other types, this value will be ignored.- Throws:
java.sql.SQLException- if a database access error occurs
-
setObject
public final void setObject(int parameterIndex, java.lang.Object x, int targetSqlType) throws java.sql.SQLExceptionSets the value of the designated parameter with the given object. This method is like the methodsetObjectabove, except that it assumes a scale of zero.- Specified by:
setObjectin interfacejava.sql.PreparedStatement- 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- Throws:
java.sql.SQLException- if a database access error occurs
-
setObject
public final void setObject(int parameterIndex, java.lang.Object x) throws java.sql.SQLExceptionSets the value of the designated parameter using the given object. The second parameter must be of type
Object; therefore, thejava.langequivalent objects should be used for built-in types.The JDBC specification specifies a standard mapping from Java
Objecttypes to SQL types. The given argument will be converted to the corresponding SQL type before being sent to the database.Note that this method may be used to pass datatabase- specific abstract data types, by using a driver-specific Java type. If the object 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 implementing Ref, Blob, Clob, Struct, or Array, then the driver should pass it to the database as a value of the corresponding SQL type. This method throws an exception if there is an ambiguity, for example, if the object is of a class implementing more than one of the interfaces named above.- Specified by:
setObjectin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the object containing the input parameter value- Throws:
java.sql.SQLException- if a database access error occurs
-
setCharacterStream
public final void setCharacterStream(int parameterIndex, java.io.Reader reader, int length) throws java.sql.SQLExceptionSets the designated parameter to the givenReaderobject, which is the given number of characters long. When a very large UNICODE value is input to aLONGVARCHARparameter, it may be more practical to send it via ajava.io.Readerobject. The data will be read from the stream as needed until end-of-file is reached. The JDBC driver will do any necessary conversion from UNICODE to the database char format.Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
- Specified by:
setCharacterStreamin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...reader- the java reader which contains the UNICODE datalength- the number of characters in the stream- Throws:
java.sql.SQLException- if a database access error occurs- Since:
- 1.2
-
setRef
public final void setRef(int i, java.sql.Ref x) throws java.sql.SQLExceptionSets the designated parameter to the givenREF(<structured-type>)value.- Specified by:
setRefin interfacejava.sql.PreparedStatement- Parameters:
i- the first parameter is 1, the second is 2, ...x- an SQLREFvalue- Throws:
java.sql.SQLException- if a database access error occurs- Since:
- 1.2
-
setBlob
public final void setBlob(int i, java.sql.Blob x) throws java.sql.SQLExceptionSets the designated parameter to the givenBlobobject.- Specified by:
setBlobin interfacejava.sql.PreparedStatement- Parameters:
i- the first parameter is 1, the second is 2, ...x- aBlobobject that maps an SQLBLOBvalue- Throws:
java.sql.SQLException- if a database access error occurs- Since:
- 1.2
-
setClob
public final void setClob(int i, java.sql.Clob x) throws java.sql.SQLExceptionSets the designated parameter to the givenClobobject.- Specified by:
setClobin interfacejava.sql.PreparedStatement- Parameters:
i- the first parameter is 1, the second is 2, ...x- aClobobject that maps an SQLCLOBvalue- Throws:
java.sql.SQLException- if a database access error occurs- Since:
- 1.2
-
setArray
public final void setArray(int i, java.sql.Array x) throws java.sql.SQLExceptionSets the designated parameter to the givenArrayobject. Sets an Array parameter.- Specified by:
setArrayin interfacejava.sql.PreparedStatement- Parameters:
i- the first parameter is 1, the second is 2, ...x- anArrayobject that maps an SQLARRAYvalue- Throws:
java.sql.SQLException- if a database access error occurs- Since:
- 1.2
-
setDate
public final void setDate(int parameterIndex, java.sql.Date x, java.util.Calendar cal) throws java.sql.SQLExceptionSets 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 a 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 interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter valuecal- theCalendarobject the driver will use to construct the date- Throws:
java.sql.SQLException- if a database access error occurs- Since:
- 1.2
-
setTime
public final void setTime(int parameterIndex, java.sql.Time x, java.util.Calendar cal) throws java.sql.SQLExceptionSets the designated parameter to the givenjava.sql.Timevalue, using the givenCalendarobject. The driver uses theCalendarobject to construct an SQLTIMEvalue, which the driver then sends to the database. With a aCalendarobject, the driver can calculate the time 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:
setTimein interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter valuecal- theCalendarobject the driver will use to construct the time- Throws:
java.sql.SQLException- if a database access error occurs- Since:
- 1.2
-
setTimestamp
public final void setTimestamp(int parameterIndex, java.sql.Timestamp x, java.util.Calendar cal) throws java.sql.SQLExceptionSets the designated parameter to the givenjava.sql.Timestampvalue, using the givenCalendarobject. The driver uses theCalendarobject to construct an SQLTIMESTAMPvalue, which the driver then sends to the database. With a aCalendarobject, the driver can calculate the timestamp 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:
setTimestampin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter valuecal- theCalendarobject the driver will use to construct the timestamp- Throws:
java.sql.SQLException- if a database access error occurs- Since:
- 1.2
-
setNull
public final void setNull(int paramIndex, int sqlType, java.lang.String typeName) throws java.sql.SQLExceptionSets the designated parameter to SQLNULL. This version of the methodsetNullshould be used for user-defined types and REF type parameters. Examples of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and named array types.Note: To be portable, applications must give the SQL type code and the fully-qualified SQL type name when specifying a NULL user-defined or REF parameter. In the case of a user-defined type the name is the type name of the parameter itself. For a REF parameter, the name is the type name of the referenced type. If a JDBC driver does not need the type code or type name information, it may ignore it. Although it is intended for user-defined and Ref parameters, this method may be used to set a null parameter of any JDBC type. If the parameter does not have a user-defined or REF type, the given typeName is ignored.
- Specified by:
setNullin interfacejava.sql.PreparedStatement- Parameters:
paramIndex- the first parameter is 1, the second is 2, ...sqlType- a value fromjava.sql.TypestypeName- the fully-qualified name of an SQL user-defined type; ignored if the parameter is not a user-defined type or REF- Throws:
java.sql.SQLException- if a database access error occurs- Since:
- 1.2
-
getMetaData
public final java.sql.ResultSetMetaData getMetaData() throws java.sql.SQLExceptionGets the number, types and properties of aResultSetobject's columns.- Specified by:
getMetaDatain interfacejava.sql.PreparedStatement- Returns:
- the description of a
ResultSetobject's columns - Throws:
java.sql.SQLException- if a database access error occurs- Since:
- 1.2
-
executeQuery
public final java.sql.ResultSet executeQuery() throws java.sql.SQLExceptionExecutes the SQL query in thisPreparedStatementobject and returns the result set generated by the query.- Specified by:
executeQueryin interfacejava.sql.PreparedStatement- Returns:
- a
ResultSetobject that contains the data produced by the query; nevernull - Throws:
java.sql.SQLException- if a database access error occurs
-
executeUpdate
public final int executeUpdate() throws java.sql.SQLExceptionExecutes the SQL INSERT, UPDATE or DELETE statement in thisPreparedStatementobject. In addition, SQL statements that return nothing, such as SQL DDL statements, can be executed.- Specified by:
executeUpdatein interfacejava.sql.PreparedStatement- Returns:
- either the row count for INSERT, UPDATE or DELETE statements; or 0 for SQL statements that return nothing
- Throws:
java.sql.SQLException- if a database access error occurs
-
clearParameters
public final void clearParameters() throws java.sql.SQLExceptionClears the current parameter values immediately.In general, parameter values remain in force for repeated use of a statement. Setting a parameter value automatically clears its previous value. However, in some cases it is useful to immediately release the resources used by the current parameter values; this can be done by calling the method
clearParameters.- Specified by:
clearParametersin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException- if a database access error occurs
-
execute
public final boolean execute() throws java.sql.SQLExceptionExecutes any kind of SQL statement. Some prepared statements return multiple results; theexecutemethod handles these complex statements as well as the simpler form of statements handled by the methodsexecuteQueryandexecuteUpdate.- Specified by:
executein interfacejava.sql.PreparedStatement- Returns:
- Unknown
- Throws:
java.sql.SQLException- if a database access error occurs
-
addBatch
public final void addBatch() throws java.sql.SQLExceptionAdds a set of parameters to thisPreparedStatementobject's batch of commands.- Specified by:
addBatchin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException- if a database access error occurs
-
setURL
public void setURL(int parameterIndex, java.net.URL x) throws java.sql.SQLExceptionSets the designated parameter to the givenjava.net.URLvalue. The driver converts this to an SQLDATALINKvalue when it sends it to the database.- Specified by:
setURLin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- thejava.net.URLobject to be set- Throws:
java.sql.SQLException- if a database access error occurs- Since:
- 1.4
-
getParameterMetaData
public java.sql.ParameterMetaData getParameterMetaData() throws java.sql.SQLExceptionRetrieves the number, types and properties of thisPreparedStatementobject's parameters.- Specified by:
getParameterMetaDatain interfacejava.sql.PreparedStatement- Returns:
- a
ParameterMetaDataobject that contains information about the number, types and properties of thisPreparedStatementobject's parameters - Throws:
java.sql.SQLException- if a database access error occurs- Since:
- 1.4
- See Also:
ParameterMetaData
-
setNClob
public void setNClob(int parameterIndex, java.io.Reader reader) throws java.sql.SQLException- Specified by:
setNClobin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setBlob
public void setBlob(int parameterIndex, java.io.InputStream inputStream) throws java.sql.SQLException- Specified by:
setBlobin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setClob
public void setClob(int parameterIndex, java.io.Reader reader) throws java.sql.SQLException- Specified by:
setClobin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setNCharacterStream
public void setNCharacterStream(int parameterIndex, java.io.Reader value) throws java.sql.SQLException- Specified by:
setNCharacterStreamin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setCharacterStream
public void setCharacterStream(int parameterIndex, java.io.Reader reader) throws java.sql.SQLException- Specified by:
setCharacterStreamin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setBinaryStream
public void setBinaryStream(int parameterIndex, java.io.InputStream x) throws java.sql.SQLException- Specified by:
setBinaryStreamin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setAsciiStream
public void setAsciiStream(int parameterIndex, java.io.InputStream x) throws java.sql.SQLException- Specified by:
setAsciiStreamin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setCharacterStream
public void setCharacterStream(int parameterIndex, java.io.Reader reader, long length) throws java.sql.SQLException- Specified by:
setCharacterStreamin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setBinaryStream
public void setBinaryStream(int parameterIndex, java.io.InputStream x, long length) throws java.sql.SQLException- Specified by:
setBinaryStreamin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setAsciiStream
public void setAsciiStream(int parameterIndex, java.io.InputStream x, long length) throws java.sql.SQLException- Specified by:
setAsciiStreamin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setSQLXML
public void setSQLXML(int parameterIndex, java.sql.SQLXML xmlObject) throws java.sql.SQLException- Specified by:
setSQLXMLin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setNClob
public void setNClob(int parameterIndex, java.io.Reader reader, long length) throws java.sql.SQLException- Specified by:
setNClobin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setBlob
public void setBlob(int parameterIndex, java.io.InputStream inputStream, long length) throws java.sql.SQLException- Specified by:
setBlobin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setClob
public void setClob(int parameterIndex, java.io.Reader reader, long length) throws java.sql.SQLException- Specified by:
setClobin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setNClob
public void setNClob(int parameterIndex, java.sql.NClob value) throws java.sql.SQLException- Specified by:
setNClobin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setNCharacterStream
public void setNCharacterStream(int parameterIndex, java.io.Reader value, long length) throws java.sql.SQLException- Specified by:
setNCharacterStreamin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setNString
public void setNString(int parameterIndex, java.lang.String value) throws java.sql.SQLException- Specified by:
setNStringin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setRowId
public void setRowId(int parameterIndex, java.sql.RowId x) throws java.sql.SQLException- Specified by:
setRowIdin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
-