|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.postgresql.jdbc2.AbstractJdbc2Statement
public abstract class AbstractJdbc2Statement
This class defines methods of the jdbc2 specification. The real Statement class (for jdbc2) is org.postgresql.jdbc2.Jdbc2Statement
| Nested Class Summary | |
|---|---|
class |
AbstractJdbc2Statement.StatementResultHandler
|
| Field Summary | |
|---|---|
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 |
batchParameters
|
protected ArrayList |
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 |
m_useCount
|
protected int |
maxfieldSize
|
protected int |
maxrows
Maximum number of rows to return, 0 = unlimited |
protected boolean |
outParmBeforeFunc
|
protected ParameterList |
preparedParameters
|
protected Query |
preparedQuery
|
protected boolean |
replaceProcessingEnabled
|
protected ResultWrapper |
result
The current results. |
protected int |
resultsettype
|
protected int |
timeout
Timeout (in seconds) for a query (not used) |
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. |
| Fields inherited from interface org.postgresql.PGStatement |
|---|
DATE_NEGATIVE_INFINITY, DATE_POSITIVE_INFINITY |
| Fields inherited from interface java.sql.Statement |
|---|
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO |
| Constructor Summary | |
|---|---|
AbstractJdbc2Statement(AbstractJdbc2Connection c,
int rsType,
int rsConcurrency)
|
|
AbstractJdbc2Statement(AbstractJdbc2Connection connection,
String sql,
boolean isCallable,
int rsType,
int rsConcurrency)
|
|
| Method Summary | |
|---|---|
void |
addBatch()
|
void |
addBatch(String p_sql)
|
void |
addWarning(SQLWarning warn)
This adds a warning to the warning chain. |
protected void |
bindLiteral(int paramIndex,
String s,
int oid)
|
void |
cancel()
|
protected void |
checkClosed()
|
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()
|
protected void |
closeForNextExecution()
|
ResultSet |
createDriverResultSet(Field[] fields,
Vector tuples)
Create a synthetic resultset from data provided by the driver. |
abstract ResultSet |
createResultSet(Query originalQuery,
Field[] fields,
Vector 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)
|
int[] |
executeBatch()
|
ResultSet |
executeQuery()
|
ResultSet |
executeQuery(String p_sql)
|
int |
executeUpdate()
|
int |
executeUpdate(String p_sql)
|
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. |
protected void |
finalize()
This finalizer ensures that statements that have allocated server-side resources free them when they become unreferenced. |
Array |
getArray(int i)
|
BigDecimal |
getBigDecimal(int parameterIndex)
|
BigDecimal |
getBigDecimal(int parameterIndex,
int scale)
|
Blob |
getBlob(int i)
|
boolean |
getBoolean(int parameterIndex)
|
byte |
getByte(int parameterIndex)
|
byte[] |
getBytes(int parameterIndex)
|
Clob |
getClob(int i)
|
Connection |
getConnection()
|
Date |
getDate(int parameterIndex)
|
Date |
getDate(int i,
Calendar cal)
|
double |
getDouble(int parameterIndex)
|
int |
getFetchDirection()
|
String |
getFetchingCursorName()
|
int |
getFetchSize()
|
float |
getFloat(int parameterIndex)
|
int |
getInsertedOID()
|
int |
getInt(int parameterIndex)
|
long |
getLastOID()
Returns the Last inserted/updated oid. |
long |
getLong(int parameterIndex)
|
int |
getMaxFieldSize()
|
int |
getMaxRows()
|
ResultSetMetaData |
getMetaData()
|
boolean |
getMoreResults()
|
Object |
getObject(int parameterIndex)
|
Object |
getObjectImpl(int i,
Map map)
|
BaseConnection |
getPGConnection()
|
int |
getPrepareThreshold()
Gets the server-side prepare reuse threshold in use for this statement. |
int |
getQueryTimeout()
|
Ref |
getRef(int i)
|
ResultSet |
getResultSet()
|
int |
getResultSetConcurrency()
|
int |
getResultSetType()
|
short |
getShort(int parameterIndex)
|
String |
getString(int parameterIndex)
|
Time |
getTime(int parameterIndex)
|
Time |
getTime(int i,
Calendar cal)
|
Timestamp |
getTimestamp(int parameterIndex)
|
Timestamp |
getTimestamp(int i,
Calendar cal)
|
int |
getUpdateCount()
|
SQLWarning |
getWarnings()
|
boolean |
isUseServerPrepare()
Checks if this statement will be executed as a server-prepared statement. |
protected static int |
parseSql(String p_sql,
int i,
StringBuffer 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,
boolean setPreparedParameters)
|
void |
registerOutParameter(int parameterIndex,
int sqlType,
int scale,
boolean setPreparedParameters)
|
void |
registerOutParameter(int parameterIndex,
int sqlType,
String typeName)
|
protected String |
replaceProcessing(String p_sql)
|
void |
setArray(int i,
Array x)
|
void |
setAsciiStream(int parameterIndex,
InputStream x,
int length)
|
void |
setBigDecimal(int parameterIndex,
BigDecimal x)
|
void |
setBinaryStream(int parameterIndex,
InputStream x,
int length)
|
void |
setBlob(int i,
Blob x)
|
void |
setBoolean(int parameterIndex,
boolean x)
|
void |
setByte(int parameterIndex,
byte x)
|
void |
setBytes(int parameterIndex,
byte[] x)
|
void |
setCharacterStream(int i,
Reader x,
int length)
|
void |
setClob(int i,
Clob x)
|
void |
setCursorName(String name)
|
void |
setDate(int parameterIndex,
Date x)
|
void |
setDate(int i,
Date d,
Calendar cal)
|
void |
setDouble(int parameterIndex,
double x)
|
void |
setEscapeProcessing(boolean enable)
|
void |
setFetchDirection(int direction)
|
void |
setFetchSize(int rows)
|
void |
setFloat(int parameterIndex,
float x)
|
void |
setInt(int parameterIndex,
int x)
|
void |
setLong(int parameterIndex,
long x)
|
void |
setMaxFieldSize(int max)
|
void |
setMaxRows(int max)
|
void |
setNull(int parameterIndex,
int sqlType)
|
void |
setNull(int i,
int t,
String s)
|
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 |
setPrepareThreshold(int newThreshold)
Sets the reuse threshold for using server-prepared statements. |
void |
setQueryTimeout(int seconds)
|
void |
setRef(int i,
Ref x)
|
void |
setShort(int parameterIndex,
short x)
|
void |
setString(int parameterIndex,
String x)
|
protected void |
setString(int parameterIndex,
String x,
int oid)
|
void |
setTime(int parameterIndex,
Time x)
|
void |
setTime(int i,
Time t,
Calendar cal)
|
void |
setTimestamp(int parameterIndex,
Timestamp x)
|
void |
setTimestamp(int i,
Timestamp t,
Calendar cal)
|
void |
setUnicodeStream(int parameterIndex,
InputStream x,
int length)
|
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()
|
protected boolean |
wantsHoldableResultSet()
|
protected boolean |
wantsScrollableResultSet()
|
boolean |
wasNull()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.sql.Statement |
|---|
execute, execute, execute, executeUpdate, executeUpdate, executeUpdate, getGeneratedKeys, getMoreResults, getResultSetHoldability, isClosed, isPoolable, setPoolable |
| Methods inherited from interface java.sql.Wrapper |
|---|
isWrapperFor, unwrap |
| Field Detail |
|---|
protected ArrayList batchStatements
protected ArrayList batchParameters
protected final int resultsettype
protected final int concurrency
protected int fetchdirection
protected boolean wantsGeneratedKeysOnce
public boolean wantsGeneratedKeysAlways
protected 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 Query preparedQuery
protected final ParameterList preparedParameters
protected Query lastSimpleQuery
protected int m_prepareThreshold
protected int m_useCount
protected Object[] callResult
protected int maxfieldSize
protected boolean isClosed
| Constructor Detail |
|---|
public AbstractJdbc2Statement(AbstractJdbc2Connection c,
int rsType,
int rsConcurrency)
throws SQLException
SQLException
public AbstractJdbc2Statement(AbstractJdbc2Connection connection,
String sql,
boolean isCallable,
int rsType,
int rsConcurrency)
throws SQLException
SQLException| Method Detail |
|---|
public ResultSet createDriverResultSet(Field[] fields,
Vector tuples)
throws SQLException
BaseStatement
createDriverResultSet in interface BaseStatementfields - the column metadata for the resultsettuples - the resultset data
SQLException - if something goes wrong
public abstract ResultSet createResultSet(Query originalQuery,
Field[] fields,
Vector tuples,
ResultCursor cursor)
throws SQLException
BaseStatement
createResultSet 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 StatementSQLException
public ResultSet executeQuery()
throws SQLException
SQLException
public int executeUpdate(String p_sql)
throws SQLException
executeUpdate in interface StatementSQLException
public int executeUpdate()
throws SQLException
SQLException
public boolean execute(String p_sql)
throws SQLException
execute in interface StatementSQLException
public boolean executeWithFlags(String p_sql,
int flags)
throws SQLException
BaseStatement
executeWithFlags 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
SQLException
public boolean executeWithFlags(int flags)
throws SQLException
BaseStatement
executeWithFlags 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
SQLException
protected void execute(Query queryToExecute,
ParameterList queryParameters,
int flags)
throws SQLException
SQLException
public void setCursorName(String name)
throws SQLException
setCursorName in interface StatementSQLException
public int getUpdateCount()
throws SQLException
getUpdateCount in interface StatementSQLException
public boolean getMoreResults()
throws SQLException
getMoreResults in interface StatementSQLException
public int getMaxRows()
throws SQLException
getMaxRows in interface StatementSQLException
public void setMaxRows(int max)
throws SQLException
setMaxRows in interface StatementSQLException
public void setEscapeProcessing(boolean enable)
throws SQLException
setEscapeProcessing in interface StatementSQLException
public int getQueryTimeout()
throws SQLException
getQueryTimeout in interface StatementSQLException
public void setQueryTimeout(int seconds)
throws SQLException
setQueryTimeout in interface StatementSQLExceptionpublic void addWarning(SQLWarning warn)
warn - warning to add
public SQLWarning getWarnings()
throws SQLException
getWarnings in interface StatementSQLException
public int getMaxFieldSize()
throws SQLException
getMaxFieldSize in interface StatementSQLException
public void setMaxFieldSize(int max)
throws SQLException
setMaxFieldSize in interface StatementSQLException
public void clearWarnings()
throws SQLException
clearWarnings in interface StatementSQLException
public ResultSet getResultSet()
throws SQLException
getResultSet in interface StatementSQLException
public void close()
throws SQLException
close in interface StatementSQLExceptionprotected void finalize()
finalize in class Object
protected String replaceProcessing(String p_sql)
throws SQLException
SQLException
protected static int parseSql(String p_sql,
int i,
StringBuffer 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 on
SQLException
protected 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 on
SQLException
public int getInsertedOID()
throws SQLException
SQLException
public long getLastOID()
throws SQLException
PGStatement
getLastOID in interface PGStatementSQLException
public 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
SQLException
public void registerOutParameter(int parameterIndex,
int sqlType,
int scale,
boolean setPreparedParameters)
throws SQLException
SQLException
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
SQLExceptionpublic String toString()
toString in class Object
protected void bindLiteral(int paramIndex,
String s,
int oid)
throws SQLException
SQLException
protected void checkIndex(int parameterIndex,
int type1,
int type2,
String getName)
throws SQLException
SQLException
protected void checkIndex(int parameterIndex,
int type,
String getName)
throws SQLException
SQLException
public 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 statement
SQLException - if an exception occurs while changing the thresholdpublic int getPrepareThreshold()
PGStatement
getPrepareThreshold in interface PGStatementPGStatement.setPrepareThreshold(int)
public void setUseServerPrepare(boolean flag)
throws SQLException
PGStatementsetPrepareThreshold(1).
setUseServerPrepare in interface PGStatementSQLExceptionpublic 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 PGStatement
protected void checkClosed()
throws SQLException
SQLException
public void addBatch(String p_sql)
throws SQLException
addBatch in interface StatementSQLException
public void clearBatch()
throws SQLException
clearBatch in interface StatementSQLException
public int[] executeBatch()
throws SQLException
executeBatch in interface StatementSQLException
public void cancel()
throws SQLException
cancel in interface StatementSQLException
public 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 Statement
public void setFetchDirection(int direction)
throws SQLException
setFetchDirection in interface StatementSQLException
public void setFetchSize(int rows)
throws SQLException
setFetchSize in interface StatementSQLException
public void addBatch()
throws SQLException
SQLException
public ResultSetMetaData getMetaData()
throws SQLException
SQLException
public void setArray(int i,
Array x)
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
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||