public class PreparedStatement extends Statement implements PreparedStatement
| 限定符和类型 | 字段和说明 |
|---|---|
protected short |
paramTypes
该变量用来存放存储过程、函数的参数是什么类型:in,out,in out
|
protected boolean |
shouldPrepared
区分是否将SQL语句发往服务器预处理,当为false表示不发送,当为true表示要发送
|
batchCount, batchMajorVersion, batchMinorVersion, blobColParam, colMap, connection, conObjName, curId, cursorFirstCount, cursorFirstOver, fetchSize, generateKey, isBatchSql, isBuildingMap, isCallable, isCallProc, isClosed, isExeBatch, isFetchSql, isFunction, isOutP, isPoolable, isPrepared, isQuery, isReturnCount, maxSize, paramAllStrs, paramBytes, paramConstMap, paramCount, paramList, paramLobs, paramNameFunc, paramNameIndex, paramNameToIndex, queryTime, resultDirection, schemaName, serverBatchCount, sqlQuery, stId, stmIsOver, stmWarning, tableName, updateCount| 构造器和说明 |
|---|
PreparedStatement(Connection connection,
String database) |
PreparedStatement(Connection connection,
String database,
String originalSql,
boolean isCallable) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addBatch()
Adds a set of parameters to this
PreparedStatement
object's batch of commands. |
int |
addBatch1()
Title: addBatch1
Description: 客户端添加方法用户获取批处理条数
|
void |
clearBatch()
Empties this
Statement object's current list of
SQL commands. |
void |
clearParameters()
Clears the current parameter values immediately.
|
boolean |
execute()
Executes the SQL statement in this
PreparedStatement object,
which may be any kind of SQL statement. |
int[] |
executeBatch()
执行批处理命令
当批处理命令是Delete或Update时,删除/修改的记录行数比批处理条数要少,
因为服务器没有返具体那条成功那条不成功,所以在返回的int[]中,每条批命令都成功
|
ResultSet |
executeQuery()
Executes the SQL query in this
PreparedStatement object
and returns the ResultSet object generated by the query. |
int |
executeUpdate()
Executes the SQL statement in this
PreparedStatement object,
which must be an SQL INSERT, UPDATE or
DELETE statement; or an SQL statement that returns nothing,
such as a DDL statement. |
protected byte[] |
get0x0Bytes()
生成一个长度为1,且值为0x0的byte数组
|
Hashtable<Integer,String> |
getInsertRowids()
取插入记录的rowid
|
ResultSetMetaData |
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 |
getParameterMetaData()
Retrieves the number, types and properties of this
PreparedStatement object's parameters. |
protected short |
getParamType(ParamList param,
int idx,
int methode)
该方法用于判断修改绑定参数的类型,是in(1),out(2),in out(3)参数
判断原理:当参数对应的Parameter对象中,如果isRegist=true,在调用setXX()方法时,要将参数类型设置为in out参数
当参数对应的Parameter对象中,如果isSet=true,在调用registXX()方法时,要将参数类型设置为in out参数
当参数对应的Parameter对象中,如果isRegist=false且isSet=false时:
在调用setXX()方法时,要将参数类型设置为in参数;在调用registXX()方法时,要将参数类型设置为out参数
|
protected short |
getSetRedHorseTypeFromJavaType(int sqlType) |
boolean |
isClosed()
该方法返回值为true时,该Statement关闭
|
boolean |
isPoolable() |
boolean |
isWrapperFor(Class arg0) |
void |
setArray(int i,
Array x)
Sets the designated parameter to the given
Array object. |
void |
setAsciiStream(int parameterIndex,
InputStream x) |
void |
setAsciiStream(int parameterIndex,
InputStream x,
int length)
Sets the designated parameter to the given input stream, which will have
the specified number of bytes.
|
void |
setAsciiStream(int parameterIndex,
InputStream x,
long length) |
void |
setBigDecimal(int parameterIndex,
BigDecimal x)
Sets the designated parameter to the given
java.math.BigDecimal value. |
void |
setBinaryStream(int parameterIndex,
InputStream x) |
void |
setBinaryStream(int parameterIndex,
InputStream x,
int length)
Sets the designated parameter to the given input stream, which will have
the specified number of bytes.
|
void |
setBinaryStream(int parameterIndex,
InputStream x,
long length) |
void |
setBlob(int parameterIndex,
Blob x)
Sets the designated parameter to the given
Blob object. |
void |
setBlob(int parameterIndex,
InputStream inputStream) |
void |
setBlob(int parameterIndex,
InputStream inputStream,
long length) |
void |
setBoolean(int parameterIndex,
boolean x)
Sets the designated parameter to the given Java
boolean value. |
void |
setByte(int parameterIndex,
byte x)
Sets the designated parameter to the given Java
byte value. |
void |
setBytes(int parameterIndex,
byte[] x)
Sets the designated parameter to the given Java array of bytes.
|
void |
setCharacterStream(int parameterIndex,
Reader reader)
modify by sdc @20140911
|
void |
setCharacterStream(int parameterIndex,
Reader reader,
int length)
modify by sdc @20140911
|
void |
setCharacterStream(int parameterIndex,
Reader reader,
long length)
Sets the designated parameter to the given
Reader
object, which is the given number of characters long. |
void |
setClob(int parameterIndex,
Clob x)
Sets the designated parameter to the given
Clob object. |
void |
setClob(int parameterIndex,
Reader reader)
modify by sdc @20140911
|
void |
setClob(int parameterIndex,
Reader reader,
long length)
modify by sdc @20140911
|
void |
setDate(int parameterIndex,
Date x)
Sets the designated parameter to the given
java.sql.Date value. |
void |
setDate(int parameterIndex,
Date x,
Calendar cal)
Sets the designated parameter to the given
java.sql.Date value,
using the given Calendar object. |
protected void |
setDateTime_TZ(int parameterIndex,
String dtime_tz) |
protected void |
setDatetime(int parameterIndex,
Timestamp x)
XUGU特有数据类型datatime设置参数值
|
void |
setDouble(int parameterIndex,
double x)
Sets the designated parameter to the given Java
double value. |
void |
setFloat(int parameterIndex,
float x)
Sets the designated parameter to the given Java
float value. |
void |
setInt(int parameterIndex,
int x)
Sets the designated parameter to the given Java
int value. |
protected void |
setInterval_D(int parameterIndex,
String interval_d) |
protected void |
setInterval_D2H(int parameterIndex,
String interval_d2h) |
protected void |
setInterval_D2M(int parameterIndex,
String interval_d2m) |
protected void |
setInterval_D2S(int parameterIndex,
String interval_d2s) |
protected void |
setInterval_H(int parameterIndex,
String interval_h) |
protected void |
setInterval_H2M(int parameterIndex,
String interval_h2m) |
protected void |
setInterval_H2S(int parameterIndex,
String interval_h2s) |
protected void |
setInterval_M(int parameterIndex,
String interval_m) |
protected void |
setInterval_M2S(int parameterIndex,
String interval_m2s) |
protected void |
setInterval_MI(int parameterIndex,
String interval_mi) |
protected void |
setInterval_S(int parameterIndex,
String interval_s) |
protected void |
setInterval_Y(int parameterIndex,
String interval_y) |
protected void |
setInterval_Y2M(int parameterIndex,
String interval_y2m) |
protected void |
setInterval(int parameterIndex,
short redhorseType,
Object intervalObj) |
void |
setLong(int parameterIndex,
long x)
Sets the designated parameter to the given Java
long value. |
void |
setNCharacterStream(int parameterIndex,
Reader value)
jdbc4.0
|
void |
setNCharacterStream(int parameterIndex,
Reader value,
long length)
jdbc4.0
|
void |
setNClob(int parameterIndex,
NClob value)
JDBC4.0
|
void |
setNClob(int parameterIndex,
Reader reader)
modify by sdc @20140911
|
void |
setNClob(int parameterIndex,
Reader reader,
long length)
JDBC4.0
|
void |
setNString(int parameterIndex,
String value) |
void |
setNull(int parameterIndex,
int sqlType)
Sets the designated parameter to SQL
NULL. |
void |
setNull(int paramIndex,
int sqlType,
String typeName)
Sets the designated parameter to SQL
NULL. |
void |
setObject(int parameterIndex,
Object x)
Sets the value of the designated parameter using the given object.
|
void |
setObject(int parameterIndex,
Object x,
int targetSqlType)
2010-4-23 cao实现此方法,根据targetSqlType来定义Object(x)对象.
|
void |
setObject(int parameterIndex,
Object x,
int targetSqlType,
int scale)
Sets the value of the designated parameter with the given object.
|
void |
setPoolable(boolean poolable) |
void |
setRef(int i,
Ref x)
Sets the designated parameter to the given
REF(<structured-type>) value. |
void |
setRowId(int parameterIndex,
RowId x) |
void |
setShort(int parameterIndex,
short x)
Sets the designated parameter to the given Java
short value. |
void |
setSQLXML(int parameterIndex,
SQLXML xmlObject)
JDBC4.0
|
void |
setString(int parameterIndex,
String x)
Sets the designated parameter to the given Java
String value. |
protected void |
setTime_TZ(int parameterIndex,
String time_tz)
设置带时区(withTimezone)的参数方法
|
void |
setTime(int parameterIndex,
Time x)
Sets the designated parameter to the given
java.sql.Time value. |
void |
setTime(int parameterIndex,
Time x,
Calendar cal)
Sets the designated parameter to the given
java.sql.Time value,
using the given Calendar object. |
void |
setTimestamp(int parameterIndex,
Timestamp x)
Sets the designated parameter to the given
java.sql.Timestamp value. |
void |
setTimestamp(int parameterIndex,
Timestamp x,
Calendar cal)
Sets the designated parameter to the given
java.sql.Timestamp value,
using the given Calendar object. |
void |
setUnicodeStream(int parameterIndex,
InputStream x,
int length)
已过时。
|
void |
setURL(int parameterIndex,
URL x)
Sets the designated parameter to the given
java.net.URL value. |
Object |
unwrap(Class arg0) |
addBatch, byteToDouble, byteToFloat, byteToInt, byteToLong, byteToNumeric, byteToShort, cancel, checkBCountAndPCount, checkCallInParam, checkCallOutParam, checkCallOutParam, checkGeneratedKey, checkSqlLen, checkSQLNull, clearWarnings, close, closeOnCompletion, distillTbName, execute, execute, execute, execute, execute, executeLob, executeQuery, executeQueryFetch, executeStream, executeStream, executeStreamLoad, executeUpdate, executeUpdate, executeUpdate, executeUpdate, executeWithNoCallCheck, firstResultSet, flush, getColumnName, getConnection, getCursorFirstCount, getErr_Code, getExecuteStr, getFetchDirection, getFetchSize, getGeneratedKeys, getLobResultSet, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getProcName, getProcParamsName, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getRowid, getServerCursor, getServerMajorVersion, getServerMinorVersion, getSqlsEffectCountVector, getUpdateCount, getWarnings, initExecuteEnviorment, intToByte, isCloseOnCompletion, isFetchSql, isLimitParamSql, isReturnValues, isStmIsOver, longToByte, manificateRs, reSizeBuffer, resumeRowid, resumeSendType, rsRowData, sendTaskNum, serverSupportBatch, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setFetchSql, setIndexMaping, setMaxFieldSize, setMaxRows, setQueryTimeout, setRecv_mode, setResultsetFirstSize, setServerCursor, setSQLExecuteMG, setStmIsOver, setStmWarning, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitexecuteLargeUpdate, setObject, setObjectaddBatch, cancel, clearWarnings, close, closeOnCompletion, execute, execute, execute, execute, 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, isCloseOnCompletion, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setQueryTimeoutprotected short paramTypes
protected boolean shouldPrepared
public PreparedStatement(Connection connection, String database, String originalSql, boolean isCallable) throws SQLException
SQLExceptionpublic PreparedStatement(Connection connection, String database) throws SQLException
SQLExceptionpublic ResultSet executeQuery() throws SQLException
PreparedStatement object
and returns the ResultSet object generated by the query.executeQuery 在接口中 PreparedStatementResultSet object that contains the data produced by the
query; never nullSQLException - if a database access error occurs or the SQL
statement does not return a ResultSet objectpublic int executeUpdate()
throws SQLException
PreparedStatement object,
which must be an SQL INSERT, UPDATE or
DELETE statement; or an SQL statement that returns nothing,
such as a DDL statement.executeUpdate 在接口中 PreparedStatementINSERT, UPDATE,
or DELETE statements
or (2) 0 for SQL statements that return nothingSQLException - if a database access error occurs or the SQL
statement returns a ResultSet objectpublic void setNull(int parameterIndex,
int sqlType)
throws SQLException
NULL.
Note: You must specify the parameter's SQL type.
setNull 在接口中 PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...sqlType - the SQL type code defined in java.sql.TypesSQLException - if a database access error occurspublic void setBoolean(int parameterIndex,
boolean x)
throws SQLException
boolean value.
The driver converts this
to an SQL BIT value when it sends it to the database.setBoolean 在接口中 PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...x - the parameter valueSQLException - if a database access error occurspublic void setByte(int parameterIndex,
byte x)
throws SQLException
byte value.
The driver converts this
to an SQL TINYINT value when it sends it to the database.setByte 在接口中 PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...x - the parameter valueSQLException - if a database access error occurspublic void setShort(int parameterIndex,
short x)
throws SQLException
short value.
The driver converts this
to an SQL SMALLINT value when it sends it to the database.setShort 在接口中 PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...x - the parameter valueSQLException - if a database access error occurspublic void setInt(int parameterIndex,
int x)
throws SQLException
int value.
The driver converts this
to an SQL INTEGER value when it sends it to the database.setInt 在接口中 PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...x - the parameter valueSQLException - if a database access error occurspublic void setLong(int parameterIndex,
long x)
throws SQLException
long value.
The driver converts this
to an SQL BIGINT value when it sends it to the database.setLong 在接口中 PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...x - the parameter valueSQLException - if a database access error occurspublic void setFloat(int parameterIndex,
float x)
throws SQLException
float value.
The driver converts this
to an SQL FLOAT value when it sends it to the database.setFloat 在接口中 PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...x - the parameter valueSQLException - if a database access error occurspublic void setDouble(int parameterIndex,
double x)
throws SQLException
double value.
The driver converts this
to an SQL DOUBLE value when it sends it to the database.setDouble 在接口中 PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...x - the parameter valueSQLException - if a database access error occurspublic void setBigDecimal(int parameterIndex,
BigDecimal x)
throws SQLException
java.math.BigDecimal value.
The driver converts this to an SQL NUMERIC value when
it sends it to the database.setBigDecimal 在接口中 PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...x - the parameter valueSQLException - if a database access error occurspublic void setString(int parameterIndex,
String x)
throws SQLException
String 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 在接口中 PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...x - the parameter valueSQLException - if a database access error occurspublic void setBytes(int parameterIndex,
byte[] x)
throws SQLException
VARBINARY 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 在接口中 PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...x - the parameter valueSQLException - if a database access error occurspublic void setDate(int parameterIndex,
Date x)
throws SQLException
java.sql.Date value.
The driver converts this
to an SQL DATE value when it sends it to the database.setDate 在接口中 PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...x - the parameter valueSQLException - if a database access error occurspublic void setTime(int parameterIndex,
Time x)
throws SQLException
java.sql.Time value.
The driver converts this
to an SQL TIME value when it sends it to the database.setTime 在接口中 PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...x - the parameter valueSQLException - if a database access error occurspublic void setTimestamp(int parameterIndex,
Timestamp x)
throws SQLException
java.sql.Timestamp value.
The driver
converts this to an SQL TIMESTAMP value when it sends it to the
database.setTimestamp 在接口中 PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...x - the parameter valueSQLException - if a database access error occursprotected void setDatetime(int parameterIndex,
Timestamp x)
throws SQLException
SQLExceptionpublic void setAsciiStream(int parameterIndex,
InputStream x,
int length)
throws SQLException
LONGVARCHAR
parameter, it may be more practical to send it via a
java.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.
setAsciiStream 在接口中 PreparedStatementparameterIndex - 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 streamSQLException - if a database access error occurspublic void setUnicodeStream(int parameterIndex,
InputStream x,
int length)
throws SQLException
When a very large Unicode value is input to a LONGVARCHAR
parameter, it may be more practical to send it via a
java.io.InputStream object. 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.
setUnicodeStream 在接口中 PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...x - a java.io.InputStream object that contains the
Unicode parameter value as two-byte Unicode characterslength - the number of bytes in the streamSQLException - if a database access error occurspublic void setBinaryStream(int parameterIndex,
InputStream x,
int length)
throws SQLException
LONGVARBINARY
parameter, it may be more practical to send it via a
java.io.InputStream object. 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.
setBinaryStream 在接口中 PreparedStatementparameterIndex - 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 streamSQLException - if a database access error occurspublic void clearParameters()
throws SQLException
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.
clearParameters 在接口中 PreparedStatementSQLException - if a database access error occurspublic void setObject(int parameterIndex,
Object x,
int targetSqlType,
int scale)
throws SQLException
Sets the value of the designated parameter with the given object. The second
argument must be an object type; for integral values, the
java.lang equivalent 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 method SQLData.writeSQL to
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 database-specific abstract data types.
setObject 在接口中 PreparedStatementparameterIndex - 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.SQLException - if a database access error occursTypespublic void setObject(int parameterIndex,
Object x,
int targetSqlType)
throws SQLException
setObject 在接口中 PreparedStatementSQLExceptionpublic void setObject(int parameterIndex,
Object x)
throws SQLException
Sets the value of the designated parameter using the given object.
The second parameter must be of type Object; therefore, the
java.lang equivalent objects should be used for built-in types.
The JDBC specification specifies a standard mapping from
Java Object types 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 method SQLData.writeSQL
to 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.
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.
setObject 在接口中 PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...x - the object containing the input parameter valueSQLException - if a database access error occurs or the type
of the given object is ambiguouspublic boolean execute()
throws SQLException
PreparedStatement object,
which may be any kind of SQL statement.
Some prepared statements return multiple results; the execute
method handles these complex statements as well as the simpler
form of statements handled by the methods executeQuery
and executeUpdate.
The execute method returns a boolean to
indicate the form of the first result. You must call either the method
getResultSet or getUpdateCount
to retrieve the result; you must call getMoreResults to
move to any subsequent result(s).
execute 在接口中 PreparedStatementtrue if the first result is a ResultSet
object; false if the first result is an update
count or there is no resultSQLException - if a database access error occurs or an argument
is supplied to this methodStatement.execute(java.lang.String),
Statement.getResultSet(),
Statement.getUpdateCount(),
Statement.getMoreResults()public void addBatch()
throws SQLException
PreparedStatement
object's batch of commands.addBatch 在接口中 PreparedStatementSQLException - if a database access error occursStatement.addBatch(java.lang.String)public int addBatch1()
throws SQLException
Title: addBatch1
Description: 客户端添加方法用户获取批处理条数
SQLExceptionpublic int[] executeBatch()
throws SQLException
executeBatch 在接口中 StatementexecuteBatch 在类中 StatementSQLException - if a database access error occurs or the
driver does not support batch statements. Throws BatchUpdateException
(a subclass of SQLException) if one of the commands sent to the
database fails to execute properly or attempts to return a result set.public void setCharacterStream(int parameterIndex,
Reader reader,
long length)
throws SQLException
Reader
object, which is the given number of characters long.
When a very large UNICODE value is input to a LONGVARCHAR
parameter, it may be more practical to send it via a
java.io.Reader object. 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.
setCharacterStream 在接口中 PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...reader - the java.io.Reader object that contains the
Unicode datalength - the number of characters in the streamSQLException - if a database access error occurspublic void setRef(int i,
Ref x)
throws SQLException
REF(<structured-type>) value.
The driver converts this to an SQL REF value when it
sends it to the database.setRef 在接口中 PreparedStatementi - the first parameter is 1, the second is 2, ...x - an SQL REF valueSQLException - if a database access error occurspublic void setBlob(int parameterIndex,
Blob x)
throws SQLException
Blob object.
The driver converts this to an SQL BLOB value when it
sends it to the database.setBlob 在接口中 PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...x - a Blob object that maps an SQL BLOB valueSQLException - if a database access error occurspublic void setClob(int parameterIndex,
Clob x)
throws SQLException
Clob object.
The driver converts this to an SQL CLOB value when it
sends it to the database.setClob 在接口中 PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...x - a Clob object that maps an SQL CLOB valueSQLException - if a database access error occurspublic void setArray(int i,
Array x)
throws SQLException
Array object.
The driver converts this to an SQL ARRAY value when it
sends it to the database.setArray 在接口中 PreparedStatementi - the first parameter is 1, the second is 2, ...x - an Array object that maps an SQL ARRAY valueSQLException - if a database access error occurspublic ResultSetMetaData getMetaData() throws SQLException
ResultSetMetaData object that contains
information about the columns of the ResultSet object
that will be returned when this PreparedStatement object
is executed.
Because a PreparedStatement object is precompiled, it is
possible to know about the ResultSet object that it will
return without having to execute it. Consequently, it is possible
to invoke the method getMetaData on a
PreparedStatement object rather than waiting to execute
it and then invoking the ResultSet.getMetaData method
on the ResultSet object that is returned.
NOTE: Using this method may be expensive for some drivers due to the lack of underlying DBMS support.
getMetaData 在接口中 PreparedStatementResultSet object's columns or
null if the driver cannot return a
ResultSetMetaData objectSQLException - if a database access error occurspublic void setDate(int parameterIndex,
Date x,
Calendar cal)
throws SQLException
java.sql.Date value,
using the given Calendar object. The driver uses
the Calendar object to construct an SQL DATE value,
which the driver then sends to the database. With
a Calendar object, the driver can calculate the date
taking into account a custom timezone. If no
Calendar object is specified, the driver uses the default
timezone, which is that of the virtual machine running the application.setDate 在接口中 PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...x - the parameter valuecal - the Calendar object the driver will use
to construct the dateSQLException - if a database access error occurspublic void setTime(int parameterIndex,
Time x,
Calendar cal)
throws SQLException
java.sql.Time value,
using the given Calendar object. The driver uses
the Calendar object to construct an SQL TIME value,
which the driver then sends to the database. With
a Calendar object, the driver can calculate the time
taking into account a custom timezone. If no
Calendar object is specified, the driver uses the default
timezone, which is that of the virtual machine running the application.setTime 在接口中 PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...x - the parameter valuecal - the Calendar object the driver will use
to construct the timeSQLException - if a database access error occurspublic void setTimestamp(int parameterIndex,
Timestamp x,
Calendar cal)
throws SQLException
java.sql.Timestamp value,
using the given Calendar object. The driver uses
the Calendar object to construct an SQL TIMESTAMP value,
which the driver then sends to the database. With a
Calendar object, the driver can calculate the timestamp
taking into account a custom timezone. If no
Calendar object is specified, the driver uses the default
timezone, which is that of the virtual machine running the application.setTimestamp 在接口中 PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...x - the parameter valuecal - the Calendar object the driver will use
to construct the timestampSQLException - if a database access error occurspublic void setNull(int paramIndex,
int sqlType,
String typeName)
throws SQLException
NULL.
This version of the method setNull should
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.
setNull 在接口中 PreparedStatementparamIndex - the first parameter is 1, the second is 2, ...sqlType - a value from java.sql.TypestypeName - the fully-qualified name of an SQL user-defined type;
ignored if the parameter is not a user-defined type or REFSQLException - if a database access error occurspublic void setURL(int parameterIndex,
URL x)
throws SQLException
java.net.URL value.
The driver converts this to an SQL DATALINK value
when it sends it to the database.setURL 在接口中 PreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...x - the java.net.URL object to be setSQLException - if a database access error occurspublic ParameterMetaData getParameterMetaData() throws SQLException
PreparedStatement object's parameters.getParameterMetaData 在接口中 PreparedStatementParameterMetaData object that contains information
about the number, types and properties of this
PreparedStatement object's parametersSQLException - if a database access error occursParameterMetaDatapublic boolean isClosed()
throws SQLException
StatementisClosed 在接口中 StatementisClosed 在类中 StatementSQLExceptionpublic boolean isPoolable()
throws SQLException
isPoolable 在接口中 StatementisPoolable 在类中 StatementSQLExceptionpublic void setPoolable(boolean poolable)
throws SQLException
setPoolable 在接口中 StatementsetPoolable 在类中 StatementSQLExceptionpublic void setAsciiStream(int parameterIndex,
InputStream x,
long length)
throws SQLException
setAsciiStream 在接口中 PreparedStatementSQLExceptionpublic void setAsciiStream(int parameterIndex,
InputStream x)
throws SQLException
setAsciiStream 在接口中 PreparedStatementSQLExceptionpublic void setBinaryStream(int parameterIndex,
InputStream x,
long length)
throws SQLException
setBinaryStream 在接口中 PreparedStatementSQLExceptionpublic void setBinaryStream(int parameterIndex,
InputStream x)
throws SQLException
setBinaryStream 在接口中 PreparedStatementSQLExceptionpublic void setBlob(int parameterIndex,
InputStream inputStream,
long length)
throws SQLException
setBlob 在接口中 PreparedStatementSQLExceptionpublic void setBlob(int parameterIndex,
InputStream inputStream)
throws SQLException
setBlob 在接口中 PreparedStatementSQLExceptionpublic void setCharacterStream(int parameterIndex,
Reader reader,
int length)
throws SQLException
setCharacterStream 在接口中 PreparedStatementSQLExceptionpublic void setCharacterStream(int parameterIndex,
Reader reader)
throws SQLException
setCharacterStream 在接口中 PreparedStatementSQLExceptionpublic void setClob(int parameterIndex,
Reader reader,
long length)
throws SQLException
setClob 在接口中 PreparedStatementSQLExceptionpublic void setClob(int parameterIndex,
Reader reader)
throws SQLException
setClob 在接口中 PreparedStatementSQLExceptionpublic void setNCharacterStream(int parameterIndex,
Reader value,
long length)
throws SQLException
setNCharacterStream 在接口中 PreparedStatementSQLExceptionpublic void setNCharacterStream(int parameterIndex,
Reader value)
throws SQLException
setNCharacterStream 在接口中 PreparedStatementSQLExceptionpublic void setNClob(int parameterIndex,
NClob value)
throws SQLException
setNClob 在接口中 PreparedStatementSQLExceptionpublic void setNClob(int parameterIndex,
Reader reader,
long length)
throws SQLException
setNClob 在接口中 PreparedStatementSQLExceptionpublic void setNClob(int parameterIndex,
Reader reader)
throws SQLException
setNClob 在接口中 PreparedStatementSQLExceptionpublic void setNString(int parameterIndex,
String value)
throws SQLException
setNString 在接口中 PreparedStatementSQLExceptionpublic void setRowId(int parameterIndex,
RowId x)
throws SQLException
setRowId 在接口中 PreparedStatementSQLExceptionpublic void setSQLXML(int parameterIndex,
SQLXML xmlObject)
throws SQLException
setSQLXML 在接口中 PreparedStatementSQLExceptionpublic boolean isWrapperFor(Class arg0) throws SQLException
isWrapperFor 在接口中 WrapperisWrapperFor 在类中 StatementSQLExceptionpublic Object unwrap(Class arg0) throws SQLException
unwrap 在接口中 Wrapperunwrap 在类中 StatementSQLExceptionprotected void setTime_TZ(int parameterIndex,
String time_tz)
throws SQLException
parameterIndex - time_tz - 是4+2 6字节SQLExceptionprotected void setDateTime_TZ(int parameterIndex,
String dtime_tz)
throws SQLException
SQLExceptionprotected void setInterval_Y(int parameterIndex,
String interval_y)
throws SQLException
SQLExceptionprotected void setInterval(int parameterIndex,
short redhorseType,
Object intervalObj)
throws SQLException
SQLExceptionprotected void setInterval_M(int parameterIndex,
String interval_m)
throws SQLException
SQLExceptionprotected void setInterval_D(int parameterIndex,
String interval_d)
throws SQLException
SQLExceptionprotected void setInterval_H(int parameterIndex,
String interval_h)
throws SQLException
SQLExceptionprotected void setInterval_MI(int parameterIndex,
String interval_mi)
throws SQLException
SQLExceptionprotected void setInterval_S(int parameterIndex,
String interval_s)
throws SQLException
SQLExceptionprotected void setInterval_Y2M(int parameterIndex,
String interval_y2m)
throws SQLException
SQLExceptionprotected void setInterval_D2M(int parameterIndex,
String interval_d2m)
throws SQLException
SQLExceptionprotected void setInterval_D2H(int parameterIndex,
String interval_d2h)
throws SQLException
SQLExceptionprotected void setInterval_D2S(int parameterIndex,
String interval_d2s)
throws SQLException
SQLExceptionprotected void setInterval_H2M(int parameterIndex,
String interval_h2m)
throws SQLException
SQLExceptionprotected void setInterval_H2S(int parameterIndex,
String interval_h2s)
throws SQLException
SQLExceptionprotected void setInterval_M2S(int parameterIndex,
String interval_m2s)
throws SQLException
SQLExceptionprotected short getParamType(ParamList param, int idx, int methode)
public void clearBatch()
throws SQLException
StatementStatement object's current list of
SQL commands.
NOTE: This method is optional.
clearBatch 在接口中 StatementclearBatch 在类中 StatementSQLException - if a database access error occurs or the
driver does not support batch updatesStatement.addBatch(java.lang.String)protected byte[] get0x0Bytes()
protected short getSetRedHorseTypeFromJavaType(int sqlType)
Copyright © 2025. All rights reserved.