public class FieldNamedPreparedStatementImpl extends Object implements FieldNamedPreparedStatement
FieldNamedPreparedStatement.| Modifier and Type | Method and Description |
|---|---|
void |
addBatch()
Adds a set of parameters to this
NamedPreparedStatement object's batch of
commands. |
void |
clearParameters()
Clears the current parameter values immediately.
|
void |
close()
Releases this
Statement object's database and JDBC resources immediately instead
of waiting for this to happen when it is automatically closed. |
int[] |
executeBatch()
Submits a batch of commands to the database for execution and if all commands execute
successfully, returns an array of update counts.
|
ResultSet |
executeQuery()
Executes the SQL query in this
NamedPreparedStatement object and returns the
ResultSet object generated by the query. |
static String |
parseNamedStatement(String sql,
Map<String,List<Integer>> paramMap)
Parses a sql with named parameters.
|
static FieldNamedPreparedStatement |
prepareStatement(Connection connection,
String sql,
String[] fieldNames,
String additionalPredicates,
int numberOfDynamicParams) |
void |
setBigDecimal(int fieldIndex,
BigDecimal x)
Sets the designated parameter to the given
java.math.BigDecimal value. |
void |
setBoolean(int fieldIndex,
boolean x)
Sets the designated parameter to the given Java
boolean value. |
void |
setByte(int fieldIndex,
byte x)
Sets the designated parameter to the given Java
byte value. |
void |
setBytes(int fieldIndex,
byte[] x)
Sets the designated parameter to the given Java array of bytes.
|
void |
setDate(int fieldIndex,
Date 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 |
setDouble(int fieldIndex,
double x)
Sets the designated parameter to the given Java
double value. |
void |
setFloat(int fieldIndex,
float x)
Sets the designated parameter to the given Java
float value. |
void |
setInt(int fieldIndex,
int x)
Sets the designated parameter to the given Java
int value. |
void |
setLong(int fieldIndex,
long x)
Sets the designated parameter to the given Java
long value. |
void |
setNull(int fieldIndex,
int sqlType)
Sets the designated parameter to SQL
NULL. |
void |
setObject(int fieldIndex,
Object x)
Sets the value of the designated parameter using the given object.
|
void |
setShort(int fieldIndex,
short x)
Sets the designated parameter to the given Java
short value. |
void |
setString(int fieldIndex,
String x)
Sets the designated parameter to the given Java
String value. |
void |
setTime(int fieldIndex,
Time x)
Sets the designated parameter to the given
java.sql.Time value. |
void |
setTimestamp(int fieldIndex,
Timestamp x)
Sets the designated parameter to the given
java.sql.Timestamp value. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprepareStatementpublic void clearParameters()
throws SQLException
FieldNamedPreparedStatementIn 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.
clearParameters in interface FieldNamedPreparedStatementSQLExceptionPreparedStatement.clearParameters()public ResultSet executeQuery() throws SQLException
FieldNamedPreparedStatementNamedPreparedStatement object and returns the
ResultSet object generated by the query.executeQuery in interface FieldNamedPreparedStatementSQLExceptionPreparedStatement.executeQuery()public void addBatch()
throws SQLException
FieldNamedPreparedStatementNamedPreparedStatement object's batch of
commands.addBatch in interface FieldNamedPreparedStatementSQLExceptionPreparedStatement.addBatch()public int[] executeBatch()
throws SQLException
FieldNamedPreparedStatementint elements of the array
that is returned are ordered to correspond to the commands in the batch, which are ordered
according to the order in which they were added to the batch.executeBatch in interface FieldNamedPreparedStatementSQLExceptionStatement.executeBatch()public void setNull(int fieldIndex,
int sqlType)
throws SQLException
FieldNamedPreparedStatementNULL.
Note: You must specify the parameter's SQL type.
setNull in interface FieldNamedPreparedStatementSQLExceptionPreparedStatement.setNull(int, int)public void setBoolean(int fieldIndex,
boolean x)
throws SQLException
FieldNamedPreparedStatementboolean value. The driver
converts this to an SQL BIT or BOOLEAN value when it sends it to
the database.setBoolean in interface FieldNamedPreparedStatementSQLExceptionPreparedStatement.setBoolean(int, boolean)public void setByte(int fieldIndex,
byte x)
throws SQLException
FieldNamedPreparedStatementbyte value. The driver converts
this to an SQL TINYINT value when it sends it to the database.setByte in interface FieldNamedPreparedStatementSQLExceptionPreparedStatement.setByte(int, byte)public void setShort(int fieldIndex,
short x)
throws SQLException
FieldNamedPreparedStatementshort value. The driver converts
this to an SQL SMALLINT value when it sends it to the database.setShort in interface FieldNamedPreparedStatementSQLExceptionPreparedStatement.setShort(int, short)public void setInt(int fieldIndex,
int x)
throws SQLException
FieldNamedPreparedStatementint value. The driver converts
this to an SQL INTEGER value when it sends it to the database.setInt in interface FieldNamedPreparedStatementSQLExceptionPreparedStatement.setInt(int, int)public void setLong(int fieldIndex,
long x)
throws SQLException
FieldNamedPreparedStatementlong value. The driver converts
this to an SQL BIGINT value when it sends it to the database.setLong in interface FieldNamedPreparedStatementSQLExceptionPreparedStatement.setLong(int, long)public void setFloat(int fieldIndex,
float x)
throws SQLException
FieldNamedPreparedStatementfloat value. The driver converts
this to an SQL REAL value when it sends it to the database.setFloat in interface FieldNamedPreparedStatementSQLExceptionPreparedStatement.setFloat(int, float)public void setDouble(int fieldIndex,
double x)
throws SQLException
FieldNamedPreparedStatementdouble value. The driver
converts this to an SQL DOUBLE value when it sends it to the database.setDouble in interface FieldNamedPreparedStatementSQLExceptionPreparedStatement.setDouble(int, double)public void setBigDecimal(int fieldIndex,
BigDecimal x)
throws SQLException
FieldNamedPreparedStatementjava.math.BigDecimal value. The
driver converts this to an SQL NUMERIC value when it sends it to the database.setBigDecimal in interface FieldNamedPreparedStatementSQLExceptionPreparedStatement.setBigDecimal(int, BigDecimal)public void setString(int fieldIndex,
String x)
throws SQLException
FieldNamedPreparedStatementString value. The driver
converts this to an SQL VARCHAR or LONGVARCHAR value (depending on
the argument's size relative to the driver's limits on VARCHAR values) when it
sends it to the database.setString in interface FieldNamedPreparedStatementSQLExceptionPreparedStatement.setString(int, String)public void setBytes(int fieldIndex,
byte[] x)
throws SQLException
FieldNamedPreparedStatementVARBINARY or LONGVARBINARY (depending on the argument's size
relative to the driver's limits on VARBINARY values) when it sends it to the
database.setBytes in interface FieldNamedPreparedStatementSQLExceptionPreparedStatement.setBytes(int, byte[])public void setDate(int fieldIndex,
Date x)
throws SQLException
FieldNamedPreparedStatementjava.sql.Date value using the default
time zone of the virtual machine that is running the application. The driver converts this to
an SQL DATE value when it sends it to the database.setDate in interface FieldNamedPreparedStatementSQLExceptionPreparedStatement.setDate(int, Date)public void setTime(int fieldIndex,
Time x)
throws SQLException
FieldNamedPreparedStatementjava.sql.Time value. The driver
converts this to an SQL TIME value when it sends it to the database.setTime in interface FieldNamedPreparedStatementSQLExceptionPreparedStatement.setTime(int, Time)public void setTimestamp(int fieldIndex,
Timestamp x)
throws SQLException
FieldNamedPreparedStatementjava.sql.Timestamp value. The driver
converts this to an SQL TIMESTAMP value when it sends it to the database.setTimestamp in interface FieldNamedPreparedStatementSQLExceptionPreparedStatement.setTimestamp(int, Timestamp)public void setObject(int fieldIndex,
Object x)
throws SQLException
FieldNamedPreparedStatementsetObject in interface FieldNamedPreparedStatementSQLExceptionPreparedStatement.setObject(int, Object)public void close()
throws SQLException
FieldNamedPreparedStatementStatement object's database and JDBC resources immediately instead
of waiting for this to happen when it is automatically closed. It is generally good practice
to release resources as soon as you are finished with them to avoid tying up database
resources.close in interface AutoCloseableclose in interface FieldNamedPreparedStatementSQLExceptionStatement.close()public static FieldNamedPreparedStatement prepareStatement(Connection connection, String sql, String[] fieldNames, String additionalPredicates, int numberOfDynamicParams) throws SQLException
prepareStatement in interface FieldNamedPreparedStatementSQLExceptionpublic static String parseNamedStatement(String sql, Map<String,List<Integer>> paramMap)
sql - sql to parseparamMap - map to hold parameter-index mappingsCopyright © 2022–2024 The Apache Software Foundation. All rights reserved.