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? This is set at creation time and never cleared by
execution.
|
protected boolean |
wantsGeneratedKeysOnce
Does the caller of execute/executeUpdate want generated keys for this
execution? This is set by Statement methods that have generated keys
arguments and cleared after execution is complete.
|
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) |
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() |
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() |
void |
clearParameters() |
void |
clearWarnings() |
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() |
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) |
boolean |
execute(String sql,
int autoGeneratedKeys) |
boolean |
execute(String sql,
int[] columnIndexes) |
boolean |
execute(String sql,
String[] columnNames) |
int[] |
executeBatch() |
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) |
int |
executeUpdate() |
int |
executeUpdate(String p_sql) |
int |
executeUpdate(String sql,
int autoGeneratedKeys) |
int |
executeUpdate(String sql,
int[] columnIndexes) |
int |
executeUpdate(String sql,
String[] columnNames) |
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() |
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() |
String |
getFetchingCursorName() |
int |
getFetchSize() |
float |
getFloat(int parameterIndex) |
float |
getFloat(String parameterName) |
protected boolean |
getForceBinaryTransfer() |
ResultSet |
getGeneratedKeys() |
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() |
int |
getMaxRows() |
ResultSetMetaData |
getMetaData() |
boolean |
getMoreResults() |
boolean |
getMoreResults(int current) |
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() |
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() |
int |
getResultSetConcurrency() |
int |
getResultSetHoldability() |
int |
getResultSetType() |
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() |
URL |
getURL(int parameterIndex) |
URL |
getURL(String parameterName) |
SQLWarning |
getWarnings() |
boolean |
isClosed() |
boolean |
isCloseOnCompletion() |
boolean |
isPoolable() |
boolean |
isUseServerPrepare()
Checks if this statement will be executed as a server-prepared
statement.
|
boolean |
isWrapperFor(Class<?> iface) |
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:
|
void |
registerOutParameter(int parameterIndex,
int sqlType,
String typeName) |
void |
registerOutParameter(int parameterIndex,
SQLType sqlType) |
void |
registerOutParameter(int parameterIndex,
SQLType sqlType,
int scale) |
void |
registerOutParameter(int parameterIndex,
SQLType 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 |
registerOutParameter(String parameterName,
SQLType sqlType) |
void |
registerOutParameter(String parameterName,
SQLType sqlType,
int scale) |
void |
registerOutParameter(String parameterName,
SQLType 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) |
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) |
void |
setFetchDirection(int direction) |
void |
setFetchSize(int rows) |
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) |
void |
setMaxRows(int max) |
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(int parameterIndex,
Object x,
SQLType targetSqlType) |
void |
setObject(int parameterIndex,
Object x,
SQLType targetSqlType,
int scaleOrLength) |
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 |
setObject(String parameterName,
Object x,
SQLType targetSqlType) |
void |
setObject(String parameterName,
Object x,
SQLType targetSqlType,
int scaleOrLength) |
void |
setPoolable(boolean poolable) |
void |
setPrepareThreshold(int newThreshold)
Sets the reuse threshold for using server-prepared statements.
|
void |
setQueryTimeout(int 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) |
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()
getFetchSize in interface Statementprotected boolean wantsScrollableResultSet()
protected boolean wantsHoldableResultSet()
public ResultSet executeQuery(String p_sql) throws SQLException
executeQuery in interface StatementSQLExceptionpublic ResultSet executeQuery() throws SQLException
SQLExceptionpublic int executeUpdate(String p_sql) throws SQLException
executeUpdate in interface StatementSQLExceptionpublic int executeUpdate()
throws SQLException
SQLExceptionpublic boolean execute(String p_sql) throws SQLException
execute in interface StatementSQLExceptionpublic 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
setCursorName in interface StatementSQLExceptionpublic int getUpdateCount()
throws SQLException
getUpdateCount in interface StatementSQLExceptionpublic boolean getMoreResults()
throws SQLException
getMoreResults in interface StatementSQLExceptionpublic int getMaxRows()
throws SQLException
getMaxRows in interface StatementSQLExceptionpublic void setMaxRows(int max)
throws SQLException
setMaxRows in interface StatementSQLExceptionpublic void setEscapeProcessing(boolean enable)
throws SQLException
setEscapeProcessing in interface StatementSQLExceptionpublic int getQueryTimeout()
throws SQLException
getQueryTimeout in interface StatementSQLExceptionpublic void setQueryTimeout(int seconds)
throws SQLException
setQueryTimeout in interface StatementSQLExceptionpublic 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
getWarnings in interface StatementSQLExceptionpublic int getMaxFieldSize()
throws SQLException
getMaxFieldSize in interface StatementSQLExceptionpublic void setMaxFieldSize(int max)
throws SQLException
setMaxFieldSize in interface StatementSQLExceptionpublic void clearWarnings()
throws SQLException
clearWarnings in interface StatementSQLExceptionpublic ResultSet getResultSet() throws SQLException
getResultSet in interface StatementSQLExceptionpublic void close()
throws SQLException
Statement is automatically closed when it is
garbage collected, it is better to close it explicitly to lower resource consumption.
close in interface AutoCloseableclose in interface StatementSQLExceptionprotected 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
addBatch in interface StatementSQLExceptionpublic void clearBatch()
throws SQLException
clearBatch in interface StatementSQLExceptionpublic int[] executeBatch()
throws SQLException
executeBatch in interface StatementSQLExceptionpublic void cancel()
throws SQLException
cancel in interface StatementSQLExceptionpublic Connection getConnection() throws SQLException
getConnection in interface StatementSQLExceptionpublic int getFetchDirection()
getFetchDirection in interface Statementpublic int getResultSetConcurrency()
getResultSetConcurrency in interface Statementpublic int getResultSetType()
getResultSetType in interface Statementpublic void setFetchDirection(int direction)
throws SQLException
setFetchDirection in interface StatementSQLExceptionpublic void setFetchSize(int rows)
throws SQLException
setFetchSize in interface StatementSQLExceptionpublic 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
getLargeUpdateCount in interface StatementSQLExceptionpublic void setLargeMaxRows(long max)
throws SQLException
setLargeMaxRows in interface StatementSQLExceptionpublic long getLargeMaxRows()
throws SQLException
getLargeMaxRows in interface StatementSQLExceptionpublic long[] executeLargeBatch()
throws SQLException
executeLargeBatch in interface StatementSQLExceptionpublic long executeLargeUpdate(String sql) throws SQLException
executeLargeUpdate in interface StatementSQLExceptionpublic long executeLargeUpdate(String sql, int autoGeneratedKeys) throws SQLException
executeLargeUpdate in interface StatementSQLExceptionpublic long executeLargeUpdate(String sql, int[] columnIndexes) throws SQLException
executeLargeUpdate in interface StatementSQLExceptionpublic long executeLargeUpdate(String sql, String[] columnNames) throws SQLException
executeLargeUpdate in interface StatementSQLExceptionpublic long executeLargeUpdate()
throws SQLException
SQLExceptionpublic void setObject(int parameterIndex,
Object x,
SQLType targetSqlType,
int scaleOrLength)
throws SQLException
SQLExceptionpublic void setObject(int parameterIndex,
Object x,
SQLType targetSqlType)
throws SQLException
SQLExceptionpublic void setObject(String parameterName, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException
SQLExceptionpublic void setObject(String parameterName, Object x, SQLType targetSqlType) throws SQLException
SQLExceptionpublic void registerOutParameter(int parameterIndex,
SQLType sqlType)
throws SQLException
SQLExceptionpublic void registerOutParameter(int parameterIndex,
SQLType sqlType,
int scale)
throws SQLException
SQLExceptionpublic void registerOutParameter(int parameterIndex,
SQLType sqlType,
String typeName)
throws SQLException
SQLExceptionpublic void registerOutParameter(String parameterName, SQLType sqlType) throws SQLException
SQLExceptionpublic void registerOutParameter(String parameterName, SQLType sqlType, int scale) throws SQLException
SQLExceptionpublic void registerOutParameter(String parameterName, SQLType sqlType, String typeName) throws SQLException
SQLExceptionpublic boolean isClosed()
throws SQLException
isClosed in interface StatementSQLExceptionpublic 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
setPoolable in interface StatementSQLExceptionpublic boolean isPoolable()
throws SQLException
isPoolable in interface StatementSQLExceptionpublic 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
isWrapperFor in interface WrapperSQLExceptionpublic <T> T unwrap(Class<T> iface) throws SQLException
unwrap in interface WrapperSQLExceptionpublic Logger getParentLogger() throws SQLFeatureNotSupportedException
SQLFeatureNotSupportedExceptionpublic void closeOnCompletion()
throws SQLException
closeOnCompletion in interface StatementSQLExceptionpublic boolean isCloseOnCompletion()
throws SQLException
isCloseOnCompletion in interface StatementSQLExceptionpublic <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
getMoreResults in interface StatementSQLExceptionpublic ResultSet getGeneratedKeys() throws SQLException
getGeneratedKeys in interface StatementSQLExceptionpublic int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException
executeUpdate in interface StatementSQLExceptionpublic int executeUpdate(String sql, int[] columnIndexes) throws SQLException
executeUpdate in interface StatementSQLExceptionpublic int executeUpdate(String sql, String[] columnNames) throws SQLException
executeUpdate in interface StatementSQLExceptionpublic boolean execute(String sql, int autoGeneratedKeys) throws SQLException
execute in interface StatementSQLExceptionpublic boolean execute(String sql, int[] columnIndexes) throws SQLException
execute in interface StatementSQLExceptionpublic boolean execute(String sql, String[] columnNames) throws SQLException
execute in interface StatementSQLExceptionpublic int getResultSetHoldability()
throws SQLException
getResultSetHoldability in interface StatementSQLExceptionpublic 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 © 2016 PostgreSQL Global Development Group. All rights reserved.