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_INFINITY
CLOSE_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
BaseStatement
createResultSet
in interface BaseStatement
originalQuery
- 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 Statement
protected boolean wantsScrollableResultSet()
protected boolean wantsHoldableResultSet()
public ResultSet executeQuery(String p_sql) throws SQLException
executeQuery
in interface Statement
SQLException
public ResultSet executeQuery() throws SQLException
SQLException
public int executeUpdate(String p_sql) throws SQLException
executeUpdate
in interface Statement
SQLException
public int executeUpdate() throws SQLException
SQLException
public boolean execute(String p_sql) throws SQLException
execute
in interface Statement
SQLException
public boolean executeWithFlags(String p_sql, int flags) throws SQLException
BaseStatement
executeWithFlags
in interface BaseStatement
p_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
SQLException
public boolean executeWithFlags(int flags) throws SQLException
BaseStatement
executeWithFlags
in interface BaseStatement
flags
- additional QueryExecutor
flags for execution; these
are bitwise-ORed into the default flags.SQLException
- if something goes wrong.protected void closeForNextExecution() throws SQLException
SQLException
protected void execute(Query queryToExecute, ParameterList queryParameters, int flags) throws SQLException
SQLException
public void setCursorName(String name) throws SQLException
setCursorName
in interface Statement
SQLException
public int getUpdateCount() throws SQLException
getUpdateCount
in interface Statement
SQLException
public boolean getMoreResults() throws SQLException
getMoreResults
in interface Statement
SQLException
public int getMaxRows() throws SQLException
getMaxRows
in interface Statement
SQLException
public void setMaxRows(int max) throws SQLException
setMaxRows
in interface Statement
SQLException
public void setEscapeProcessing(boolean enable) throws SQLException
setEscapeProcessing
in interface Statement
SQLException
public int getQueryTimeout() throws SQLException
getQueryTimeout
in interface Statement
SQLException
public void setQueryTimeout(int seconds) throws SQLException
setQueryTimeout
in interface Statement
SQLException
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
getWarnings
in interface Statement
SQLException
public int getMaxFieldSize() throws SQLException
getMaxFieldSize
in interface Statement
SQLException
public void setMaxFieldSize(int max) throws SQLException
setMaxFieldSize
in interface Statement
SQLException
public void clearWarnings() throws SQLException
clearWarnings
in interface Statement
SQLException
public ResultSet getResultSet() throws SQLException
getResultSet
in interface Statement
SQLException
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.
close
in interface AutoCloseable
close
in interface Statement
SQLException
protected 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
PGStatement
getLastOID
in interface PGStatement
SQLException
- if something goes wrongpublic void setNull(int parameterIndex, int sqlType) throws SQLException
SQLException
public void setBoolean(int parameterIndex, boolean x) throws SQLException
SQLException
public void setByte(int parameterIndex, byte x) throws SQLException
SQLException
public void setShort(int parameterIndex, short x) throws SQLException
SQLException
public void setInt(int parameterIndex, int x) throws SQLException
SQLException
public void setLong(int parameterIndex, long x) throws SQLException
SQLException
public void setFloat(int parameterIndex, float x) throws SQLException
SQLException
public void setDouble(int parameterIndex, double x) throws SQLException
SQLException
public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException
SQLException
public void setString(int parameterIndex, String x) throws SQLException
SQLException
protected void setString(int parameterIndex, String x, int oid) throws SQLException
SQLException
public void setBytes(int parameterIndex, byte[] x) throws SQLException
SQLException
public void setDate(int parameterIndex, Date x) throws SQLException
SQLException
public void setTime(int parameterIndex, Time x) throws SQLException
SQLException
public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException
SQLException
public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException
SQLException
public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException
SQLException
public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException
SQLException
public void clearParameters() throws SQLException
SQLException
public void setObject(int parameterIndex, Object in, int targetSqlType, int scale) throws SQLException
SQLException
public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException
SQLException
public void setObject(int parameterIndex, Object x) throws SQLException
SQLException
public 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
SQLException
public String getString(int parameterIndex) throws SQLException
SQLException
public boolean getBoolean(int parameterIndex) throws SQLException
SQLException
public byte getByte(int parameterIndex) throws SQLException
SQLException
public short getShort(int parameterIndex) throws SQLException
SQLException
public int getInt(int parameterIndex) throws SQLException
SQLException
public long getLong(int parameterIndex) throws SQLException
SQLException
public float getFloat(int parameterIndex) throws SQLException
SQLException
public double getDouble(int parameterIndex) throws SQLException
SQLException
public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException
SQLException
public byte[] getBytes(int parameterIndex) throws SQLException
SQLException
public Date getDate(int parameterIndex) throws SQLException
SQLException
public Time getTime(int parameterIndex) throws SQLException
SQLException
public Timestamp getTimestamp(int parameterIndex) throws SQLException
SQLException
public Object getObject(int parameterIndex) throws SQLException
SQLException
public 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
SQLException
protected 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 PGStatement
newThreshold
- the new threshold for this statementSQLException
- if an exception occurs while changing the thresholdpublic int getPrepareThreshold()
PGStatement
getPrepareThreshold
in interface PGStatement
PGStatement.setPrepareThreshold(int)
public void setUseServerPrepare(boolean flag) throws SQLException
PGStatement
setPrepareThreshold(1)
.setUseServerPrepare
in interface PGStatement
flag
- use server prepareSQLException
- if something goes wrongpublic boolean isUseServerPrepare()
PGStatement
true
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 PGStatement
protected void checkClosed() throws SQLException
SQLException
public void addBatch(String p_sql) throws SQLException
addBatch
in interface Statement
SQLException
public void clearBatch() throws SQLException
clearBatch
in interface Statement
SQLException
public int[] executeBatch() throws SQLException
executeBatch
in interface Statement
SQLException
public void cancel() throws SQLException
cancel
in interface Statement
SQLException
public Connection getConnection() throws SQLException
getConnection
in interface Statement
SQLException
public int getFetchDirection()
getFetchDirection
in interface Statement
public int getResultSetConcurrency()
getResultSetConcurrency
in interface Statement
public int getResultSetType()
getResultSetType
in interface Statement
public void setFetchDirection(int direction) throws SQLException
setFetchDirection
in interface Statement
SQLException
public void setFetchSize(int rows) throws SQLException
setFetchSize
in interface Statement
SQLException
public void addBatch() throws SQLException
SQLException
public ResultSetMetaData getMetaData() throws SQLException
SQLException
public void setArray(int i, Array x) throws SQLException
SQLException
protected long createBlob(int i, InputStream inputStream, long length) throws SQLException
SQLException
public void setBlob(int i, Blob x) throws SQLException
SQLException
public void setCharacterStream(int i, Reader x, int length) throws SQLException
SQLException
public void setClob(int i, Clob x) throws SQLException
SQLException
public void setNull(int i, int t, String s) throws SQLException
SQLException
public void setRef(int i, Ref x) throws SQLException
SQLException
public void setDate(int i, Date d, Calendar cal) throws SQLException
SQLException
public void setTime(int i, Time t, Calendar cal) throws SQLException
SQLException
public void setTimestamp(int i, Timestamp t, Calendar cal) throws SQLException
SQLException
public Array getArray(int i) throws SQLException
SQLException
public BigDecimal getBigDecimal(int parameterIndex) throws SQLException
SQLException
public Blob getBlob(int i) throws SQLException
SQLException
public Clob getClob(int i) throws SQLException
SQLException
public Object getObjectImpl(int i, Map map) throws SQLException
SQLException
public Ref getRef(int i) throws SQLException
SQLException
public Date getDate(int i, Calendar cal) throws SQLException
SQLException
public Time getTime(int i, Calendar cal) throws SQLException
SQLException
public Timestamp getTimestamp(int i, Calendar cal) throws SQLException
SQLException
public void registerOutParameter(int parameterIndex, int sqlType, String typeName) throws SQLException
SQLException
protected boolean getForceBinaryTransfer()
public ParameterMetaData createParameterMetaData(BaseConnection conn, int[] oids) throws SQLException
SQLException
public long getLargeUpdateCount() throws SQLException
getLargeUpdateCount
in interface Statement
SQLException
public void setLargeMaxRows(long max) throws SQLException
setLargeMaxRows
in interface Statement
SQLException
public long getLargeMaxRows() throws SQLException
getLargeMaxRows
in interface Statement
SQLException
public long[] executeLargeBatch() throws SQLException
executeLargeBatch
in interface Statement
SQLException
public long executeLargeUpdate(String sql) throws SQLException
executeLargeUpdate
in interface Statement
SQLException
public long executeLargeUpdate(String sql, int autoGeneratedKeys) throws SQLException
executeLargeUpdate
in interface Statement
SQLException
public long executeLargeUpdate(String sql, int[] columnIndexes) throws SQLException
executeLargeUpdate
in interface Statement
SQLException
public long executeLargeUpdate(String sql, String[] columnNames) throws SQLException
executeLargeUpdate
in interface Statement
SQLException
public long executeLargeUpdate() throws SQLException
SQLException
public void setObject(int parameterIndex, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException
SQLException
public void setObject(int parameterIndex, Object x, SQLType targetSqlType) throws SQLException
SQLException
public void setObject(String parameterName, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException
SQLException
public void setObject(String parameterName, Object x, SQLType targetSqlType) throws SQLException
SQLException
public void registerOutParameter(int parameterIndex, SQLType sqlType) throws SQLException
SQLException
public void registerOutParameter(int parameterIndex, SQLType sqlType, int scale) throws SQLException
SQLException
public void registerOutParameter(int parameterIndex, SQLType sqlType, String typeName) throws SQLException
SQLException
public void registerOutParameter(String parameterName, SQLType sqlType) throws SQLException
SQLException
public void registerOutParameter(String parameterName, SQLType sqlType, int scale) throws SQLException
SQLException
public void registerOutParameter(String parameterName, SQLType sqlType, String typeName) throws SQLException
SQLException
public boolean isClosed() throws SQLException
isClosed
in interface Statement
SQLException
public void setRowId(int parameterIndex, RowId x) throws SQLException
SQLException
public void setNString(int parameterIndex, String value) throws SQLException
SQLException
public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException
SQLException
public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException
SQLException
public void setCharacterStream(int parameterIndex, Reader value, long length) throws SQLException
SQLException
public void setCharacterStream(int parameterIndex, Reader value) throws SQLException
SQLException
public void setBinaryStream(int parameterIndex, InputStream value, long length) throws SQLException
SQLException
public void setBinaryStream(int parameterIndex, InputStream value) throws SQLException
SQLException
public void setAsciiStream(int parameterIndex, InputStream value, long length) throws SQLException
SQLException
public void setAsciiStream(int parameterIndex, InputStream value) throws SQLException
SQLException
public void setNClob(int parameterIndex, NClob value) throws SQLException
SQLException
public void setClob(int parameterIndex, Reader reader, long length) throws SQLException
SQLException
public void setClob(int parameterIndex, Reader reader) throws SQLException
SQLException
public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException
SQLException
public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException
SQLException
public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException
SQLException
public void setNClob(int parameterIndex, Reader reader) throws SQLException
SQLException
public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException
SQLException
public void setPoolable(boolean poolable) throws SQLException
setPoolable
in interface Statement
SQLException
public boolean isPoolable() throws SQLException
isPoolable
in interface Statement
SQLException
public RowId getRowId(int parameterIndex) throws SQLException
SQLException
public RowId getRowId(String parameterName) throws SQLException
SQLException
public void setRowId(String parameterName, RowId x) throws SQLException
SQLException
public void setNString(String parameterName, String value) throws SQLException
SQLException
public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException
SQLException
public void setNCharacterStream(String parameterName, Reader value) throws SQLException
SQLException
public void setCharacterStream(String parameterName, Reader value, long length) throws SQLException
SQLException
public void setCharacterStream(String parameterName, Reader value) throws SQLException
SQLException
public void setBinaryStream(String parameterName, InputStream value, long length) throws SQLException
SQLException
public void setBinaryStream(String parameterName, InputStream value) throws SQLException
SQLException
public void setAsciiStream(String parameterName, InputStream value, long length) throws SQLException
SQLException
public void setAsciiStream(String parameterName, InputStream value) throws SQLException
SQLException
public void setNClob(String parameterName, NClob value) throws SQLException
SQLException
public void setClob(String parameterName, Reader reader, long length) throws SQLException
SQLException
public void setClob(String parameterName, Reader reader) throws SQLException
SQLException
public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException
SQLException
public void setBlob(String parameterName, InputStream inputStream) throws SQLException
SQLException
public void setNClob(String parameterName, Reader reader, long length) throws SQLException
SQLException
public void setNClob(String parameterName, Reader reader) throws SQLException
SQLException
public NClob getNClob(int parameterIndex) throws SQLException
SQLException
public NClob getNClob(String parameterName) throws SQLException
SQLException
public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException
SQLException
public SQLXML getSQLXML(int parameterIndex) throws SQLException
SQLException
public SQLXML getSQLXML(String parameterIndex) throws SQLException
SQLException
public String getNString(int parameterIndex) throws SQLException
SQLException
public String getNString(String parameterName) throws SQLException
SQLException
public Reader getNCharacterStream(int parameterIndex) throws SQLException
SQLException
public Reader getNCharacterStream(String parameterName) throws SQLException
SQLException
public Reader getCharacterStream(int parameterIndex) throws SQLException
SQLException
public Reader getCharacterStream(String parameterName) throws SQLException
SQLException
public void setBlob(String parameterName, Blob x) throws SQLException
SQLException
public void setClob(String parameterName, Clob x) throws SQLException
SQLException
public boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor
in interface Wrapper
SQLException
public <T> T unwrap(Class<T> iface) throws SQLException
unwrap
in interface Wrapper
SQLException
public Logger getParentLogger() throws SQLFeatureNotSupportedException
SQLFeatureNotSupportedException
public void closeOnCompletion() throws SQLException
closeOnCompletion
in interface Statement
SQLException
public boolean isCloseOnCompletion() throws SQLException
isCloseOnCompletion
in interface Statement
SQLException
public <T> T getObject(int parameterIndex, Class<T> type) throws SQLException
SQLException
public <T> T getObject(String parameterName, Class<T> type) throws SQLException
SQLException
protected void checkCompletion() throws SQLException
SQLException
public boolean getMoreResults(int current) throws SQLException
getMoreResults
in interface Statement
SQLException
public ResultSet getGeneratedKeys() throws SQLException
getGeneratedKeys
in interface Statement
SQLException
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException
executeUpdate
in interface Statement
SQLException
public int executeUpdate(String sql, int[] columnIndexes) throws SQLException
executeUpdate
in interface Statement
SQLException
public int executeUpdate(String sql, String[] columnNames) throws SQLException
executeUpdate
in interface Statement
SQLException
public boolean execute(String sql, int autoGeneratedKeys) throws SQLException
execute
in interface Statement
SQLException
public boolean execute(String sql, int[] columnIndexes) throws SQLException
execute
in interface Statement
SQLException
public boolean execute(String sql, String[] columnNames) throws SQLException
execute
in interface Statement
SQLException
public int getResultSetHoldability() throws SQLException
getResultSetHoldability
in interface Statement
SQLException
public void setURL(int parameterIndex, URL x) throws SQLException
SQLException
public ParameterMetaData getParameterMetaData() throws SQLException
SQLException
public void registerOutParameter(String parameterName, int sqlType) throws SQLException
SQLException
public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException
SQLException
public void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException
SQLException
public URL getURL(int parameterIndex) throws SQLException
SQLException
public void setURL(String parameterName, URL val) throws SQLException
SQLException
public void setNull(String parameterName, int sqlType) throws SQLException
SQLException
public void setBoolean(String parameterName, boolean x) throws SQLException
SQLException
public void setByte(String parameterName, byte x) throws SQLException
SQLException
public void setShort(String parameterName, short x) throws SQLException
SQLException
public void setInt(String parameterName, int x) throws SQLException
SQLException
public void setLong(String parameterName, long x) throws SQLException
SQLException
public void setFloat(String parameterName, float x) throws SQLException
SQLException
public void setDouble(String parameterName, double x) throws SQLException
SQLException
public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException
SQLException
public void setString(String parameterName, String x) throws SQLException
SQLException
public void setBytes(String parameterName, byte[] x) throws SQLException
SQLException
public void setDate(String parameterName, Date x) throws SQLException
SQLException
public void setTime(String parameterName, Time x) throws SQLException
SQLException
public void setTimestamp(String parameterName, Timestamp x) throws SQLException
SQLException
public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException
SQLException
public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException
SQLException
public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException
SQLException
public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException
SQLException
public void setObject(String parameterName, Object x) throws SQLException
SQLException
public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException
SQLException
public void setDate(String parameterName, Date x, Calendar cal) throws SQLException
SQLException
public void setTime(String parameterName, Time x, Calendar cal) throws SQLException
SQLException
public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException
SQLException
public void setNull(String parameterName, int sqlType, String typeName) throws SQLException
SQLException
public String getString(String parameterName) throws SQLException
SQLException
public boolean getBoolean(String parameterName) throws SQLException
SQLException
public byte getByte(String parameterName) throws SQLException
SQLException
public short getShort(String parameterName) throws SQLException
SQLException
public int getInt(String parameterName) throws SQLException
SQLException
public long getLong(String parameterName) throws SQLException
SQLException
public float getFloat(String parameterName) throws SQLException
SQLException
public double getDouble(String parameterName) throws SQLException
SQLException
public byte[] getBytes(String parameterName) throws SQLException
SQLException
public Date getDate(String parameterName) throws SQLException
SQLException
public Time getTime(String parameterName) throws SQLException
SQLException
public Timestamp getTimestamp(String parameterName) throws SQLException
SQLException
public Object getObject(String parameterName) throws SQLException
SQLException
public BigDecimal getBigDecimal(String parameterName) throws SQLException
SQLException
public Object getObjectImpl(String parameterName, Map map) throws SQLException
SQLException
public Ref getRef(String parameterName) throws SQLException
SQLException
public Blob getBlob(String parameterName) throws SQLException
SQLException
public Clob getClob(String parameterName) throws SQLException
SQLException
public Array getArray(String parameterName) throws SQLException
SQLException
public Date getDate(String parameterName, Calendar cal) throws SQLException
SQLException
public Time getTime(String parameterName, Calendar cal) throws SQLException
SQLException
public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException
SQLException
public URL getURL(String parameterName) throws SQLException
SQLException
public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException
SQLException
public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException
SQLException
public ResultSet createDriverResultSet(Field[] fields, List tuples) throws SQLException
BaseStatement
createDriverResultSet
in interface BaseStatement
fields
- the column metadata for the resultsettuples
- the resultset dataSQLException
- if something goes wrongCopyright © 2016 PostgreSQL Global Development Group. All rights reserved.