PreparedStatement (Java Platform SE 7 ) (original) (raw)

Modifier and Type

Method and Description

void

**[addBatch](../../java/sql/PreparedStatement.html#addBatch%28%29)**()

Adds a set of parameters to this PreparedStatement object's batch of commands.

void

**[clearParameters](../../java/sql/PreparedStatement.html#clearParameters%28%29)**()

Clears the current parameter values immediately.

boolean

**[execute](../../java/sql/PreparedStatement.html#execute%28%29)**()

Executes the SQL statement in this PreparedStatement object, which may be any kind of SQL statement.

[ResultSet](../../java/sql/ResultSet.html "interface in java.sql")

**[executeQuery](../../java/sql/PreparedStatement.html#executeQuery%28%29)**()

Executes the SQL query in this PreparedStatement object and returns the ResultSet object generated by the query.

int

**[executeUpdate](../../java/sql/PreparedStatement.html#executeUpdate%28%29)**()

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%28%29)**()

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%28%29)**()

Retrieves the number, types and properties of thisPreparedStatement object's parameters.

void

**[setArray](../../java/sql/PreparedStatement.html#setArray%28int,%20java.sql.Array%29)**(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%28int,%20java.io.InputStream%29)**(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%28int,%20java.io.InputStream,%20int%29)**(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%28int,%20java.io.InputStream,%20long%29)**(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%28int,%20java.math.BigDecimal%29)**(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%28int,%20java.io.InputStream%29)**(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%28int,%20java.io.InputStream,%20int%29)**(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%28int,%20java.io.InputStream,%20long%29)**(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%28int,%20java.sql.Blob%29)**(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%28int,%20java.io.InputStream%29)**(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%28int,%20java.io.InputStream,%20long%29)**(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%28int,%20boolean%29)**(int parameterIndex, boolean x)

Sets the designated parameter to the given Java boolean value.

void

**[setByte](../../java/sql/PreparedStatement.html#setByte%28int,%20byte%29)**(int parameterIndex, byte x)

Sets the designated parameter to the given Java byte value.

void

**[setBytes](../../java/sql/PreparedStatement.html#setBytes%28int,%20byte[]%29)**(int parameterIndex, byte[] x)

Sets the designated parameter to the given Java array of bytes.

void

**[setCharacterStream](../../java/sql/PreparedStatement.html#setCharacterStream%28int,%20java.io.Reader%29)**(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%28int,%20java.io.Reader,%20int%29)**(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%28int,%20java.io.Reader,%20long%29)**(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%28int,%20java.sql.Clob%29)**(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%28int,%20java.io.Reader%29)**(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%28int,%20java.io.Reader,%20long%29)**(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%28int,%20java.sql.Date%29)**(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%28int,%20java.sql.Date,%20java.util.Calendar%29)**(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%28int,%20double%29)**(int parameterIndex, double x)

Sets the designated parameter to the given Java double value.

void

**[setFloat](../../java/sql/PreparedStatement.html#setFloat%28int,%20float%29)**(int parameterIndex, float x)

Sets the designated parameter to the given Java float value.

void

**[setInt](../../java/sql/PreparedStatement.html#setInt%28int,%20int%29)**(int parameterIndex, int x)

Sets the designated parameter to the given Java int value.

void

**[setLong](../../java/sql/PreparedStatement.html#setLong%28int,%20long%29)**(int parameterIndex, long x)

Sets the designated parameter to the given Java long value.

void

**[setNCharacterStream](../../java/sql/PreparedStatement.html#setNCharacterStream%28int,%20java.io.Reader%29)**(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%28int,%20java.io.Reader,%20long%29)**(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%28int,%20java.sql.NClob%29)**(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%28int,%20java.io.Reader%29)**(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%28int,%20java.io.Reader,%20long%29)**(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%28int,%20java.lang.String%29)**(int parameterIndex,[String](../../java/lang/String.html "class in java.lang") value)

Sets the designated paramter to the given String object.

void

**[setNull](../../java/sql/PreparedStatement.html#setNull%28int,%20int%29)**(int parameterIndex, int sqlType)

Sets the designated parameter to SQL NULL.

void

**[setNull](../../java/sql/PreparedStatement.html#setNull%28int,%20int,%20java.lang.String%29)**(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%28int,%20java.lang.Object%29)**(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%28int,%20java.lang.Object,%20int%29)**(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%28int,%20java.lang.Object,%20int,%20int%29)**(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.

void

**[setRef](../../java/sql/PreparedStatement.html#setRef%28int,%20java.sql.Ref%29)**(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%28int,%20java.sql.RowId%29)**(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%28int,%20short%29)**(int parameterIndex, short x)

Sets the designated parameter to the given Java short value.

void

**[setSQLXML](../../java/sql/PreparedStatement.html#setSQLXML%28int,%20java.sql.SQLXML%29)**(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%28int,%20java.lang.String%29)**(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%28int,%20java.sql.Time%29)**(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%28int,%20java.sql.Time,%20java.util.Calendar%29)**(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%28int,%20java.sql.Timestamp%29)**(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%28int,%20java.sql.Timestamp,%20java.util.Calendar%29)**(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%28int,%20java.io.InputStream,%20int%29)**(int parameterIndex,[InputStream](../../java/io/InputStream.html "class in java.io") x, int length)

Deprecated.

void

**[setURL](../../java/sql/PreparedStatement.html#setURL%28int,%20java.net.URL%29)**(int parameterIndex,[URL](../../java/net/URL.html "class in java.net") x)

Sets the designated parameter to the given java.net.URL value.