PreparedStatement (Java Platform SE 8 ) (original) (raw)
Modifier and Type
Method
Description
void
[addBatch](../../java/sql/PreparedStatement.html#addBatch--)()
Adds a set of parameters to this PreparedStatement
object's batch of commands.
void
[clearParameters](../../java/sql/PreparedStatement.html#clearParameters--)()
Clears the current parameter values immediately.
boolean
[execute](../../java/sql/PreparedStatement.html#execute--)()
Executes the SQL statement in this PreparedStatement
object, which may be any kind of SQL statement.
default long
[executeLargeUpdate](../../java/sql/PreparedStatement.html#executeLargeUpdate--)()
Executes the SQL statement in this PreparedStatement
object, which must be an SQL Data Manipulation Language (DML) statement, such as INSERT
, UPDATE
orDELETE
; or an SQL statement that returns nothing, such as a DDL statement.
[ResultSet](../../java/sql/ResultSet.html "interface in java.sql")
[executeQuery](../../java/sql/PreparedStatement.html#executeQuery--)()
Executes the SQL query in this PreparedStatement
object and returns the ResultSet
object generated by the query.
int
[executeUpdate](../../java/sql/PreparedStatement.html#executeUpdate--)()
Executes the SQL statement in this PreparedStatement
object, which must be an SQL Data Manipulation Language (DML) statement, such as INSERT
, UPDATE
orDELETE
; or an SQL statement that returns nothing, such as a DDL statement.
[ResultSetMetaData](../../java/sql/ResultSetMetaData.html "interface in java.sql")
[getMetaData](../../java/sql/PreparedStatement.html#getMetaData--)()
Retrieves a ResultSetMetaData
object that contains information about the columns of the ResultSet
object that will be returned when this PreparedStatement
object is executed.
[ParameterMetaData](../../java/sql/ParameterMetaData.html "interface in java.sql")
[getParameterMetaData](../../java/sql/PreparedStatement.html#getParameterMetaData--)()
Retrieves the number, types and properties of thisPreparedStatement
object's parameters.
void
[setArray](../../java/sql/PreparedStatement.html#setArray-int-java.sql.Array-)(int parameterIndex,[Array](../../java/sql/Array.html "interface in java.sql") x)
Sets the designated parameter to the given java.sql.Array
object.
void
[setAsciiStream](../../java/sql/PreparedStatement.html#setAsciiStream-int-java.io.InputStream-)(int parameterIndex,[InputStream](../../java/io/InputStream.html "class in java.io") x)
Sets the designated parameter to the given input stream.
void
[setAsciiStream](../../java/sql/PreparedStatement.html#setAsciiStream-int-java.io.InputStream-int-)(int parameterIndex,[InputStream](../../java/io/InputStream.html "class in java.io") x, int length)
Sets the designated parameter to the given input stream, which will have the specified number of bytes.
void
[setAsciiStream](../../java/sql/PreparedStatement.html#setAsciiStream-int-java.io.InputStream-long-)(int parameterIndex,[InputStream](../../java/io/InputStream.html "class in java.io") x, long length)
Sets the designated parameter to the given input stream, which will have the specified number of bytes.
void
[setBigDecimal](../../java/sql/PreparedStatement.html#setBigDecimal-int-java.math.BigDecimal-)(int parameterIndex,[BigDecimal](../../java/math/BigDecimal.html "class in java.math") x)
Sets the designated parameter to the given java.math.BigDecimal
value.
void
[setBinaryStream](../../java/sql/PreparedStatement.html#setBinaryStream-int-java.io.InputStream-)(int parameterIndex,[InputStream](../../java/io/InputStream.html "class in java.io") x)
Sets the designated parameter to the given input stream.
void
[setBinaryStream](../../java/sql/PreparedStatement.html#setBinaryStream-int-java.io.InputStream-int-)(int parameterIndex,[InputStream](../../java/io/InputStream.html "class in java.io") x, int length)
Sets the designated parameter to the given input stream, which will have the specified number of bytes.
void
[setBinaryStream](../../java/sql/PreparedStatement.html#setBinaryStream-int-java.io.InputStream-long-)(int parameterIndex,[InputStream](../../java/io/InputStream.html "class in java.io") x, long length)
Sets the designated parameter to the given input stream, which will have the specified number of bytes.
void
[setBlob](../../java/sql/PreparedStatement.html#setBlob-int-java.sql.Blob-)(int parameterIndex,[Blob](../../java/sql/Blob.html "interface in java.sql") x)
Sets the designated parameter to the given java.sql.Blob
object.
void
[setBlob](../../java/sql/PreparedStatement.html#setBlob-int-java.io.InputStream-)(int parameterIndex,[InputStream](../../java/io/InputStream.html "class in java.io") inputStream)
Sets the designated parameter to a InputStream
object.
void
[setBlob](../../java/sql/PreparedStatement.html#setBlob-int-java.io.InputStream-long-)(int parameterIndex,[InputStream](../../java/io/InputStream.html "class in java.io") inputStream, long length)
Sets the designated parameter to a InputStream
object.
void
[setBoolean](../../java/sql/PreparedStatement.html#setBoolean-int-boolean-)(int parameterIndex, boolean x)
Sets the designated parameter to the given Java boolean
value.
void
[setByte](../../java/sql/PreparedStatement.html#setByte-int-byte-)(int parameterIndex, byte x)
Sets the designated parameter to the given Java byte
value.
void
[setBytes](../../java/sql/PreparedStatement.html#setBytes-int-byte:A-)(int parameterIndex, byte[] x)
Sets the designated parameter to the given Java array of bytes.
void
[setCharacterStream](../../java/sql/PreparedStatement.html#setCharacterStream-int-java.io.Reader-)(int parameterIndex,[Reader](../../java/io/Reader.html "class in java.io") reader)
Sets the designated parameter to the given Reader
object.
void
[setCharacterStream](../../java/sql/PreparedStatement.html#setCharacterStream-int-java.io.Reader-int-)(int parameterIndex,[Reader](../../java/io/Reader.html "class in java.io") reader, int length)
Sets the designated parameter to the given Reader
object, which is the given number of characters long.
void
[setCharacterStream](../../java/sql/PreparedStatement.html#setCharacterStream-int-java.io.Reader-long-)(int parameterIndex,[Reader](../../java/io/Reader.html "class in java.io") reader, long length)
Sets the designated parameter to the given Reader
object, which is the given number of characters long.
void
[setClob](../../java/sql/PreparedStatement.html#setClob-int-java.sql.Clob-)(int parameterIndex,[Clob](../../java/sql/Clob.html "interface in java.sql") x)
Sets the designated parameter to the given java.sql.Clob
object.
void
[setClob](../../java/sql/PreparedStatement.html#setClob-int-java.io.Reader-)(int parameterIndex,[Reader](../../java/io/Reader.html "class in java.io") reader)
Sets the designated parameter to a Reader
object.
void
[setClob](../../java/sql/PreparedStatement.html#setClob-int-java.io.Reader-long-)(int parameterIndex,[Reader](../../java/io/Reader.html "class in java.io") reader, long length)
Sets the designated parameter to a Reader
object.
void
[setDate](../../java/sql/PreparedStatement.html#setDate-int-java.sql.Date-)(int parameterIndex,[Date](../../java/sql/Date.html "class in java.sql") x)
Sets the designated parameter to the given java.sql.Date
value using the default time zone of the virtual machine that is running the application.
void
[setDate](../../java/sql/PreparedStatement.html#setDate-int-java.sql.Date-java.util.Calendar-)(int parameterIndex,[Date](../../java/sql/Date.html "class in java.sql") x,[Calendar](../../java/util/Calendar.html "class in java.util") cal)
Sets the designated parameter to the given java.sql.Date
value, using the given Calendar
object.
void
[setDouble](../../java/sql/PreparedStatement.html#setDouble-int-double-)(int parameterIndex, double x)
Sets the designated parameter to the given Java double
value.
void
[setFloat](../../java/sql/PreparedStatement.html#setFloat-int-float-)(int parameterIndex, float x)
Sets the designated parameter to the given Java float
value.
void
[setInt](../../java/sql/PreparedStatement.html#setInt-int-int-)(int parameterIndex, int x)
Sets the designated parameter to the given Java int
value.
void
[setLong](../../java/sql/PreparedStatement.html#setLong-int-long-)(int parameterIndex, long x)
Sets the designated parameter to the given Java long
value.
void
[setNCharacterStream](../../java/sql/PreparedStatement.html#setNCharacterStream-int-java.io.Reader-)(int parameterIndex,[Reader](../../java/io/Reader.html "class in java.io") value)
Sets the designated parameter to a Reader
object.
void
[setNCharacterStream](../../java/sql/PreparedStatement.html#setNCharacterStream-int-java.io.Reader-long-)(int parameterIndex,[Reader](../../java/io/Reader.html "class in java.io") value, long length)
Sets the designated parameter to a Reader
object.
void
[setNClob](../../java/sql/PreparedStatement.html#setNClob-int-java.sql.NClob-)(int parameterIndex,[NClob](../../java/sql/NClob.html "interface in java.sql") value)
Sets the designated parameter to a java.sql.NClob
object.
void
[setNClob](../../java/sql/PreparedStatement.html#setNClob-int-java.io.Reader-)(int parameterIndex,[Reader](../../java/io/Reader.html "class in java.io") reader)
Sets the designated parameter to a Reader
object.
void
[setNClob](../../java/sql/PreparedStatement.html#setNClob-int-java.io.Reader-long-)(int parameterIndex,[Reader](../../java/io/Reader.html "class in java.io") reader, long length)
Sets the designated parameter to a Reader
object.
void
[setNString](../../java/sql/PreparedStatement.html#setNString-int-java.lang.String-)(int parameterIndex,[String](../../java/lang/String.html "class in java.lang") value)
Sets the designated parameter to the given String
object.
void
[setNull](../../java/sql/PreparedStatement.html#setNull-int-int-)(int parameterIndex, int sqlType)
Sets the designated parameter to SQL NULL
.
void
[setNull](../../java/sql/PreparedStatement.html#setNull-int-int-java.lang.String-)(int parameterIndex, int sqlType,[String](../../java/lang/String.html "class in java.lang") typeName)
Sets the designated parameter to SQL NULL
.
void
[setObject](../../java/sql/PreparedStatement.html#setObject-int-java.lang.Object-)(int parameterIndex,[Object](../../java/lang/Object.html "class in java.lang") x)
Sets the value of the designated parameter using the given object.
void
[setObject](../../java/sql/PreparedStatement.html#setObject-int-java.lang.Object-int-)(int parameterIndex,[Object](../../java/lang/Object.html "class in java.lang") x, int targetSqlType)
Sets the value of the designated parameter with the given object.
void
[setObject](../../java/sql/PreparedStatement.html#setObject-int-java.lang.Object-int-int-)(int parameterIndex,[Object](../../java/lang/Object.html "class in java.lang") x, int targetSqlType, int scaleOrLength)
Sets the value of the designated parameter with the given object.
default void
[setObject](../../java/sql/PreparedStatement.html#setObject-int-java.lang.Object-java.sql.SQLType-)(int parameterIndex,[Object](../../java/lang/Object.html "class in java.lang") x,[SQLType](../../java/sql/SQLType.html "interface in java.sql") targetSqlType)
Sets the value of the designated parameter with the given object.
default void
[setObject](../../java/sql/PreparedStatement.html#setObject-int-java.lang.Object-java.sql.SQLType-int-)(int parameterIndex,[Object](../../java/lang/Object.html "class in java.lang") x,[SQLType](../../java/sql/SQLType.html "interface in java.sql") targetSqlType, int scaleOrLength)
Sets the value of the designated parameter with the given object.
void
[setRef](../../java/sql/PreparedStatement.html#setRef-int-java.sql.Ref-)(int parameterIndex,[Ref](../../java/sql/Ref.html "interface in java.sql") x)
Sets the designated parameter to the givenREF(<structured-type>)
value.
void
[setRowId](../../java/sql/PreparedStatement.html#setRowId-int-java.sql.RowId-)(int parameterIndex,[RowId](../../java/sql/RowId.html "interface in java.sql") x)
Sets the designated parameter to the given java.sql.RowId
object.
void
[setShort](../../java/sql/PreparedStatement.html#setShort-int-short-)(int parameterIndex, short x)
Sets the designated parameter to the given Java short
value.
void
[setSQLXML](../../java/sql/PreparedStatement.html#setSQLXML-int-java.sql.SQLXML-)(int parameterIndex,[SQLXML](../../java/sql/SQLXML.html "interface in java.sql") xmlObject)
Sets the designated parameter to the given java.sql.SQLXML
object.
void
[setString](../../java/sql/PreparedStatement.html#setString-int-java.lang.String-)(int parameterIndex,[String](../../java/lang/String.html "class in java.lang") x)
Sets the designated parameter to the given Java String
value.
void
[setTime](../../java/sql/PreparedStatement.html#setTime-int-java.sql.Time-)(int parameterIndex,[Time](../../java/sql/Time.html "class in java.sql") x)
Sets the designated parameter to the given java.sql.Time
value.
void
[setTime](../../java/sql/PreparedStatement.html#setTime-int-java.sql.Time-java.util.Calendar-)(int parameterIndex,[Time](../../java/sql/Time.html "class in java.sql") x,[Calendar](../../java/util/Calendar.html "class in java.util") cal)
Sets the designated parameter to the given java.sql.Time
value, using the given Calendar
object.
void
[setTimestamp](../../java/sql/PreparedStatement.html#setTimestamp-int-java.sql.Timestamp-)(int parameterIndex,[Timestamp](../../java/sql/Timestamp.html "class in java.sql") x)
Sets the designated parameter to the given java.sql.Timestamp
value.
void
[setTimestamp](../../java/sql/PreparedStatement.html#setTimestamp-int-java.sql.Timestamp-java.util.Calendar-)(int parameterIndex,[Timestamp](../../java/sql/Timestamp.html "class in java.sql") x,[Calendar](../../java/util/Calendar.html "class in java.util") cal)
Sets the designated parameter to the given java.sql.Timestamp
value, using the given Calendar
object.
void
[setUnicodeStream](../../java/sql/PreparedStatement.html#setUnicodeStream-int-java.io.InputStream-int-)(int parameterIndex,[InputStream](../../java/io/InputStream.html "class in java.io") x, int length)
void
[setURL](../../java/sql/PreparedStatement.html#setURL-int-java.net.URL-)(int parameterIndex,[URL](../../java/net/URL.html "class in java.net") x)
Sets the designated parameter to the given java.net.URL
value.