public class PicodataStatement extends Object implements Statement
Modifier and Type | Class and Description |
---|---|
class |
PicodataStatement.StatementResultHandler
Provides extension point for handling the statement execution results.
|
Modifier and Type | Field and Description |
---|---|
protected PicodataConnection |
connection
Picodata server connection.
|
protected org.postgresql.jdbc.ResultWrapper |
firstUnclosedResult
The first unclosed result.
|
protected org.postgresql.jdbc.ResultWrapper |
generatedKeys
Results returned by a statement that wants generated keys.
|
protected ReentrantReadWriteLock |
lock
Lock for concurent operations on this statement and last operation result.
|
protected Statement |
pgStatement
pgJDBC prepared statement.
|
protected org.postgresql.jdbc.ResultWrapper |
result
The current results.
|
protected boolean |
wantsGeneratedKeysOnce
Does the caller of execute/executeUpdate want generated keys for this execution?
|
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(String sql) |
void |
cancel() |
protected void |
checkClosed()
Check that this statement is not closed
|
protected void |
checkNoResultUpdate()
Check that last operation didn't return any rows.
|
void |
clearBatch() |
void |
clearWarnings() |
void |
close() |
void |
closeOnCompletion() |
ResultSet |
createDriverResultSet(org.postgresql.core.Field[] fields,
List<org.postgresql.core.Tuple> tuples)
Create a new partially initialized ResultSet from its parts.
|
ResultSet |
createResultSet(org.postgresql.core.Query originalQuery,
org.postgresql.core.Field[] fields,
List<org.postgresql.core.Tuple> tuples,
org.postgresql.core.ResultCursor cursor)
Create a new ResultSet from its parts.
|
protected void |
execute(org.postgresql.core.CachedQuery cachedQuery,
org.postgresql.core.ParameterList queryParameters,
int flags)
Execute cached query with parameters in pgJDBC query executor.
|
boolean |
execute(String 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(String sql) |
long |
executeLargeUpdate(String sql,
int autoGeneratedKeys) |
long |
executeLargeUpdate(String sql,
int[] columnIndexes) |
long |
executeLargeUpdate(String sql,
String[] columnNames) |
ResultSet |
executeQuery(String sql) |
int |
executeUpdate(String sql) |
int |
executeUpdate(String sql,
int autoGeneratedKeys) |
int |
executeUpdate(String sql,
int[] columnIndexes) |
int |
executeUpdate(String sql,
String[] columnNames) |
protected boolean |
executeWithFlags(org.postgresql.core.CachedQuery simpleQuery,
int flags)
Execute cached query in pgJDBC query executor.
|
protected boolean |
executeWithFlags(String sql,
int flags)
Cache and execute query in pgJDBC query executor.
|
Connection |
getConnection() |
int |
getFetchDirection() |
int |
getFetchSize() |
ResultSet |
getGeneratedKeys() |
long |
getLargeMaxRows() |
int |
getMaxFieldSize() |
int |
getMaxRows() |
boolean |
getMoreResults() |
boolean |
getMoreResults(int current) |
int |
getQueryTimeout() |
ResultSet |
getResultSet() |
int |
getResultSetConcurrency() |
int |
getResultSetHoldability() |
int |
getResultSetType() |
protected ResultSet |
getSingleResultSet()
Check if the last query returned a single result set, and return it.
|
int |
getUpdateCount() |
SQLWarning |
getWarnings() |
boolean |
isClosed() |
boolean |
isCloseOnCompletion() |
protected boolean |
isOneShotQuery(org.postgresql.core.CachedQuery cachedQuery)
Returns true if query is unlikely to be reused.
|
boolean |
isPoolable() |
boolean |
isWrapperFor(Class<?> iface) |
void |
setCursorName(String name) |
void |
setEscapeProcessing(boolean enable) |
void |
setFetchDirection(int direction) |
void |
setFetchSize(int rows) |
void |
setLargeMaxRows(long max) |
void |
setMaxFieldSize(int max) |
void |
setMaxRows(int max) |
void |
setPoolable(boolean poolable) |
void |
setQueryTimeout(int seconds) |
<T> T |
unwrap(Class<T> iface) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLargeUpdateCount
protected final PicodataConnection connection
protected final Statement pgStatement
protected final ReentrantReadWriteLock lock
protected volatile org.postgresql.jdbc.ResultWrapper result
protected volatile org.postgresql.jdbc.ResultWrapper firstUnclosedResult
protected volatile org.postgresql.jdbc.ResultWrapper generatedKeys
protected volatile boolean wantsGeneratedKeysOnce
public void addBatch(String 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 SQLWarning getWarnings() throws SQLException
getWarnings
in interface Statement
SQLException
public void clearWarnings() throws SQLException
clearWarnings
in interface Statement
SQLException
public void closeOnCompletion() throws SQLException
closeOnCompletion
in interface Statement
SQLException
public boolean isCloseOnCompletion() throws SQLException
isCloseOnCompletion
in interface Statement
SQLException
public final void close() throws SQLException
close
in interface AutoCloseable
close
in interface Statement
SQLException
public boolean isClosed() throws SQLException
isClosed
in interface Statement
SQLException
protected void checkClosed() throws SQLException
SQLException
- if the statement is closedprotected boolean isOneShotQuery(org.postgresql.core.CachedQuery cachedQuery)
cachedQuery
- to check (null if current query)protected final void execute(org.postgresql.core.CachedQuery cachedQuery, org.postgresql.core.ParameterList queryParameters, int flags) throws SQLException
cachedQuery
- cached queryqueryParameters
- prepared parameters for substitution in the queryflags
- internal execution flagsSQLException
- if the connection to Picodata server is closed or other error occuredprotected boolean executeWithFlags(String sql, int flags) throws SQLException
sql
- SQL queryflags
- internal execution flagsSQLException
- if the connection to Picodata server is closed or other error occuredprotected boolean executeWithFlags(org.postgresql.core.CachedQuery simpleQuery, int flags) throws SQLException
simpleQuery
- cached queryflags
- internal execution flagsSQLException
- if the connection to Picodata server is closed or other error occuredprotected final void checkNoResultUpdate() throws SQLException
SQLException
- if rows were returned or the connection to Picodata server is closed
or other error occuredpublic boolean execute(String sql) throws SQLException
execute
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 executeUpdate(String sql) throws SQLException
executeUpdate
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 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
protected ResultSet getSingleResultSet() throws SQLException
SQLException
- if last result is empty of contains many rowspublic ResultSet executeQuery(String sql) throws SQLException
executeQuery
in interface Statement
SQLException
public Connection getConnection() throws SQLException
getConnection
in interface Statement
SQLException
public void setEscapeProcessing(boolean enable) throws SQLException
setEscapeProcessing
in interface Statement
SQLException
public int getFetchDirection() throws SQLException
getFetchDirection
in interface Statement
SQLException
public void setFetchDirection(int direction) throws SQLException
setFetchDirection
in interface Statement
SQLException
public int getFetchSize() throws SQLException
getFetchSize
in interface Statement
SQLException
public void setFetchSize(int rows) throws SQLException
setFetchSize
in interface Statement
SQLException
public ResultSet getGeneratedKeys() throws SQLException
getGeneratedKeys
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 int getMaxRows() throws SQLException
getMaxRows
in interface Statement
SQLException
public void setMaxRows(int max) throws SQLException
setMaxRows
in interface Statement
SQLException
public boolean getMoreResults() throws SQLException
getMoreResults
in interface Statement
SQLException
public boolean getMoreResults(int current) throws SQLException
getMoreResults
in interface Statement
SQLException
public long getLargeMaxRows() throws SQLException
getLargeMaxRows
in interface Statement
SQLException
public void setLargeMaxRows(long max) throws SQLException
setLargeMaxRows
in interface Statement
SQLException
public ResultSet getResultSet() throws SQLException
getResultSet
in interface Statement
SQLException
public int getResultSetConcurrency() throws SQLException
getResultSetConcurrency
in interface Statement
SQLException
public int getResultSetHoldability() throws SQLException
getResultSetHoldability
in interface Statement
SQLException
public int getResultSetType() throws SQLException
getResultSetType
in interface Statement
SQLException
public void setPoolable(boolean poolable) throws SQLException
setPoolable
in interface Statement
SQLException
public boolean isPoolable() throws SQLException
isPoolable
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 void setCursorName(String name) throws SQLException
setCursorName
in interface Statement
SQLException
public int getUpdateCount() throws SQLException
getUpdateCount
in interface Statement
SQLException
public ResultSet createResultSet(org.postgresql.core.Query originalQuery, org.postgresql.core.Field[] fields, List<org.postgresql.core.Tuple> tuples, org.postgresql.core.ResultCursor cursor) throws SQLException
originalQuery
- original parsed SQL queryfields
- result set columnstuples
- result set rowscursor
- initial result set cursor stateSQLException
- if the connection to Picodata server is closed or other error occuredpublic ResultSet createDriverResultSet(org.postgresql.core.Field[] fields, List<org.postgresql.core.Tuple> tuples) throws SQLException
fields
- result set columnstuples
- result set rowsSQLException
- if the connection to Picodata server is closed or other error occuredpublic 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
Copyright © 2025 Picodata. All rights reserved.