public class PgStatement extends Object implements BaseStatement
| Modifier and Type | Class and Description |
|---|---|
class |
PgStatement.StatementResultHandler
ResultHandler implementations for updates, queries, and either-or.
|
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
adjustIndex
used to differentiate between new function call
logic and old function call logic
will be set to true if the server is < 8.1 or
if we are using v2 protocol
There is an exception to this where we are using v3, and the
call does not have an out parameter before the call
|
protected ArrayList<ParameterList> |
batchParameters |
protected ArrayList<Query> |
batchStatements |
protected Object[] |
callResult |
protected int |
concurrency |
protected BaseConnection |
connection |
protected int |
fetchdirection |
protected int |
fetchSize
Number of rows to get in a batch.
|
protected ResultWrapper |
firstUnclosedResult
The first unclosed result.
|
protected ResultWrapper |
generatedKeys
Results returned by a statement that wants generated keys.
|
protected boolean |
isClosed |
protected Query |
lastSimpleQuery |
protected SQLWarning |
lastWarning
The last warning of the warning chain.
|
protected int |
m_prepareThreshold |
protected int |
maxfieldSize |
protected int |
maxrows
Maximum number of rows to return, 0 = unlimited
|
protected boolean |
outParmBeforeFunc |
protected ParameterList |
preparedParameters |
protected CachedQuery |
preparedQuery |
protected boolean |
replaceProcessingEnabled |
protected ResultWrapper |
result
The current results.
|
protected int |
resultsettype |
protected int |
timeout
Timeout (in milliseconds) for a query
|
boolean |
wantsGeneratedKeysAlways
Was this PreparedStatement created to return generated keys for every
execution?
|
protected boolean |
wantsGeneratedKeysOnce
Does the caller of execute/executeUpdate want generated keys for this
execution?
|
protected SQLWarning |
warnings
The warnings chain.
|
DATE_NEGATIVE_INFINITY, DATE_NEGATIVE_SMALLER_INFINITY, DATE_POSITIVE_INFINITY, DATE_POSITIVE_SMALLER_INFINITYCLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO| Modifier and Type | Method and Description |
|---|---|
void |
addBatch() |
void |
addBatch(String p_sql)
Adds the given SQL command to the current list of commmands for this
Statement object. |
void |
addWarning(SQLWarning warn)
This adds a warning to the warning chain.
|
protected void |
bindBytes(int paramIndex,
byte[] b,
int oid) |
protected void |
bindLiteral(int paramIndex,
String s,
int oid)
Note if s is a String it should be escaped by the caller to avoid SQL
injection attacks.
|
void |
cancel()
Cancels this
Statement object if both the DBMS and
driver support aborting an SQL statement. |
protected void |
checkClosed() |
protected void |
checkCompletion() |
protected void |
checkIndex(int parameterIndex,
int type1,
int type2,
String getName)
helperfunction for the getXXX calls to check isFunction and index == 1
Compare BOTH type fields against the return type.
|
protected void |
checkIndex(int parameterIndex,
int type,
String getName)
helperfunction for the getXXX calls to check isFunction and index == 1
|
void |
clearBatch()
Empties this
Statement object's current list of
SQL commands. |
void |
clearParameters() |
void |
clearWarnings()
Clears all the warnings reported on this
Statement
object. |
void |
close()
Note: even though
Statement is automatically closed when it is
garbage collected, it is better to close it explicitly to lower resource consumption. |
protected void |
closeForNextExecution() |
void |
closeOnCompletion()
Specifies that this
Statement will be closed when all its
dependent result sets are closed. |
protected long |
createBlob(int i,
InputStream inputStream,
long length) |
ResultSet |
createDriverResultSet(Field[] fields,
List tuples)
Create a synthetic resultset from data provided by the driver.
|
ParameterMetaData |
createParameterMetaData(BaseConnection conn,
int[] oids) |
ResultSet |
createResultSet(Query originalQuery,
Field[] fields,
List tuples,
ResultCursor cursor)
Create a resultset from data retrieved from the server.
|
protected static String |
escapeFunction(String functionName,
String args,
boolean stdStrings)
generate sql for escaped functions
|
boolean |
execute() |
protected void |
execute(Query queryToExecute,
ParameterList queryParameters,
int flags) |
boolean |
execute(String p_sql)
Executes the given SQL statement, which may return multiple results.
|
boolean |
execute(String sql,
int autoGeneratedKeys)
Executes the given SQL statement, which may return multiple results,
and signals the driver that any
auto-generated keys should be made available
for retrieval.
|
boolean |
execute(String sql,
int[] columnIndexes)
Executes the given SQL statement, which may return multiple results,
and signals the driver that the
auto-generated keys indicated in the given array should be made available
for retrieval.
|
boolean |
execute(String sql,
String[] columnNames)
Executes the given SQL statement, which may return multiple results,
and signals the driver that the
auto-generated keys indicated in the given array should be made available
for retrieval.
|
int[] |
executeBatch()
Submits a batch of commands to the database for execution and
if all commands execute successfully, returns an array of update counts.
|
long[] |
executeLargeBatch() |
long |
executeLargeUpdate() |
long |
executeLargeUpdate(String sql) |
long |
executeLargeUpdate(String sql,
int autoGeneratedKeys) |
long |
executeLargeUpdate(String sql,
int[] columnIndexes) |
long |
executeLargeUpdate(String sql,
String[] columnNames) |
ResultSet |
executeQuery() |
ResultSet |
executeQuery(String p_sql)
Executes the given SQL statement, which returns a single
ResultSet object. |
int |
executeUpdate() |
int |
executeUpdate(String p_sql)
Executes the given SQL statement, which may be an
INSERT,
UPDATE, or DELETE statement or an
SQL statement that returns nothing, such as an SQL DDL statement. |
int |
executeUpdate(String sql,
int autoGeneratedKeys)
Executes the given SQL statement and signals the driver with the
given flag about whether the
auto-generated keys produced by this
Statement object
should be made available for retrieval. |
int |
executeUpdate(String sql,
int[] columnIndexes)
Executes the given SQL statement and signals the driver that the
auto-generated keys indicated in the given array should be made available
for retrieval.
|
int |
executeUpdate(String sql,
String[] columnNames)
Executes the given SQL statement and signals the driver that the
auto-generated keys indicated in the given array should be made available
for retrieval.
|
boolean |
executeWithFlags(int flags)
Execute a prepared query, passing additional query flags.
|
boolean |
executeWithFlags(String p_sql,
int flags)
Execute a query, passing additional query flags.
|
Array |
getArray(int i) |
Array |
getArray(String parameterName) |
BigDecimal |
getBigDecimal(int parameterIndex) |
BigDecimal |
getBigDecimal(int parameterIndex,
int scale) |
BigDecimal |
getBigDecimal(String parameterName) |
Blob |
getBlob(int i) |
Blob |
getBlob(String parameterName) |
boolean |
getBoolean(int parameterIndex) |
boolean |
getBoolean(String parameterName) |
byte |
getByte(int parameterIndex) |
byte |
getByte(String parameterName) |
byte[] |
getBytes(int parameterIndex) |
byte[] |
getBytes(String parameterName) |
Reader |
getCharacterStream(int parameterIndex) |
Reader |
getCharacterStream(String parameterName) |
Clob |
getClob(int i) |
Clob |
getClob(String parameterName) |
Connection |
getConnection()
Retrieves the
Connection object
that produced this Statement object. |
Date |
getDate(int parameterIndex) |
Date |
getDate(int i,
Calendar cal) |
Date |
getDate(String parameterName) |
Date |
getDate(String parameterName,
Calendar cal) |
double |
getDouble(int parameterIndex) |
double |
getDouble(String parameterName) |
int |
getFetchDirection()
Retrieves the direction for fetching rows from
database tables that is the default for result sets
generated from this
Statement object. |
String |
getFetchingCursorName() |
int |
getFetchSize()
Retrieves the number of result set rows that is the default
fetch size for
ResultSet objects
generated from this Statement object. |
float |
getFloat(int parameterIndex) |
float |
getFloat(String parameterName) |
protected boolean |
getForceBinaryTransfer() |
ResultSet |
getGeneratedKeys()
Retrieves any auto-generated keys created as a result of executing this
Statement object. |
int |
getInt(int parameterIndex) |
int |
getInt(String parameterName) |
long |
getLargeMaxRows() |
long |
getLargeUpdateCount() |
long |
getLastOID()
Returns the Last inserted/updated oid.
|
long |
getLong(int parameterIndex) |
long |
getLong(String parameterName) |
int |
getMaxFieldSize()
Retrieves the maximum number of bytes that can be
returned for character and binary column values in a
ResultSet
object produced by this Statement object. |
int |
getMaxRows()
Retrieves the maximum number of rows that a
ResultSet object produced by this
Statement object can contain. |
ResultSetMetaData |
getMetaData() |
boolean |
getMoreResults()
Moves to this
Statement object's next result, returns
true if it is a ResultSet object, and
implicitly closes any current ResultSet
object(s) obtained with the method getResultSet. |
boolean |
getMoreResults(int current)
Moves to this
Statement object's next result, deals with
any current ResultSet object(s) according to the instructions
specified by the given flag, and returns
true if the next result is a ResultSet object. |
Reader |
getNCharacterStream(int parameterIndex) |
Reader |
getNCharacterStream(String parameterName) |
NClob |
getNClob(int parameterIndex) |
NClob |
getNClob(String parameterName) |
String |
getNString(int parameterIndex) |
String |
getNString(String parameterName) |
Object |
getObject(int parameterIndex) |
<T> T |
getObject(int parameterIndex,
Class<T> type) |
Object |
getObject(String parameterName) |
<T> T |
getObject(String parameterName,
Class<T> type) |
Object |
getObjectImpl(int i,
Map map) |
Object |
getObjectImpl(String parameterName,
Map map) |
ParameterMetaData |
getParameterMetaData() |
Logger |
getParentLogger() |
BaseConnection |
getPGConnection() |
int |
getPrepareThreshold()
Gets the server-side prepare reuse threshold in use for this statement.
|
int |
getQueryTimeout()
Retrieves the number of seconds the driver will
wait for a
Statement object to execute. |
int |
getQueryTimeoutMs()
The queryTimeout limit is the number of milliseconds the driver
will wait for a Statement to execute.
|
Ref |
getRef(int i) |
Ref |
getRef(String parameterName) |
ResultSet |
getResultSet()
Retrieves the current result as a
ResultSet object. |
int |
getResultSetConcurrency()
Retrieves the result set concurrency for
ResultSet objects
generated by this Statement object. |
int |
getResultSetHoldability()
Retrieves the result set holdability for
ResultSet objects
generated by this Statement object. |
int |
getResultSetType()
Retrieves the result set type for
ResultSet objects
generated by this Statement object. |
RowId |
getRowId(int parameterIndex) |
RowId |
getRowId(String parameterName) |
short |
getShort(int parameterIndex) |
short |
getShort(String parameterName) |
SQLXML |
getSQLXML(int parameterIndex) |
SQLXML |
getSQLXML(String parameterIndex) |
String |
getString(int parameterIndex) |
String |
getString(String parameterName) |
Time |
getTime(int parameterIndex) |
Time |
getTime(int i,
Calendar cal) |
Time |
getTime(String parameterName) |
Time |
getTime(String parameterName,
Calendar cal) |
Timestamp |
getTimestamp(int parameterIndex) |
Timestamp |
getTimestamp(int i,
Calendar cal) |
Timestamp |
getTimestamp(String parameterName) |
Timestamp |
getTimestamp(String parameterName,
Calendar cal) |
int |
getUpdateCount()
Retrieves the current result as an update count;
if the result is a
ResultSet object or there are no more results, -1
is returned. |
URL |
getURL(int parameterIndex) |
URL |
getURL(String parameterName) |
SQLWarning |
getWarnings()
Retrieves the first warning reported by calls on this
Statement object. |
boolean |
isClosed()
Retrieves whether this
Statement object has been closed. |
boolean |
isCloseOnCompletion()
Returns a value indicating whether this
Statement will be
closed when all its dependent result sets are closed. |
boolean |
isPoolable()
Returns a value indicating whether the
Statement
is poolable or not. |
boolean |
isUseServerPrepare()
Checks if this statement will be executed as a server-prepared
statement.
|
boolean |
isWrapperFor(Class<?> iface)
Returns true if this either implements the interface argument or is directly or indirectly a wrapper
for an object that does.
|
protected static int |
parseSql(String p_sql,
int i,
StringBuilder newsql,
boolean stopOnComma,
boolean stdStrings)
parse the given sql from index i, appending it to the gven buffer
until we hit an unmatched right parentheses or end of string.
|
void |
registerOutParameter(int parameterIndex,
int sqlType) |
void |
registerOutParameter(int parameterIndex,
int sqlType,
boolean setPreparedParameters)
Before executing a stored procedure call you must explicitly
call registerOutParameter to register the java.sql.Type of each
out parameter.
|
void |
registerOutParameter(int parameterIndex,
int sqlType,
int scale) |
void |
registerOutParameter(int parameterIndex,
int sqlType,
int scale,
boolean setPreparedParameters)
You must also specify the scale for numeric/decimal types:
Note: When reading the value of an out parameter, you must use
the getXXX method whose Java type XXX corresponds to the
parameter's registered SQL type.
|
void |
registerOutParameter(int parameterIndex,
int sqlType,
String typeName) |
void |
registerOutParameter(String parameterName,
int sqlType) |
void |
registerOutParameter(String parameterName,
int sqlType,
int scale) |
void |
registerOutParameter(String parameterName,
int sqlType,
String typeName) |
void |
setArray(int i,
Array x) |
void |
setAsciiStream(int parameterIndex,
InputStream value) |
void |
setAsciiStream(int parameterIndex,
InputStream x,
int length) |
void |
setAsciiStream(int parameterIndex,
InputStream value,
long length) |
void |
setAsciiStream(String parameterName,
InputStream value) |
void |
setAsciiStream(String parameterName,
InputStream x,
int length) |
void |
setAsciiStream(String parameterName,
InputStream value,
long length) |
void |
setBigDecimal(int parameterIndex,
BigDecimal x) |
void |
setBigDecimal(String parameterName,
BigDecimal x) |
void |
setBinaryStream(int parameterIndex,
InputStream value) |
void |
setBinaryStream(int parameterIndex,
InputStream x,
int length) |
void |
setBinaryStream(int parameterIndex,
InputStream value,
long length) |
void |
setBinaryStream(String parameterName,
InputStream value) |
void |
setBinaryStream(String parameterName,
InputStream x,
int length) |
void |
setBinaryStream(String parameterName,
InputStream value,
long length) |
void |
setBlob(int i,
Blob x) |
void |
setBlob(int parameterIndex,
InputStream inputStream) |
void |
setBlob(int parameterIndex,
InputStream inputStream,
long length) |
void |
setBlob(String parameterName,
Blob x) |
void |
setBlob(String parameterName,
InputStream inputStream) |
void |
setBlob(String parameterName,
InputStream inputStream,
long length) |
void |
setBoolean(int parameterIndex,
boolean x) |
void |
setBoolean(String parameterName,
boolean x) |
void |
setByte(int parameterIndex,
byte x) |
void |
setByte(String parameterName,
byte x) |
void |
setBytes(int parameterIndex,
byte[] x) |
void |
setBytes(String parameterName,
byte[] x) |
void |
setCharacterStream(int parameterIndex,
Reader value) |
void |
setCharacterStream(int i,
Reader x,
int length) |
void |
setCharacterStream(int parameterIndex,
Reader value,
long length) |
void |
setCharacterStream(String parameterName,
Reader value) |
void |
setCharacterStream(String parameterName,
Reader reader,
int length) |
void |
setCharacterStream(String parameterName,
Reader value,
long length) |
void |
setClob(int i,
Clob x) |
void |
setClob(int parameterIndex,
Reader reader) |
void |
setClob(int parameterIndex,
Reader reader,
long length) |
void |
setClob(String parameterName,
Clob x) |
void |
setClob(String parameterName,
Reader reader) |
void |
setClob(String parameterName,
Reader reader,
long length) |
void |
setCursorName(String name)
Sets the SQL cursor name to the given
String, which
will be used by subsequent Statement object
execute methods. |
void |
setDate(int parameterIndex,
Date x) |
void |
setDate(int i,
Date d,
Calendar cal) |
void |
setDate(String parameterName,
Date x) |
void |
setDate(String parameterName,
Date x,
Calendar cal) |
void |
setDouble(int parameterIndex,
double x) |
void |
setDouble(String parameterName,
double x) |
void |
setEscapeProcessing(boolean enable)
Sets escape processing on or off.
|
void |
setFetchDirection(int direction)
Gives the driver a hint as to the direction in which
rows will be processed in
ResultSet
objects created using this Statement object. |
void |
setFetchSize(int rows)
Gives the JDBC driver a hint as to the number of rows that should
be fetched from the database when more rows are needed for
ResultSet objects genrated by this Statement. |
void |
setFloat(int parameterIndex,
float x) |
void |
setFloat(String parameterName,
float x) |
void |
setInt(int parameterIndex,
int x) |
void |
setInt(String parameterName,
int x) |
void |
setLargeMaxRows(long max) |
void |
setLong(int parameterIndex,
long x) |
void |
setLong(String parameterName,
long x) |
void |
setMaxFieldSize(int max)
Sets the limit for the maximum number of bytes that can be returned for
character and binary column values in a
ResultSet
object produced by this Statement object. |
void |
setMaxRows(int max)
Sets the limit for the maximum number of rows that any
ResultSet object generated by this Statement
object can contain to the given number. |
void |
setNCharacterStream(int parameterIndex,
Reader value) |
void |
setNCharacterStream(int parameterIndex,
Reader value,
long length) |
void |
setNCharacterStream(String parameterName,
Reader value) |
void |
setNCharacterStream(String parameterName,
Reader value,
long length) |
void |
setNClob(int parameterIndex,
NClob value) |
void |
setNClob(int parameterIndex,
Reader reader) |
void |
setNClob(int parameterIndex,
Reader reader,
long length) |
void |
setNClob(String parameterName,
NClob value) |
void |
setNClob(String parameterName,
Reader reader) |
void |
setNClob(String parameterName,
Reader reader,
long length) |
void |
setNString(int parameterIndex,
String value) |
void |
setNString(String parameterName,
String value) |
void |
setNull(int parameterIndex,
int sqlType) |
void |
setNull(int i,
int t,
String s) |
void |
setNull(String parameterName,
int sqlType) |
void |
setNull(String parameterName,
int sqlType,
String typeName) |
void |
setObject(int parameterIndex,
Object x) |
void |
setObject(int parameterIndex,
Object x,
int targetSqlType) |
void |
setObject(int parameterIndex,
Object in,
int targetSqlType,
int scale) |
void |
setObject(String parameterName,
Object x) |
void |
setObject(String parameterName,
Object x,
int targetSqlType) |
void |
setObject(String parameterName,
Object x,
int targetSqlType,
int scale) |
void |
setPoolable(boolean poolable)
Requests that a
Statement be pooled or not pooled. |
void |
setPrepareThreshold(int newThreshold)
Sets the reuse threshold for using server-prepared statements.
|
void |
setQueryTimeout(int seconds)
Sets the number of seconds the driver will wait for a
Statement object to execute to the given number of seconds. |
void |
setQueryTimeoutMs(int millis)
Sets the queryTimeout limit
|
void |
setRef(int i,
Ref x) |
void |
setRowId(int parameterIndex,
RowId x) |
void |
setRowId(String parameterName,
RowId x) |
void |
setShort(int parameterIndex,
short x) |
void |
setShort(String parameterName,
short x) |
void |
setSQLXML(int parameterIndex,
SQLXML xmlObject) |
void |
setSQLXML(String parameterName,
SQLXML xmlObject) |
void |
setString(int parameterIndex,
String x) |
protected void |
setString(int parameterIndex,
String x,
int oid) |
void |
setString(String parameterName,
String x) |
void |
setTime(int parameterIndex,
Time x) |
void |
setTime(int i,
Time t,
Calendar cal) |
void |
setTime(String parameterName,
Time x) |
void |
setTime(String parameterName,
Time x,
Calendar cal) |
void |
setTimestamp(int parameterIndex,
Timestamp x) |
void |
setTimestamp(int i,
Timestamp t,
Calendar cal) |
void |
setTimestamp(String parameterName,
Timestamp x) |
void |
setTimestamp(String parameterName,
Timestamp x,
Calendar cal) |
void |
setUnicodeStream(int parameterIndex,
InputStream x,
int length) |
void |
setURL(int parameterIndex,
URL x) |
void |
setURL(String parameterName,
URL val) |
void |
setUseServerPrepare(boolean flag)
Turn on the use of prepared statements in the server (server side
prepared statements are unrelated to jdbc PreparedStatements)
As of build 302, this method is equivalent to
setPrepareThreshold(1). |
String |
toString()
Returns the SQL statement with the current template values
substituted.
|
<T> T |
unwrap(Class<T> iface)
Returns an object that implements the given interface to allow access to
non-standard methods, or standard methods not exposed by the proxy.
|
protected boolean |
wantsHoldableResultSet() |
protected boolean |
wantsScrollableResultSet() |
boolean |
wasNull() |
protected ArrayList<ParameterList> batchParameters
protected final int resultsettype
protected final int concurrency
protected int fetchdirection
protected boolean wantsGeneratedKeysOnce
public boolean wantsGeneratedKeysAlways
protected final BaseConnection connection
protected SQLWarning warnings
protected SQLWarning lastWarning
protected int maxrows
protected int fetchSize
protected int timeout
protected boolean replaceProcessingEnabled
protected ResultWrapper result
protected ResultWrapper firstUnclosedResult
protected ResultWrapper generatedKeys
protected boolean adjustIndex
protected boolean outParmBeforeFunc
protected final CachedQuery preparedQuery
protected final ParameterList preparedParameters
protected Query lastSimpleQuery
protected int m_prepareThreshold
protected Object[] callResult
protected int maxfieldSize
protected boolean isClosed
public ResultSet createResultSet(Query originalQuery, Field[] fields, List tuples, ResultCursor cursor) throws SQLException
BaseStatementcreateResultSet in interface BaseStatementoriginalQuery - the query that generated this resultset; used when dealing with updateable resultsetsfields - the column metadata for the resultsettuples - the resultset datacursor - the cursor to use to retrieve more data from the server; if null, no additional data is present.SQLException - if something goes wrongpublic BaseConnection getPGConnection()
public String getFetchingCursorName()
public int getFetchSize()
java.sql.StatementResultSet objects
generated from this Statement object.
If this Statement object has not set
a fetch size by calling the method setFetchSize,
the return value is implementation-specific.getFetchSize in interface StatementStatement objectStatement.setFetchSize(int)protected boolean wantsScrollableResultSet()
protected boolean wantsHoldableResultSet()
public ResultSet executeQuery(String p_sql) throws SQLException
java.sql.StatementResultSet object.
Note:This method cannot be called on a
PreparedStatement or CallableStatement.
executeQuery in interface Statementp_sql - an SQL statement to be sent to the database, typically a
static SQL SELECT statementResultSet object that contains the data produced
by the given query; never nullSQLException - if a database access error occurs,
this method is called on a closed Statement, the given
SQL statement produces anything other than a single
ResultSet object, the method is called on a
PreparedStatement or CallableStatementpublic ResultSet executeQuery() throws SQLException
SQLExceptionpublic int executeUpdate(String p_sql) throws SQLException
java.sql.StatementINSERT,
UPDATE, or DELETE statement or an
SQL statement that returns nothing, such as an SQL DDL statement.
Note:This method cannot be called on a
PreparedStatement or CallableStatement.
executeUpdate in interface Statementp_sql - an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or
DELETE; or an SQL statement that returns nothing,
such as a DDL statement.SQLException - if a database access error occurs,
this method is called on a closed Statement, the given
SQL statement produces a ResultSet object, the method is called on a
PreparedStatement or CallableStatementpublic int executeUpdate()
throws SQLException
SQLExceptionpublic boolean execute(String p_sql) throws SQLException
java.sql.Statement
The execute method executes an SQL statement and indicates the
form of the first result. You must then use the methods
getResultSet or getUpdateCount
to retrieve the result, and getMoreResults to
move to any subsequent result(s).
Note:This method cannot be called on a
PreparedStatement or CallableStatement.
execute in interface Statementp_sql - any SQL statementtrue if the first result is a ResultSet
object; false if it is an update count or there are
no resultsSQLException - if a database access error occurs,
this method is called on a closed Statement,
the method is called on a
PreparedStatement or CallableStatementStatement.getResultSet(),
Statement.getUpdateCount(),
Statement.getMoreResults()public boolean executeWithFlags(String p_sql, int flags) throws SQLException
BaseStatementexecuteWithFlags in interface BaseStatementp_sql - the query to executeflags - additional QueryExecutor flags for execution; these
are bitwise-ORed into the default flags.SQLException - if something goes wrong.public boolean execute()
throws SQLException
SQLExceptionpublic boolean executeWithFlags(int flags)
throws SQLException
BaseStatementexecuteWithFlags in interface BaseStatementflags - additional QueryExecutor flags for execution; these
are bitwise-ORed into the default flags.SQLException - if something goes wrong.protected void closeForNextExecution()
throws SQLException
SQLExceptionprotected void execute(Query queryToExecute, ParameterList queryParameters, int flags) throws SQLException
SQLExceptionpublic void setCursorName(String name) throws SQLException
java.sql.StatementString, which
will be used by subsequent Statement object
execute methods. This name can then be
used in SQL positioned update or delete statements to identify the
current row in the ResultSet object generated by this
statement. If the database does not support positioned update/delete,
this method is a noop. To insure that a cursor has the proper isolation
level to support updates, the cursor's SELECT statement
should have the form SELECT FOR UPDATE. If
FOR UPDATE is not present, positioned updates may fail.
Note: By definition, the execution of positioned updates and
deletes must be done by a different Statement object than
the one that generated the ResultSet object being used for
positioning. Also, cursor names must be unique within a connection.
setCursorName in interface Statementname - the new cursor name, which must be unique within
a connectionSQLException - if a database access error occurs or
this method is called on a closed StatementSQLFeatureNotSupportedException - if the JDBC driver does not support this methodpublic int getUpdateCount()
throws SQLException
java.sql.StatementResultSet object or there are no more results, -1
is returned. This method should be called only once per result.getUpdateCount in interface StatementResultSet object or there are no more resultsSQLException - if a database access error occurs or
this method is called on a closed StatementStatement.execute(java.lang.String)public boolean getMoreResults()
throws SQLException
java.sql.StatementStatement object's next result, returns
true if it is a ResultSet object, and
implicitly closes any current ResultSet
object(s) obtained with the method getResultSet.
There are no more results when the following is true:
// stmt is a Statement object
((stmt.getMoreResults() == false) && (stmt.getUpdateCount() == -1))
getMoreResults in interface Statementtrue if the next result is a ResultSet
object; false if it is an update count or there are
no more resultsSQLException - if a database access error occurs or
this method is called on a closed StatementStatement.execute(java.lang.String)public int getMaxRows()
throws SQLException
java.sql.StatementResultSet object produced by this
Statement object can contain. If this limit is exceeded,
the excess rows are silently dropped.getMaxRows in interface StatementResultSet
object produced by this Statement object;
zero means there is no limitSQLException - if a database access error occurs or
this method is called on a closed StatementStatement.setMaxRows(int)public void setMaxRows(int max)
throws SQLException
java.sql.StatementResultSet object generated by this Statement
object can contain to the given number.
If the limit is exceeded, the excess
rows are silently dropped.setMaxRows in interface Statementmax - the new max rows limit; zero means there is no limitSQLException - if a database access error occurs,
this method is called on a closed Statement
or the condition max >= 0 is not satisfiedStatement.getMaxRows()public void setEscapeProcessing(boolean enable)
throws SQLException
java.sql.StatementPreparedStatements objects will have no effect.setEscapeProcessing in interface Statementenable - true to enable escape processing;
false to disable itSQLException - if a database access error occurs or
this method is called on a closed Statementpublic int getQueryTimeout()
throws SQLException
java.sql.StatementStatement object to execute.
If the limit is exceeded, a
SQLException is thrown.getQueryTimeout in interface StatementSQLException - if a database access error occurs or
this method is called on a closed StatementStatement.setQueryTimeout(int)public void setQueryTimeout(int seconds)
throws SQLException
java.sql.StatementStatement object to execute to the given number of seconds.
By default there is no limit on the amount of time allowed for a running
statement to complete. If the limit is exceeded, an
SQLTimeoutException is thrown.
A JDBC driver must apply this limit to the execute,
executeQuery and executeUpdate methods.
Note: JDBC driver implementations may also apply this
limit to ResultSet methods
(consult your driver vendor documentation for details).
Note: In the case of Statement batching, it is
implementation defined as to whether the time-out is applied to
individual SQL commands added via the addBatch method or to
the entire batch of SQL commands invoked by the executeBatch
method (consult your driver vendor documentation for details).
setQueryTimeout in interface Statementseconds - the new query timeout limit in seconds; zero means
there is no limitSQLException - if a database access error occurs,
this method is called on a closed Statement
or the condition seconds >= 0 is not satisfiedStatement.getQueryTimeout()public int getQueryTimeoutMs()
throws SQLException
SQLException - if a database access error occurspublic void setQueryTimeoutMs(int millis)
throws SQLException
millis - - the new query timeout limit in millisecondsSQLException - if a database access error occurspublic void addWarning(SQLWarning warn)
warn - warning to addpublic SQLWarning getWarnings() throws SQLException
java.sql.StatementStatement object.
Subsequent Statement object warnings will be chained to this
SQLWarning object.
The warning chain is automatically cleared each time
a statement is (re)executed. This method may not be called on a closed
Statement object; doing so will cause an SQLException
to be thrown.
Note: If you are processing a ResultSet object, any
warnings associated with reads on that ResultSet object
will be chained on it rather than on the Statement
object that produced it.
getWarnings in interface StatementSQLWarning object or null
if there are no warningsSQLException - if a database access error occurs or
this method is called on a closed Statementpublic int getMaxFieldSize()
throws SQLException
java.sql.StatementResultSet
object produced by this Statement object.
This limit applies only to BINARY, VARBINARY,
LONGVARBINARY, CHAR, VARCHAR,
NCHAR, NVARCHAR, LONGNVARCHAR
and LONGVARCHAR columns. If the limit is exceeded, the
excess data is silently discarded.getMaxFieldSize in interface StatementSQLException - if a database access error occurs or
this method is called on a closed StatementStatement.setMaxFieldSize(int)public void setMaxFieldSize(int max)
throws SQLException
java.sql.StatementResultSet
object produced by this Statement object.
This limit applies
only to BINARY, VARBINARY,
LONGVARBINARY, CHAR, VARCHAR,
NCHAR, NVARCHAR, LONGNVARCHAR and
LONGVARCHAR fields. If the limit is exceeded, the excess data
is silently discarded. For maximum portability, use values
greater than 256.setMaxFieldSize in interface Statementmax - the new column size limit in bytes; zero means there is no limitSQLException - if a database access error occurs,
this method is called on a closed Statement
or the condition max >= 0 is not satisfiedStatement.getMaxFieldSize()public void clearWarnings()
throws SQLException
java.sql.StatementStatement
object. After a call to this method,
the method getWarnings will return
null until a new warning is reported for this
Statement object.clearWarnings in interface StatementSQLException - if a database access error occurs or
this method is called on a closed Statementpublic ResultSet getResultSet() throws SQLException
java.sql.StatementResultSet object.
This method should be called only once per result.getResultSet in interface StatementResultSet object or
null if the result is an update count or there are no more resultsSQLException - if a database access error occurs or
this method is called on a closed StatementStatement.execute(java.lang.String)public void close()
throws SQLException
Statement is automatically closed when it is
garbage collected, it is better to close it explicitly to lower resource consumption.
Releases this Statement 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.
Calling the method close on a Statement
object that is already closed has no effect.
Note:When a Statement object is
closed, its current ResultSet object, if one exists, is
also closed.
close in interface AutoCloseableclose in interface StatementSQLException - if a database access error occursprotected static int parseSql(String p_sql, int i, StringBuilder newsql, boolean stopOnComma, boolean stdStrings) throws SQLException
p_sql - the original query texti - starting position for replacingnewsql - where to write the replaced outputstopOnComma - should we stop after hitting the first comma in sql text?stdStrings - whether standard_conforming_strings is onSQLException - if given SQL is wrongprotected static String escapeFunction(String functionName, String args, boolean stdStrings) throws SQLException
functionName - the escaped function nameargs - the arguments for this functinstdStrings - whether standard_conforming_strings is onSQLException - if something goes wrongpublic long getLastOID()
throws SQLException
PGStatementgetLastOID in interface PGStatementSQLException - if something goes wrongpublic void setNull(int parameterIndex,
int sqlType)
throws SQLException
SQLExceptionpublic void setBoolean(int parameterIndex,
boolean x)
throws SQLException
SQLExceptionpublic void setByte(int parameterIndex,
byte x)
throws SQLException
SQLExceptionpublic void setShort(int parameterIndex,
short x)
throws SQLException
SQLExceptionpublic void setInt(int parameterIndex,
int x)
throws SQLException
SQLExceptionpublic void setLong(int parameterIndex,
long x)
throws SQLException
SQLExceptionpublic void setFloat(int parameterIndex,
float x)
throws SQLException
SQLExceptionpublic void setDouble(int parameterIndex,
double x)
throws SQLException
SQLExceptionpublic void setBigDecimal(int parameterIndex,
BigDecimal x)
throws SQLException
SQLExceptionpublic void setString(int parameterIndex,
String x)
throws SQLException
SQLExceptionprotected void setString(int parameterIndex,
String x,
int oid)
throws SQLException
SQLExceptionpublic void setBytes(int parameterIndex,
byte[] x)
throws SQLException
SQLExceptionpublic void setDate(int parameterIndex,
Date x)
throws SQLException
SQLExceptionpublic void setTime(int parameterIndex,
Time x)
throws SQLException
SQLExceptionpublic void setTimestamp(int parameterIndex,
Timestamp x)
throws SQLException
SQLExceptionpublic void setAsciiStream(int parameterIndex,
InputStream x,
int length)
throws SQLException
SQLExceptionpublic void setUnicodeStream(int parameterIndex,
InputStream x,
int length)
throws SQLException
SQLExceptionpublic void setBinaryStream(int parameterIndex,
InputStream x,
int length)
throws SQLException
SQLExceptionpublic void clearParameters()
throws SQLException
SQLExceptionpublic void setObject(int parameterIndex,
Object in,
int targetSqlType,
int scale)
throws SQLException
SQLExceptionpublic void setObject(int parameterIndex,
Object x,
int targetSqlType)
throws SQLException
SQLExceptionpublic void setObject(int parameterIndex,
Object x)
throws SQLException
SQLExceptionpublic void registerOutParameter(int parameterIndex,
int sqlType,
boolean setPreparedParameters)
throws SQLException
Note: When reading the value of an out parameter, you must use the getXXX method whose Java type XXX corresponds to the parameter's registered SQL type. ONLY 1 RETURN PARAMETER if {?= call ..} syntax is used
parameterIndex - the first parameter is 1, the second is 2,...sqlType - SQL type code defined by java.sql.Types; for
parameters of type Numeric or Decimal use the version of
registerOutParameter that accepts a scale valuesetPreparedParameters - true if preparedParameters.registerOutParameter should be calledSQLException - if a database-access error occurs.public void registerOutParameter(int parameterIndex,
int sqlType,
int scale,
boolean setPreparedParameters)
throws SQLException
Note: When reading the value of an out parameter, you must use the getXXX method whose Java type XXX corresponds to the parameter's registered SQL type.
parameterIndex - the first parameter is 1, the second is 2,...sqlType - use either java.sql.Type.NUMERIC or java.sql.Type.DECIMALscale - a value greater than or equal to zero representing the
desired number of digits to the right of the decimal pointsetPreparedParameters - set prepared parametersSQLException - if a database-access error occurs.public boolean wasNull()
throws SQLException
SQLExceptionpublic String getString(int parameterIndex) throws SQLException
SQLExceptionpublic boolean getBoolean(int parameterIndex)
throws SQLException
SQLExceptionpublic byte getByte(int parameterIndex)
throws SQLException
SQLExceptionpublic short getShort(int parameterIndex)
throws SQLException
SQLExceptionpublic int getInt(int parameterIndex)
throws SQLException
SQLExceptionpublic long getLong(int parameterIndex)
throws SQLException
SQLExceptionpublic float getFloat(int parameterIndex)
throws SQLException
SQLExceptionpublic double getDouble(int parameterIndex)
throws SQLException
SQLExceptionpublic BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException
SQLExceptionpublic byte[] getBytes(int parameterIndex)
throws SQLException
SQLExceptionpublic Date getDate(int parameterIndex) throws SQLException
SQLExceptionpublic Time getTime(int parameterIndex) throws SQLException
SQLExceptionpublic Timestamp getTimestamp(int parameterIndex) throws SQLException
SQLExceptionpublic Object getObject(int parameterIndex) throws SQLException
SQLExceptionpublic String toString()
protected void bindLiteral(int paramIndex,
String s,
int oid)
throws SQLException
Integer.toString())paramIndex - parameter indexs - value (the value should already be escaped)oid - type oidSQLException - if something goes wrongprotected void bindBytes(int paramIndex,
byte[] b,
int oid)
throws SQLException
SQLExceptionprotected void checkIndex(int parameterIndex,
int type1,
int type2,
String getName)
throws SQLException
parameterIndex - parameter index (1-based)type1 - type 1type2 - type 2getName - getter nameSQLException - if something goes wrongprotected void checkIndex(int parameterIndex,
int type,
String getName)
throws SQLException
parameterIndex - parameter index (1-based)type - typegetName - getter nameSQLException - if given index is not validpublic void setPrepareThreshold(int newThreshold)
throws SQLException
PGStatement
If threshold is a non-zero value N, the Nth and subsequent
reuses of a PreparedStatement will use server-side prepare.
If threshold is zero, server-side prepare will not be used.
The reuse threshold is only used by PreparedStatement and CallableStatement objects; it is ignored for plain Statements.
setPrepareThreshold in interface PGStatementnewThreshold - the new threshold for this statementSQLException - if an exception occurs while changing the thresholdpublic int getPrepareThreshold()
PGStatementgetPrepareThreshold in interface PGStatementPGStatement.setPrepareThreshold(int)public void setUseServerPrepare(boolean flag)
throws SQLException
PGStatementsetPrepareThreshold(1).setUseServerPrepare in interface PGStatementflag - use server prepareSQLException - if something goes wrongpublic boolean isUseServerPrepare()
PGStatementtrue indicates that the next
execution of the statement will be done as a server-prepared statement,
assuming the underlying protocol supports it.isUseServerPrepare in interface PGStatementprotected void checkClosed()
throws SQLException
SQLExceptionpublic void addBatch(String p_sql) throws SQLException
java.sql.StatementStatement object. The commands in this list can be
executed as a batch by calling the method executeBatch.
Note:This method cannot be called on a
PreparedStatement or CallableStatement.
addBatch in interface Statementp_sql - typically this is a SQL INSERT or
UPDATE statementSQLException - if a database access error occurs,
this method is called on a closed Statement, the
driver does not support batch updates, the method is called on a
PreparedStatement or CallableStatementStatement.executeBatch(),
DatabaseMetaData.supportsBatchUpdates()public void clearBatch()
throws SQLException
java.sql.StatementStatement object's current list of
SQL commands.
clearBatch in interface StatementSQLException - if a database access error occurs,
this method is called on a closed Statement or the
driver does not support batch updatesStatement.addBatch(java.lang.String),
DatabaseMetaData.supportsBatchUpdates()public int[] executeBatch()
throws SQLException
java.sql.Statementint 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.
The elements in the array returned by the method executeBatch
may be one of the following:
SUCCESS_NO_INFO -- indicates that the command was
processed successfully but that the number of rows affected is
unknown
If one of the commands in a batch update fails to execute properly,
this method throws a BatchUpdateException, and a JDBC
driver may or may not continue to process the remaining commands in
the batch. However, the driver's behavior must be consistent with a
particular DBMS, either always continuing to process commands or never
continuing to process commands. If the driver continues processing
after a failure, the array returned by the method
BatchUpdateException.getUpdateCounts
will contain as many elements as there are commands in the batch, and
at least one of the elements will be the following:
EXECUTE_FAILED -- indicates that the command failed
to execute successfully and occurs only if a driver continues to
process commands after a command fails
The possible implementations and return values have been modified in
the Java 2 SDK, Standard Edition, version 1.3 to
accommodate the option of continuing to proccess commands in a batch
update after a BatchUpdateException obejct has been thrown.
executeBatch in interface StatementSQLException - if a database access error occurs,
this method is called on a closed Statement 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.Statement.addBatch(java.lang.String),
DatabaseMetaData.supportsBatchUpdates()public void cancel()
throws SQLException
java.sql.StatementStatement object if both the DBMS and
driver support aborting an SQL statement.
This method can be used by one thread to cancel a statement that
is being executed by another thread.cancel in interface StatementSQLException - if a database access error occurs or
this method is called on a closed StatementSQLFeatureNotSupportedException - if the JDBC driver does not support
this methodpublic Connection getConnection() throws SQLException
java.sql.StatementConnection object
that produced this Statement object.getConnection in interface StatementSQLException - if a database access error occurs or
this method is called on a closed Statementpublic int getFetchDirection()
java.sql.StatementStatement object.
If this Statement object has not set
a fetch direction by calling the method setFetchDirection,
the return value is implementation-specific.getFetchDirection in interface StatementStatement objectStatement.setFetchDirection(int)public int getResultSetConcurrency()
java.sql.StatementResultSet objects
generated by this Statement object.getResultSetConcurrency in interface StatementResultSet.CONCUR_READ_ONLY or
ResultSet.CONCUR_UPDATABLEpublic int getResultSetType()
java.sql.StatementResultSet objects
generated by this Statement object.getResultSetType in interface StatementResultSet.TYPE_FORWARD_ONLY,
ResultSet.TYPE_SCROLL_INSENSITIVE, or
ResultSet.TYPE_SCROLL_SENSITIVEpublic void setFetchDirection(int direction)
throws SQLException
java.sql.StatementResultSet
objects created using this Statement object. The
default value is ResultSet.FETCH_FORWARD.
Note that this method sets the default fetch direction for
result sets generated by this Statement object.
Each result set has its own methods for getting and setting
its own fetch direction.
setFetchDirection in interface Statementdirection - the initial direction for processing rowsSQLException - if a database access error occurs,
this method is called on a closed Statement
or the given direction
is not one of ResultSet.FETCH_FORWARD,
ResultSet.FETCH_REVERSE, or ResultSet.FETCH_UNKNOWNStatement.getFetchDirection()public void setFetchSize(int rows)
throws SQLException
java.sql.StatementResultSet objects genrated by this Statement.
If the value specified is zero, then the hint is ignored.
The default value is zero.setFetchSize in interface Statementrows - the number of rows to fetchSQLException - if a database access error occurs,
this method is called on a closed Statement or the
condition rows >= 0 is not satisfied.Statement.getFetchSize()public void addBatch()
throws SQLException
SQLExceptionpublic ResultSetMetaData getMetaData() throws SQLException
SQLExceptionpublic void setArray(int i,
Array x)
throws SQLException
SQLExceptionprotected long createBlob(int i,
InputStream inputStream,
long length)
throws SQLException
SQLExceptionpublic void setBlob(int i,
Blob x)
throws SQLException
SQLExceptionpublic void setCharacterStream(int i,
Reader x,
int length)
throws SQLException
SQLExceptionpublic void setClob(int i,
Clob x)
throws SQLException
SQLExceptionpublic void setNull(int i,
int t,
String s)
throws SQLException
SQLExceptionpublic void setRef(int i,
Ref x)
throws SQLException
SQLExceptionpublic void setDate(int i,
Date d,
Calendar cal)
throws SQLException
SQLExceptionpublic void setTime(int i,
Time t,
Calendar cal)
throws SQLException
SQLExceptionpublic void setTimestamp(int i,
Timestamp t,
Calendar cal)
throws SQLException
SQLExceptionpublic Array getArray(int i) throws SQLException
SQLExceptionpublic BigDecimal getBigDecimal(int parameterIndex) throws SQLException
SQLExceptionpublic Blob getBlob(int i) throws SQLException
SQLExceptionpublic Clob getClob(int i) throws SQLException
SQLExceptionpublic Object getObjectImpl(int i, Map map) throws SQLException
SQLExceptionpublic Ref getRef(int i) throws SQLException
SQLExceptionpublic Date getDate(int i, Calendar cal) throws SQLException
SQLExceptionpublic Time getTime(int i, Calendar cal) throws SQLException
SQLExceptionpublic Timestamp getTimestamp(int i, Calendar cal) throws SQLException
SQLExceptionpublic void registerOutParameter(int parameterIndex,
int sqlType,
String typeName)
throws SQLException
SQLExceptionprotected boolean getForceBinaryTransfer()
public ParameterMetaData createParameterMetaData(BaseConnection conn, int[] oids) throws SQLException
SQLExceptionpublic long getLargeUpdateCount()
throws SQLException
SQLExceptionpublic void setLargeMaxRows(long max)
throws SQLException
SQLExceptionpublic long getLargeMaxRows()
throws SQLException
SQLExceptionpublic long[] executeLargeBatch()
throws SQLException
SQLExceptionpublic long executeLargeUpdate(String sql) throws SQLException
SQLExceptionpublic long executeLargeUpdate(String sql, int autoGeneratedKeys) throws SQLException
SQLExceptionpublic long executeLargeUpdate(String sql, int[] columnIndexes) throws SQLException
SQLExceptionpublic long executeLargeUpdate(String sql, String[] columnNames) throws SQLException
SQLExceptionpublic long executeLargeUpdate()
throws SQLException
SQLExceptionpublic boolean isClosed()
throws SQLException
java.sql.StatementStatement object has been closed. A Statement is closed if the
method close has been called on it, or if it is automatically closed.isClosed in interface StatementStatement object is closed; false if it is still openSQLException - if a database access error occurspublic void setRowId(int parameterIndex,
RowId x)
throws SQLException
SQLExceptionpublic void setNString(int parameterIndex,
String value)
throws SQLException
SQLExceptionpublic void setNCharacterStream(int parameterIndex,
Reader value,
long length)
throws SQLException
SQLExceptionpublic void setNCharacterStream(int parameterIndex,
Reader value)
throws SQLException
SQLExceptionpublic void setCharacterStream(int parameterIndex,
Reader value,
long length)
throws SQLException
SQLExceptionpublic void setCharacterStream(int parameterIndex,
Reader value)
throws SQLException
SQLExceptionpublic void setBinaryStream(int parameterIndex,
InputStream value,
long length)
throws SQLException
SQLExceptionpublic void setBinaryStream(int parameterIndex,
InputStream value)
throws SQLException
SQLExceptionpublic void setAsciiStream(int parameterIndex,
InputStream value,
long length)
throws SQLException
SQLExceptionpublic void setAsciiStream(int parameterIndex,
InputStream value)
throws SQLException
SQLExceptionpublic void setNClob(int parameterIndex,
NClob value)
throws SQLException
SQLExceptionpublic void setClob(int parameterIndex,
Reader reader,
long length)
throws SQLException
SQLExceptionpublic void setClob(int parameterIndex,
Reader reader)
throws SQLException
SQLExceptionpublic void setBlob(int parameterIndex,
InputStream inputStream,
long length)
throws SQLException
SQLExceptionpublic void setBlob(int parameterIndex,
InputStream inputStream)
throws SQLException
SQLExceptionpublic void setNClob(int parameterIndex,
Reader reader,
long length)
throws SQLException
SQLExceptionpublic void setNClob(int parameterIndex,
Reader reader)
throws SQLException
SQLExceptionpublic void setSQLXML(int parameterIndex,
SQLXML xmlObject)
throws SQLException
SQLExceptionpublic void setPoolable(boolean poolable)
throws SQLException
java.sql.StatementStatement be pooled or not pooled. The value
specified is a hint to the statement pool implementation indicating
whether the applicaiton wants the statement to be pooled. It is up to
the statement pool manager as to whether the hint is used.
The poolable value of a statement is applicable to both internal statement caches implemented by the driver and external statement caches implemented by application servers and other applications.
By default, a Statement is not poolable when created, and
a PreparedStatement and CallableStatement
are poolable when created.
setPoolable in interface Statementpoolable - requests that the statement be pooled if true and
that the statement not be pooled if false
SQLException - if this method is called on a closed
Statement
public boolean isPoolable()
throws SQLException
java.sql.StatementStatement
is poolable or not.
isPoolable in interface Statementtrue if the Statement
is poolable; false otherwise
SQLException - if this method is called on a closed
Statement
setPoolable(boolean)public RowId getRowId(int parameterIndex) throws SQLException
SQLExceptionpublic RowId getRowId(String parameterName) throws SQLException
SQLExceptionpublic void setRowId(String parameterName, RowId x) throws SQLException
SQLExceptionpublic void setNString(String parameterName, String value) throws SQLException
SQLExceptionpublic void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException
SQLExceptionpublic void setNCharacterStream(String parameterName, Reader value) throws SQLException
SQLExceptionpublic void setCharacterStream(String parameterName, Reader value, long length) throws SQLException
SQLExceptionpublic void setCharacterStream(String parameterName, Reader value) throws SQLException
SQLExceptionpublic void setBinaryStream(String parameterName, InputStream value, long length) throws SQLException
SQLExceptionpublic void setBinaryStream(String parameterName, InputStream value) throws SQLException
SQLExceptionpublic void setAsciiStream(String parameterName, InputStream value, long length) throws SQLException
SQLExceptionpublic void setAsciiStream(String parameterName, InputStream value) throws SQLException
SQLExceptionpublic void setNClob(String parameterName, NClob value) throws SQLException
SQLExceptionpublic void setClob(String parameterName, Reader reader, long length) throws SQLException
SQLExceptionpublic void setClob(String parameterName, Reader reader) throws SQLException
SQLExceptionpublic void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException
SQLExceptionpublic void setBlob(String parameterName, InputStream inputStream) throws SQLException
SQLExceptionpublic void setNClob(String parameterName, Reader reader, long length) throws SQLException
SQLExceptionpublic void setNClob(String parameterName, Reader reader) throws SQLException
SQLExceptionpublic NClob getNClob(int parameterIndex) throws SQLException
SQLExceptionpublic NClob getNClob(String parameterName) throws SQLException
SQLExceptionpublic void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException
SQLExceptionpublic SQLXML getSQLXML(int parameterIndex) throws SQLException
SQLExceptionpublic SQLXML getSQLXML(String parameterIndex) throws SQLException
SQLExceptionpublic String getNString(int parameterIndex) throws SQLException
SQLExceptionpublic String getNString(String parameterName) throws SQLException
SQLExceptionpublic Reader getNCharacterStream(int parameterIndex) throws SQLException
SQLExceptionpublic Reader getNCharacterStream(String parameterName) throws SQLException
SQLExceptionpublic Reader getCharacterStream(int parameterIndex) throws SQLException
SQLExceptionpublic Reader getCharacterStream(String parameterName) throws SQLException
SQLExceptionpublic void setBlob(String parameterName, Blob x) throws SQLException
SQLExceptionpublic void setClob(String parameterName, Clob x) throws SQLException
SQLExceptionpublic boolean isWrapperFor(Class<?> iface) throws SQLException
java.sql.WrapperisWrapperFor on the wrapped
object. If this does not implement the interface and is not a wrapper, return false.
This method should be implemented as a low-cost operation compared to unwrap so that
callers can use this method to avoid expensive unwrap calls that may fail. If this method
returns true then calling unwrap with the same argument should succeed.isWrapperFor in interface Wrapperiface - a Class defining an interface.SQLException - if an error occurs while determining whether this is a wrapper
for an object with the given interface.public <T> T unwrap(Class<T> iface) throws SQLException
java.sql.Wrapperunwrap recursively on the wrapped object
or a proxy for that result. If the receiver is not a
wrapper and does not implement the interface, then an SQLException is thrown.unwrap in interface Wrapperiface - A Class defining an interface that the result must implement.SQLException - If no object found that implements the interfacepublic Logger getParentLogger() throws SQLFeatureNotSupportedException
SQLFeatureNotSupportedExceptionpublic void closeOnCompletion()
throws SQLException
java.sql.StatementStatement will be closed when all its
dependent result sets are closed. If execution of the Statement
does not produce any result sets, this method has no effect.
Note: Multiple calls to closeOnCompletion do
not toggle the effect on this Statement. However, a call to
closeOnCompletion does effect both the subsequent execution of
statements, and statements that currently have open, dependent,
result sets.
closeOnCompletion in interface StatementSQLException - if this method is called on a closed
Statementpublic boolean isCloseOnCompletion()
throws SQLException
java.sql.StatementStatement will be
closed when all its dependent result sets are closed.isCloseOnCompletion in interface Statementtrue if the Statement will be closed when all
of its dependent result sets are closed; false otherwiseSQLException - if this method is called on a closed
Statementpublic <T> T getObject(int parameterIndex,
Class<T> type)
throws SQLException
SQLExceptionpublic <T> T getObject(String parameterName, Class<T> type) throws SQLException
SQLExceptionprotected void checkCompletion()
throws SQLException
SQLExceptionpublic boolean getMoreResults(int current)
throws SQLException
java.sql.StatementStatement object's next result, deals with
any current ResultSet object(s) according to the instructions
specified by the given flag, and returns
true if the next result is a ResultSet object.
There are no more results when the following is true:
// stmt is a Statement object
((stmt.getMoreResults(current) == false) && (stmt.getUpdateCount() == -1))
getMoreResults in interface Statementcurrent - one of the following Statement
constants indicating what should happen to current
ResultSet objects obtained using the method
getResultSet:
Statement.CLOSE_CURRENT_RESULT,
Statement.KEEP_CURRENT_RESULT, or
Statement.CLOSE_ALL_RESULTStrue if the next result is a ResultSet
object; false if it is an update count or there are no
more resultsSQLException - if a database access error occurs,
this method is called on a closed Statement or the argument
supplied is not one of the following:
Statement.CLOSE_CURRENT_RESULT,
Statement.KEEP_CURRENT_RESULT or
Statement.CLOSE_ALL_RESULTSSQLFeatureNotSupportedException - if
DatabaseMetaData.supportsMultipleOpenResults returns
false and either
Statement.KEEP_CURRENT_RESULT or
Statement.CLOSE_ALL_RESULTS are supplied as
the argument.Statement.execute(java.lang.String)public ResultSet getGeneratedKeys() throws SQLException
java.sql.StatementStatement object. If this Statement object did
not generate any keys, an empty ResultSet
object is returned.
Note:If the columns which represent the auto-generated keys were not specified, the JDBC driver implementation will determine the columns which best represent the auto-generated keys.
getGeneratedKeys in interface StatementResultSet object containing the auto-generated key(s)
generated by the execution of this Statement objectSQLException - if a database access error occurs or
this method is called on a closed StatementSQLFeatureNotSupportedException - if the JDBC driver does not support this methodpublic int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException
java.sql.StatementStatement object
should be made available for retrieval. The driver will ignore the
flag if the SQL statement
is not an INSERT statement, or an SQL statement able to return
auto-generated keys (the list of such statements is vendor-specific).
Note:This method cannot be called on a
PreparedStatement or CallableStatement.
executeUpdate in interface Statementsql - an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or
DELETE; or an SQL statement that returns nothing,
such as a DDL statement.autoGeneratedKeys - a flag indicating whether auto-generated keys
should be made available for retrieval;
one of the following constants:
Statement.RETURN_GENERATED_KEYS
Statement.NO_GENERATED_KEYSSQLException - if a database access error occurs,
this method is called on a closed Statement, the given
SQL statement returns a ResultSet object,
the given constant is not one of those allowed, the method is called on a
PreparedStatement or CallableStatementSQLFeatureNotSupportedException - if the JDBC driver does not support
this method with a constant of Statement.RETURN_GENERATED_KEYSpublic int executeUpdate(String sql, int[] columnIndexes) throws SQLException
java.sql.StatementINSERT statement, or an SQL statement able to return
auto-generated keys (the list of such statements is vendor-specific).
Note:This method cannot be called on a
PreparedStatement or CallableStatement.
executeUpdate in interface Statementsql - an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or
DELETE; or an SQL statement that returns nothing,
such as a DDL statement.columnIndexes - an array of column indexes indicating the columns
that should be returned from the inserted rowSQLException - if a database access error occurs,
this method is called on a closed Statement, the SQL
statement returns a ResultSet object,the second argument
supplied to this method is not an
int array whose elements are valid column indexes, the method is called on a
PreparedStatement or CallableStatementSQLFeatureNotSupportedException - if the JDBC driver does not support this methodpublic int executeUpdate(String sql, String[] columnNames) throws SQLException
java.sql.StatementINSERT statement, or an SQL statement able to return
auto-generated keys (the list of such statements is vendor-specific).
Note:This method cannot be called on a
PreparedStatement or CallableStatement.
executeUpdate in interface Statementsql - an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or
DELETE; or an SQL statement that returns nothing,
such as a DDL statement.columnNames - an array of the names of the columns that should be
returned from the inserted rowINSERT, UPDATE,
or DELETE statements, or 0 for SQL statements
that return nothingSQLException - if a database access error occurs,
this method is called on a closed Statement, the SQL
statement returns a ResultSet object, the
second argument supplied to this method is not a String array
whose elements are valid column names, the method is called on a
PreparedStatement or CallableStatementSQLFeatureNotSupportedException - if the JDBC driver does not support this methodpublic boolean execute(String sql, int autoGeneratedKeys) throws SQLException
java.sql.StatementINSERT statement, or an SQL statement able to return
auto-generated keys (the list of such statements is vendor-specific).
In some (uncommon) situations, a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this unless you are (1) executing a stored procedure that you know may return multiple results or (2) you are dynamically executing an unknown SQL string.
The execute method executes an SQL statement and indicates the
form of the first result. You must then use the methods
getResultSet or getUpdateCount
to retrieve the result, and getMoreResults to
move to any subsequent result(s).
Note:This method cannot be called on a
PreparedStatement or CallableStatement.
execute in interface Statementsql - any SQL statementautoGeneratedKeys - a constant indicating whether auto-generated
keys should be made available for retrieval using the method
getGeneratedKeys; one of the following constants:
Statement.RETURN_GENERATED_KEYS or
Statement.NO_GENERATED_KEYStrue if the first result is a ResultSet
object; false if it is an update count or there are
no resultsSQLException - if a database access error occurs,
this method is called on a closed Statement, the second
parameter supplied to this method is not
Statement.RETURN_GENERATED_KEYS or
Statement.NO_GENERATED_KEYS,
the method is called on a
PreparedStatement or CallableStatementSQLFeatureNotSupportedException - if the JDBC driver does not support
this method with a constant of Statement.RETURN_GENERATED_KEYSStatement.getResultSet(),
Statement.getUpdateCount(),
Statement.getMoreResults(),
Statement.getGeneratedKeys()public boolean execute(String sql, int[] columnIndexes) throws SQLException
java.sql.StatementINSERT statement, or an SQL statement able to return
auto-generated keys (the list of such statements is vendor-specific).
Under some (uncommon) situations, a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this unless you are (1) executing a stored procedure that you know may return multiple results or (2) you are dynamically executing an unknown SQL string.
The execute method executes an SQL statement and indicates the
form of the first result. You must then use the methods
getResultSet or getUpdateCount
to retrieve the result, and getMoreResults to
move to any subsequent result(s).
Note:This method cannot be called on a
PreparedStatement or CallableStatement.
execute in interface Statementsql - any SQL statementcolumnIndexes - an array of the indexes of the columns in the
inserted row that should be made available for retrieval by a
call to the method getGeneratedKeystrue if the first result is a ResultSet
object; false if it is an update count or there
are no resultsSQLException - if a database access error occurs,
this method is called on a closed Statement, the
elements in the int array passed to this method
are not valid column indexes, the method is called on a
PreparedStatement or CallableStatementSQLFeatureNotSupportedException - if the JDBC driver does not support this methodStatement.getResultSet(),
Statement.getUpdateCount(),
Statement.getMoreResults()public boolean execute(String sql, String[] columnNames) throws SQLException
java.sql.StatementINSERT statement, or an SQL statement able to return
auto-generated keys (the list of such statements is vendor-specific).
In some (uncommon) situations, a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this unless you are (1) executing a stored procedure that you know may return multiple results or (2) you are dynamically executing an unknown SQL string.
The execute method executes an SQL statement and indicates the
form of the first result. You must then use the methods
getResultSet or getUpdateCount
to retrieve the result, and getMoreResults to
move to any subsequent result(s).
Note:This method cannot be called on a
PreparedStatement or CallableStatement.
execute in interface Statementsql - any SQL statementcolumnNames - an array of the names of the columns in the inserted
row that should be made available for retrieval by a call to the
method getGeneratedKeystrue if the next result is a ResultSet
object; false if it is an update count or there
are no more resultsSQLException - if a database access error occurs,
this method is called on a closed Statement,the
elements of the String array passed to this
method are not valid column names, the method is called on a
PreparedStatement or CallableStatementSQLFeatureNotSupportedException - if the JDBC driver does not support this methodStatement.getResultSet(),
Statement.getUpdateCount(),
Statement.getMoreResults(),
Statement.getGeneratedKeys()public int getResultSetHoldability()
throws SQLException
java.sql.StatementResultSet objects
generated by this Statement object.getResultSetHoldability in interface StatementResultSet.HOLD_CURSORS_OVER_COMMIT or
ResultSet.CLOSE_CURSORS_AT_COMMITSQLException - if a database access error occurs or
this method is called on a closed Statementpublic void setURL(int parameterIndex,
URL x)
throws SQLException
SQLExceptionpublic ParameterMetaData getParameterMetaData() throws SQLException
SQLExceptionpublic void registerOutParameter(String parameterName, int sqlType) throws SQLException
SQLExceptionpublic void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException
SQLExceptionpublic void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException
SQLExceptionpublic URL getURL(int parameterIndex) throws SQLException
SQLExceptionpublic void setURL(String parameterName, URL val) throws SQLException
SQLExceptionpublic void setNull(String parameterName, int sqlType) throws SQLException
SQLExceptionpublic void setBoolean(String parameterName, boolean x) throws SQLException
SQLExceptionpublic void setByte(String parameterName, byte x) throws SQLException
SQLExceptionpublic void setShort(String parameterName, short x) throws SQLException
SQLExceptionpublic void setInt(String parameterName, int x) throws SQLException
SQLExceptionpublic void setLong(String parameterName, long x) throws SQLException
SQLExceptionpublic void setFloat(String parameterName, float x) throws SQLException
SQLExceptionpublic void setDouble(String parameterName, double x) throws SQLException
SQLExceptionpublic void setBigDecimal(String parameterName, BigDecimal x) throws SQLException
SQLExceptionpublic void setString(String parameterName, String x) throws SQLException
SQLExceptionpublic void setBytes(String parameterName, byte[] x) throws SQLException
SQLExceptionpublic void setDate(String parameterName, Date x) throws SQLException
SQLExceptionpublic void setTime(String parameterName, Time x) throws SQLException
SQLExceptionpublic void setTimestamp(String parameterName, Timestamp x) throws SQLException
SQLExceptionpublic void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException
SQLExceptionpublic void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException
SQLExceptionpublic void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException
SQLExceptionpublic void setObject(String parameterName, Object x, int targetSqlType) throws SQLException
SQLExceptionpublic void setObject(String parameterName, Object x) throws SQLException
SQLExceptionpublic void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException
SQLExceptionpublic void setDate(String parameterName, Date x, Calendar cal) throws SQLException
SQLExceptionpublic void setTime(String parameterName, Time x, Calendar cal) throws SQLException
SQLExceptionpublic void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException
SQLExceptionpublic void setNull(String parameterName, int sqlType, String typeName) throws SQLException
SQLExceptionpublic String getString(String parameterName) throws SQLException
SQLExceptionpublic boolean getBoolean(String parameterName) throws SQLException
SQLExceptionpublic byte getByte(String parameterName) throws SQLException
SQLExceptionpublic short getShort(String parameterName) throws SQLException
SQLExceptionpublic int getInt(String parameterName) throws SQLException
SQLExceptionpublic long getLong(String parameterName) throws SQLException
SQLExceptionpublic float getFloat(String parameterName) throws SQLException
SQLExceptionpublic double getDouble(String parameterName) throws SQLException
SQLExceptionpublic byte[] getBytes(String parameterName) throws SQLException
SQLExceptionpublic Date getDate(String parameterName) throws SQLException
SQLExceptionpublic Time getTime(String parameterName) throws SQLException
SQLExceptionpublic Timestamp getTimestamp(String parameterName) throws SQLException
SQLExceptionpublic Object getObject(String parameterName) throws SQLException
SQLExceptionpublic BigDecimal getBigDecimal(String parameterName) throws SQLException
SQLExceptionpublic Object getObjectImpl(String parameterName, Map map) throws SQLException
SQLExceptionpublic Ref getRef(String parameterName) throws SQLException
SQLExceptionpublic Blob getBlob(String parameterName) throws SQLException
SQLExceptionpublic Clob getClob(String parameterName) throws SQLException
SQLExceptionpublic Array getArray(String parameterName) throws SQLException
SQLExceptionpublic Date getDate(String parameterName, Calendar cal) throws SQLException
SQLExceptionpublic Time getTime(String parameterName, Calendar cal) throws SQLException
SQLExceptionpublic Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException
SQLExceptionpublic URL getURL(String parameterName) throws SQLException
SQLExceptionpublic void registerOutParameter(int parameterIndex,
int sqlType)
throws SQLException
SQLExceptionpublic void registerOutParameter(int parameterIndex,
int sqlType,
int scale)
throws SQLException
SQLExceptionpublic ResultSet createDriverResultSet(Field[] fields, List tuples) throws SQLException
BaseStatementcreateDriverResultSet in interface BaseStatementfields - the column metadata for the resultsettuples - the resultset dataSQLException - if something goes wrongCopyright © 2015 PostgreSQL Global Development Group. All rights reserved.