public abstract class AvaticaStatement extends Object implements Statement
Statement
for the Avatica engine.| Modifier and Type | Field and Description |
|---|---|
protected AtomicBoolean |
cancelFlag
Support for
cancel() method. |
protected boolean |
closed |
protected boolean |
closeOnCompletion
Support for
closeOnCompletion() method. |
AvaticaConnection |
connection |
static int |
DEFAULT_FETCH_SIZE
The default value for
Statement.getFetchSize(). |
Meta.StatementHandle |
handle
Statement id; unique within connection.
|
protected long |
maxRowCount |
protected AvaticaResultSet |
openResultSet
Current result set, or null if the statement is not executing anything.
|
protected long |
updateCount
Current update count.
|
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO| Modifier | Constructor and Description |
|---|---|
protected |
AvaticaStatement(AvaticaConnection connection,
Meta.StatementHandle h,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
Creates an AvaticaStatement.
|
protected |
AvaticaStatement(AvaticaConnection connection,
Meta.StatementHandle h,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability,
Meta.Signature signature) |
| Modifier and Type | Method and Description |
|---|---|
void |
addBatch(String sql) |
void |
cancel() |
protected void |
checkOpen() |
void |
clearBatch() |
void |
clearWarnings() |
protected void |
close_() |
void |
close() |
void |
closeOnCompletion() |
boolean |
execute(String sql) |
boolean |
execute(String sql,
int autoGeneratedKeys) |
boolean |
execute(String sql,
int[] columnIndexes) |
boolean |
execute(String sql,
String[] columnNames) |
int[] |
executeBatch() |
protected long[] |
executeBatchInternal()
Executes a collection of updates in a single batch RPC.
|
protected boolean |
executeInternal(Meta.Signature signature,
boolean isUpdate)
Executes a prepared statement.
|
protected void |
executeInternal(String sql) |
long[] |
executeLargeBatch() |
long |
executeLargeUpdate(String sql) |
ResultSet |
executeQuery(String sql) |
protected ResultSet |
executeQueryInternal(Meta.Signature signature,
boolean isUpdate)
Executes a prepared query, closing any previously open result set.
|
int |
executeUpdate(String sql) |
int |
executeUpdate(String sql,
int autoGeneratedKeys) |
int |
executeUpdate(String sql,
int[] columnIndexes) |
int |
executeUpdate(String sql,
String[] columnNames) |
protected List<TypedValue> |
getBoundParameterValues()
Returns a list of bound parameter values.
|
AvaticaConnection |
getConnection() |
int |
getFetchDirection() |
int |
getFetchSize() |
ResultSet |
getGeneratedKeys() |
int |
getId()
Returns the identifier of the statement, unique within its connection.
|
long |
getLargeMaxRows() |
long |
getLargeUpdateCount() |
int |
getMaxFieldSize() |
int |
getMaxRows() |
boolean |
getMoreResults() |
boolean |
getMoreResults(int current) |
protected List<TypedValue> |
getParameterValues()
Returns the list of values of this statement's parameters.
|
int |
getQueryTimeout() |
ResultSet |
getResultSet() |
int |
getResultSetConcurrency() |
int |
getResultSetHoldability() |
int |
getResultSetType() |
protected Meta.Signature |
getSignature() |
Meta.StatementType |
getStatementType() |
int |
getUpdateCount() |
SQLWarning |
getWarnings() |
boolean |
isClosed() |
boolean |
isCloseOnCompletion() |
boolean |
isPoolable() |
boolean |
isWrapperFor(Class<?> iface) |
protected void |
resetStatement() |
void |
setCursorName(String name) |
void |
setEscapeProcessing(boolean enable) |
void |
setFetchDirection(int direction) |
void |
setFetchSize(int rows) |
void |
setLargeMaxRows(long maxRowCount) |
void |
setMaxFieldSize(int max) |
void |
setMaxRows(int maxRowCount) |
void |
setPoolable(boolean poolable) |
void |
setQueryTimeout(int seconds) |
protected void |
setSignature(Meta.Signature signature) |
protected boolean |
syncResults(QueryState state,
long offset)
Re-initialize the ResultSet on the server with the given state.
|
<T> T |
unwrap(Class<T> iface) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexecuteLargeUpdate, executeLargeUpdate, executeLargeUpdatepublic static final int DEFAULT_FETCH_SIZE
Statement.getFetchSize().public final AvaticaConnection connection
public Meta.StatementHandle handle
protected boolean closed
protected final AtomicBoolean cancelFlag
cancel() method.protected boolean closeOnCompletion
closeOnCompletion() method.protected AvaticaResultSet openResultSet
protected long updateCount
openResultSet.protected long maxRowCount
protected AvaticaStatement(AvaticaConnection connection, Meta.StatementHandle h, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
connection - Connectionh - Statement handleresultSetType - Result set typeresultSetConcurrency - Result set concurrencyresultSetHoldability - Result set holdabilityprotected AvaticaStatement(AvaticaConnection connection, Meta.StatementHandle h, int resultSetType, int resultSetConcurrency, int resultSetHoldability, Meta.Signature signature)
protected void setSignature(Meta.Signature signature)
protected Meta.Signature getSignature()
public Meta.StatementType getStatementType()
public int getId()
protected void checkOpen()
throws SQLException
SQLExceptionprotected void executeInternal(String sql) throws SQLException
SQLExceptionprotected long[] executeBatchInternal()
throws SQLException
SQLExceptionprotected void resetStatement()
protected boolean syncResults(QueryState state, long offset) throws NoSuchStatementException
state - The ResultSet's state.offset - Offset into the desired ResultSetNoSuchStatementExceptionpublic boolean execute(String sql) throws SQLException
execute in interface StatementSQLExceptionpublic ResultSet executeQuery(String sql) throws SQLException
executeQuery in interface StatementSQLExceptionpublic final int executeUpdate(String sql) throws SQLException
executeUpdate in interface StatementSQLExceptionpublic long executeLargeUpdate(String sql) throws SQLException
executeLargeUpdate in interface StatementSQLExceptionpublic void close()
throws SQLException
close in interface AutoCloseableclose in interface StatementSQLExceptionprotected void close_()
public int getMaxFieldSize()
throws SQLException
getMaxFieldSize in interface StatementSQLExceptionpublic void setMaxFieldSize(int max)
throws SQLException
setMaxFieldSize in interface StatementSQLExceptionpublic final int getMaxRows()
throws SQLException
getMaxRows in interface StatementSQLExceptionpublic long getLargeMaxRows()
throws SQLException
getLargeMaxRows in interface StatementSQLExceptionpublic final void setMaxRows(int maxRowCount)
throws SQLException
setMaxRows in interface StatementSQLExceptionpublic void setLargeMaxRows(long maxRowCount)
throws SQLException
setLargeMaxRows 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 void cancel()
throws SQLException
cancel in interface StatementSQLExceptionpublic SQLWarning getWarnings() throws SQLException
getWarnings in interface StatementSQLExceptionpublic void clearWarnings()
throws SQLException
clearWarnings in interface StatementSQLExceptionpublic void setCursorName(String name) throws SQLException
setCursorName in interface StatementSQLExceptionpublic ResultSet getResultSet() throws SQLException
getResultSet in interface StatementSQLExceptionpublic int getUpdateCount()
throws SQLException
getUpdateCount in interface StatementSQLExceptionpublic long getLargeUpdateCount()
throws SQLException
getLargeUpdateCount in interface StatementSQLExceptionpublic boolean getMoreResults()
throws SQLException
getMoreResults in interface StatementSQLExceptionpublic void setFetchDirection(int direction)
throws SQLException
setFetchDirection in interface StatementSQLExceptionpublic int getFetchDirection()
throws SQLException
getFetchDirection in interface StatementSQLExceptionpublic void setFetchSize(int rows)
throws SQLException
setFetchSize in interface StatementSQLExceptionpublic int getFetchSize()
throws SQLException
getFetchSize in interface StatementSQLExceptionpublic int getResultSetConcurrency()
throws SQLException
getResultSetConcurrency in interface StatementSQLExceptionpublic int getResultSetType()
throws SQLException
getResultSetType in interface StatementSQLExceptionpublic void addBatch(String sql) throws SQLException
addBatch in interface StatementSQLExceptionpublic void clearBatch()
throws SQLException
clearBatch in interface StatementSQLExceptionpublic int[] executeBatch()
throws SQLException
executeBatch in interface StatementSQLExceptionpublic long[] executeLargeBatch()
throws SQLException
executeLargeBatch in interface StatementSQLExceptionpublic AvaticaConnection getConnection() throws SQLException
getConnection in interface StatementSQLExceptionpublic 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 boolean isClosed()
throws SQLException
isClosed in interface StatementSQLExceptionpublic void setPoolable(boolean poolable)
throws SQLException
setPoolable in interface StatementSQLExceptionpublic boolean isPoolable()
throws SQLException
isPoolable in interface StatementSQLExceptionpublic void closeOnCompletion()
throws SQLException
closeOnCompletion in interface StatementSQLExceptionpublic boolean isCloseOnCompletion()
throws SQLException
isCloseOnCompletion in interface StatementSQLExceptionpublic <T> T unwrap(Class<T> iface) throws SQLException
unwrap in interface WrapperSQLExceptionpublic boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor in interface WrapperSQLExceptionprotected boolean executeInternal(Meta.Signature signature, boolean isUpdate) throws SQLException
signature - Parsed statementisUpdate - if the execute is for an updateStatement.execute(String)SQLException - if a database error occursprotected ResultSet executeQueryInternal(Meta.Signature signature, boolean isUpdate) throws SQLException
signature - Parsed queryisUpdate - If the execute is for an updateSQLException - if a database error occursprotected List<TypedValue> getParameterValues()
Called at execute time. Not a public API.
The default implementation returns the empty list, because non-prepared statements have no parameters.
protected List<TypedValue> getBoundParameterValues() throws SQLException
If any of the parameters have not been bound, throws. If parameters have been bound to null, the value in the list is null.
SQLExceptionCopyright © 2012-2025 Apache Software Foundation. All Rights Reserved.