java.sql
Interface PreparedStatement
java.lang.Object
|
+--java.sql.Statement
|
+--java.sql.PreparedStatement
All Implemented Interfaces:
Statement
public interface
PreparedStatementimplements
Statement This interface provides a mechanism for executing pre-compiled
statements. This provides greater efficiency when calling the same
statement multiple times. Parameters are allowed in a statement,
providings for maximum reusability.
Author:- Aaron M. Renn (arenn@urbanophile.com)
void | addBatch()
|
void | clearParameters()
|
boolean | execute()
|
java.sql.ResultSet | executeQuery()
|
int | executeUpdate()
|
java.sql.ResultSetMetaData | getMetaData()
|
java.sql.ParameterMetaData | getParameterMetaData()
|
void | setArray(int i, java.sql.Array x)
|
void | setAsciiStream(int parameterIndex, java.io.InputStream x, int length)
|
void | setBigDecimal(int parameterIndex, java.math.BigDecimal x)
|
void | setBinaryStream(int parameterIndex, java.io.InputStream x, int length)
|
void | setBlob(int i, java.sql.Blob x)
|
void | setBoolean(int parameterIndex, boolean x)
|
void | setByte(int parameterIndex, byte x)
|
void | setBytes(int parameterIndex, byte[] x)
|
void | setCharacterStream(int parameterIndex, java.io.Reader reader, int length)
|
void | setClob(int i, java.sql.Clob x)
|
void | setDate(int parameterIndex, java.sql.Date x)
|
void | setDate(int parameterIndex, java.sql.Date x, java.util.Calendar cal)
|
void | setDouble(int parameterIndex, double x)
|
void | setFloat(int parameterIndex, float x)
|
void | setInt(int parameterIndex, int x)
|
void | setLong(int parameterIndex, long x)
|
void | setNull(int parameterIndex, int sqlType)
|
void | setNull(int paramIndex, int sqlType, java.lang.String typeName)
|
void | setObject(int parameterIndex, java.lang.Object x, int targetSqlType, int scale)
|
void | setObject(int parameterIndex, java.lang.Object x, int targetSqlType)
|
void | setObject(int parameterIndex, java.lang.Object x)
|
void | setRef(int i, java.sql.Ref x)
|
void | setShort(int parameterIndex, short x)
|
void | setString(int parameterIndex, java.lang.String x)
|
void | setTime(int parameterIndex, java.sql.Time x)
|
void | setTime(int parameterIndex, java.sql.Time x, java.util.Calendar cal)
|
void | setTimestamp(int parameterIndex, java.sql.Timestamp x)
|
void | setTimestamp(int parameterIndex, java.sql.Timestamp x, java.util.Calendar cal)
|
void | setURL(int parameterIndex, java.net.URL x)
|
void | setUnicodeStream(int parameterIndex, java.io.InputStream x, int length)
|
addBatch
public void addBatch()
This method adds a set of parameters to the batch for JDBC 2.0.
Throws:
clearParameters
public void clearParameters()
This method clears all of the input parameter that have been
set on this statement.
Throws:
execute
public boolean execute()
This method executes a prepared SQL query.
Some prepared statements return multiple results; the execute method
handles these complex statements as well as the simpler form of
statements handled by executeQuery and executeUpdate.
Returns:
- The result of the SQL statement.
Throws:
executeQuery
public ResultSet executeQuery()
This method executes a prepared SQL query and returns its ResultSet.
Returns:
- The ResultSet of the SQL statement.
Throws:
executeUpdate
public int executeUpdate()
This method executes an SQL INSERT, UPDATE or DELETE statement. SQL
statements that return nothing such as SQL DDL statements can be executed.
Returns:
- The result is either the row count for INSERT, UPDATE or DELETE
statements; or 0 for SQL statements that return nothing.
Throws:
getMetaData
public ResultSetMetaData getMetaData()
This method returns meta data for the result set from this statement.
Returns:
- Meta data for the result set from this statement.
Throws:
getParameterMetaData
public ParameterMetaData getParameterMetaData()
Since:
setArray
public void setArray(int i, java.sql.Array x)
This method sets the specified parameter from the given Java
Array
value. The default object type to SQL type mapping
will be used.
Parameters:
Throws:
setAsciiStream
public void setAsciiStream(int parameterIndex, java.io.InputStream x, int length)
This method sets the specified parameter from the given Java
ASCII InputStream
value.
Parameters:
Throws:
setBigDecimal
public void setBigDecimal(int parameterIndex, java.math.BigDecimal x)
This method sets the specified parameter from the given Java
java.math.BigDecimal
value.
Parameters:
Throws:
setBinaryStream
public void setBinaryStream(int parameterIndex, java.io.InputStream x, int length)
This method sets the specified parameter from the given Java
binary InputStream
value.
Parameters:
Throws:
setBlob
public void setBlob(int i, java.sql.Blob x)
This method sets the specified parameter from the given Java
Blob
value. The default object type to SQL type mapping
will be used.
Parameters:
Throws:
setBoolean
public void setBoolean(int parameterIndex, boolean x)
This method sets the specified parameter from the given Java
boolean
value.
Parameters:
Throws:
setByte
public void setByte(int parameterIndex, byte x)
This method sets the specified parameter from the given Java
byte
value.
Parameters:
Throws:
setBytes
public void setBytes(int parameterIndex, byte[] x)
This method sets the specified parameter from the given Java
byte
array value.
Parameters:
Throws:
setCharacterStream
public void setCharacterStream(int parameterIndex, java.io.Reader reader, int length)
This method sets the specified parameter from the given Java
character Reader
value.
Parameters:
Throws:
setClob
public void setClob(int i, java.sql.Clob x)
This method sets the specified parameter from the given Java
Clob
value. The default object type to SQL type mapping
will be used.
Parameters:
Throws:
setDate
public void setDate(int parameterIndex, java.sql.Date x)
This method sets the specified parameter from the given Java
java.sql.Date
value.
Parameters:
Throws:
setDate
public void setDate(int parameterIndex, java.sql.Date x, java.util.Calendar cal)
This method sets the specified parameter from the given Java
java.sql.Date
value.
Parameters:
Throws:
setDouble
public void setDouble(int parameterIndex, double x)
This method sets the specified parameter from the given Java
double
value.
Parameters:
Throws:
setFloat
public void setFloat(int parameterIndex, float x)
This method sets the specified parameter from the given Java
float
value.
Parameters:
Throws:
setInt
public void setInt(int parameterIndex, int x)
This method sets the specified parameter from the given Java
int
value.
Parameters:
Throws:
setLong
public void setLong(int parameterIndex, long x)
This method sets the specified parameter from the given Java
long
value.
Parameters:
Throws:
setNull
public void setNull(int parameterIndex, int sqlType)
This method populates the specified parameter with a SQL NULL value
for the specified type.
Parameters:
Throws:
setNull
public void setNull(int paramIndex, int sqlType, java.lang.String typeName)
This method populates the specified parameter with a SQL NULL value
for the specified type.
Parameters:
Throws:
setObject
public void setObject(int parameterIndex, java.lang.Object x)
This method sets the specified parameter from the given Java
Object
value. The default object type to SQL type mapping
will be used.
Parameters:
Throws:
setObject
public void setObject(int parameterIndex, java.lang.Object x, int targetSqlType)
This method sets the specified parameter from the given Java
Object
value. The specified SQL object type will be used.
Parameters:
Throws:
See Also:
setObject
public void setObject(int parameterIndex, java.lang.Object x, int targetSqlType, int scale)
This method sets the specified parameter from the given Java
Object
value. The specified SQL object type will be used.
Parameters:
Throws:
See Also:
setRef
public void setRef(int i, java.sql.Ref x)
This method sets the specified parameter from the given Java
Ref
value. The default object type to SQL type mapping
will be used.
Parameters:
Throws:
setShort
public void setShort(int parameterIndex, short x)
This method sets the specified parameter from the given Java
short
value.
Parameters:
Throws:
setString
public void setString(int parameterIndex, java.lang.String x)
This method sets the specified parameter from the given Java
String
value.
Parameters:
Throws:
setTime
public void setTime(int parameterIndex, java.sql.Time x)
This method sets the specified parameter from the given Java
java.sql.Time
value.
Parameters:
Throws:
setTime
public void setTime(int parameterIndex, java.sql.Time x, java.util.Calendar cal)
This method sets the specified parameter from the given Java
java.sql.Time
value.
Parameters:
Throws:
setTimestamp
public void setTimestamp(int parameterIndex, java.sql.Timestamp x)
This method sets the specified parameter from the given Java
java.sql.Timestamp
value.
Parameters:
Throws:
setTimestamp
public void setTimestamp(int parameterIndex, java.sql.Timestamp x, java.util.Calendar cal)
This method sets the specified parameter from the given Java
java.sql.Timestamp
value.
Parameters:
Throws:
setURL
public void setURL(int parameterIndex, java.net.URL x)
Since:Parameters:
setUnicodeStream
public void setUnicodeStream(int parameterIndex, java.io.InputStream x, int length)
This method sets the specified parameter from the given Java
Unicode UTF-8 InputStream
value.
Parameters:
Throws: