java.sql.PreparedStatement
java.sql.PreparedStatement是预处理语句接口,本节将介绍对此接口的支持情况。
该接口中的方法都不是线程安全的。
返回值类型 |
方法名 |
---|---|
void |
setTimestamp(int, Timestamp, Calendar) |
void |
setTimestamp(int, Timestamp) |
boolean |
execute() |
void |
setBoolean(int, boolean) |
void |
setByte(int, byte) |
void |
setDouble(int, double) |
void |
setFloat(int, float) |
void |
setInt(int, int) |
void |
setLong(int, long) |
void |
setShort(int, short) |
void |
setTime(int, Time, Calendar) |
void |
setTime(int, Time) |
void |
addBatch() |
void |
clearParameters() |
ResultSet |
executeQuery() |
int |
executeUpdate() |
ResultSetMetaData |
getMetaData() |
void |
setBigDecimal(int, BigDecimal) |
void |
setBinaryStream(int, InputStream) |
void |
setBinaryStream(int, InputStream, int) |
void |
setBinaryStream(int, InputStream, long) |
void |
setBlob(int, InputStream) |
void |
setBlob(int, InputStream, long) |
void |
setBlob(int, Blob) |
void |
setBytes(int, byte[]) |
void |
setCharacterStream(int, Reader, long) |
void |
setCharacterStream(int, Reader, int) |
void |
setCharacterStream(int, Reader) |
void |
setClob(int, Reader) |
void |
setClob(int, Reader, long) |
void |
setClob(int, Clob) |
void |
setDate(int, Date) |
void |
setDate(int, Date, Calendar) |
void |
setNull(int, int) |
void |
setObject(int, Object) |
void |
setObject(int, Object, int) |
void |
setObject(int, Object, int, int) |
void |
setString(int, String) |
boolean |
execute(String, int) |
boolean |
execute(String) |
boolean |
isClosed() |
ResultSet |
executeQuery(String) |
int |
executeUpdate(String, int) |
int |
executeUpdate(String) |
void |
cancel() |
void |
clearBatch() |
void |
clearWarnings() |
int[] |
executeBatch() |
int |
getFetchSize() |
ResultSet |
getGeneratedKeys() |
int |
getMaxRows() |
boolean |
getMoreResults(int) |
boolean |
getMoreResults() |
int |
getQueryTimeout() |
ResultSet |
getResultSet() |
int |
getUpdateCount() |
SQLWarning |
getWarnings() |
void |
setFetchSize(int) |
void |
setMaxRows(int) |
void |
setQueryTimeout(int) |
Connection |
getConnection() |
boolean |
execute(String, int[]) |
boolean |
execute(String, String[]) |
int |
executeUpdate(String, String[]) |
int |
executeUpdate(String, int[]) |
int |
getFetchDirection() |
int |
getResultSetConcurrency() |
int |
getResultSetHoldability() |
int |
getResultSetType() |
void |
setFetchDirection(int) |
- addBatch()、execute()必须在clearBatch()之后才能执行。
- 调用executeBatch()方法并不会清除batch。用户必须显式使用clearBatch()清除 。
- 在添加了一个batch的绑定变量后,用户若想重用这些值(再次添加一个batch),无需再次使用set*()方法 。
- 以下方法是从java.sql.Statement继承而来:close、execute、executeQuery、executeUpdate、getConnection、getResultSet、getUpdateCount、isClosed、setMaxRows。