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, wait
executeLargeUpdate, executeLargeUpdate, executeLargeUpdate
public 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
SQLException
protected void executeInternal(String sql) throws SQLException
SQLException
protected long[] executeBatchInternal() throws SQLException
SQLException
protected void resetStatement()
protected boolean syncResults(QueryState state, long offset) throws NoSuchStatementException
state
- The ResultSet's state.offset
- Offset into the desired ResultSetNoSuchStatementException
public boolean execute(String sql) throws SQLException
execute
in interface Statement
SQLException
public ResultSet executeQuery(String sql) throws SQLException
executeQuery
in interface Statement
SQLException
public final int executeUpdate(String sql) throws SQLException
executeUpdate
in interface Statement
SQLException
public long executeLargeUpdate(String sql) throws SQLException
executeLargeUpdate
in interface Statement
SQLException
public void close() throws SQLException
close
in interface AutoCloseable
close
in interface Statement
SQLException
protected void close_()
public int getMaxFieldSize() throws SQLException
getMaxFieldSize
in interface Statement
SQLException
public void setMaxFieldSize(int max) throws SQLException
setMaxFieldSize
in interface Statement
SQLException
public final int getMaxRows() throws SQLException
getMaxRows
in interface Statement
SQLException
public long getLargeMaxRows() throws SQLException
getLargeMaxRows
in interface Statement
SQLException
public final void setMaxRows(int maxRowCount) throws SQLException
setMaxRows
in interface Statement
SQLException
public void setLargeMaxRows(long maxRowCount) throws SQLException
setLargeMaxRows
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 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 setCursorName(String name) throws SQLException
setCursorName
in interface Statement
SQLException
public ResultSet getResultSet() throws SQLException
getResultSet
in interface Statement
SQLException
public int getUpdateCount() throws SQLException
getUpdateCount
in interface Statement
SQLException
public long getLargeUpdateCount() throws SQLException
getLargeUpdateCount
in interface Statement
SQLException
public boolean getMoreResults() throws SQLException
getMoreResults
in interface Statement
SQLException
public void setFetchDirection(int direction) throws SQLException
setFetchDirection
in interface Statement
SQLException
public int getFetchDirection() throws SQLException
getFetchDirection
in interface Statement
SQLException
public void setFetchSize(int rows) throws SQLException
setFetchSize
in interface Statement
SQLException
public int getFetchSize() throws SQLException
getFetchSize
in interface Statement
SQLException
public int getResultSetConcurrency() throws SQLException
getResultSetConcurrency
in interface Statement
SQLException
public int getResultSetType() throws SQLException
getResultSetType
in interface Statement
SQLException
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 long[] executeLargeBatch() throws SQLException
executeLargeBatch
in interface Statement
SQLException
public AvaticaConnection getConnection() throws SQLException
getConnection
in interface Statement
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 boolean isClosed() throws SQLException
isClosed
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 void closeOnCompletion() throws SQLException
closeOnCompletion
in interface Statement
SQLException
public boolean isCloseOnCompletion() throws SQLException
isCloseOnCompletion
in interface Statement
SQLException
public <T> T unwrap(Class<T> iface) throws SQLException
unwrap
in interface Wrapper
SQLException
public boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor
in interface Wrapper
SQLException
protected 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.
SQLException
Copyright © 2012-2024 Apache Software Foundation. All Rights Reserved.