public abstract class AvaticaStatement extends Object implements Statement
Statement
for the Avatica engine.| Modifier and Type | Field and Description |
|---|---|
protected boolean |
closed |
protected boolean |
closeOnCompletion
Support for
closeOnCompletion() method. |
AvaticaConnection |
connection |
static int |
DEFAULT_FETCH_SIZE
The default value for
Statement.getFetchSize(). |
private int |
fetchDirection |
private int |
fetchSize |
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.
|
private int |
queryTimeoutMillis |
(package private) int |
resultSetConcurrency |
(package private) int |
resultSetHoldability |
(package private) int |
resultSetType |
private Meta.Signature |
signature |
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() |
private void |
checkNotPreparedOrCallable(String s) |
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 boolean |
executeInternal(Meta.Signature signature)
Executes a prepared statement.
|
protected void |
executeInternal(String sql) |
long |
executeLargeUpdate(String sql) |
ResultSet |
executeQuery(String sql) |
protected ResultSet |
executeQueryInternal(Meta.Signature signature)
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() |
(package private) int |
getQueryTimeoutMillis() |
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) |
(package private) void |
onResultSetClose(ResultSet resultSet)
Called by each child result set when it is closed.
|
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) |
(package private) void |
setQueryTimeoutMillis(int millis) |
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) |
public static final int DEFAULT_FETCH_SIZE
Statement.getFetchSize().public final AvaticaConnection connection
public Meta.StatementHandle handle
protected boolean closed
protected boolean closeOnCompletion
closeOnCompletion() method.protected AvaticaResultSet openResultSet
protected long updateCount
openResultSet.private int queryTimeoutMillis
final int resultSetType
final int resultSetConcurrency
final int resultSetHoldability
private int fetchSize
private int fetchDirection
protected long maxRowCount
private Meta.Signature signature
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()
private void checkNotPreparedOrCallable(String s) throws SQLException
SQLExceptionprotected void executeInternal(String sql) 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
SQLExceptionpublic 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()
getMaxRows in interface Statementpublic long getLargeMaxRows()
public final void setMaxRows(int maxRowCount)
throws SQLException
setMaxRows in interface StatementSQLExceptionpublic void setLargeMaxRows(long maxRowCount)
throws SQLException
SQLExceptionpublic void setEscapeProcessing(boolean enable)
throws SQLException
setEscapeProcessing in interface StatementSQLExceptionpublic int getQueryTimeout()
throws SQLException
getQueryTimeout in interface StatementSQLExceptionint getQueryTimeoutMillis()
public void setQueryTimeout(int seconds)
throws SQLException
setQueryTimeout in interface StatementSQLExceptionvoid setQueryTimeoutMillis(int millis)
public 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
SQLExceptionpublic boolean getMoreResults()
throws SQLException
getMoreResults in interface StatementSQLExceptionpublic void setFetchDirection(int direction)
throws SQLException
setFetchDirection in interface StatementSQLExceptionpublic int getFetchDirection()
getFetchDirection in interface Statementpublic void setFetchSize(int rows)
throws SQLException
setFetchSize in interface StatementSQLExceptionpublic int getFetchSize()
getFetchSize in interface Statementpublic 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 AvaticaConnection getConnection()
getConnection in interface Statementpublic 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) throws SQLException
signature - Parsed statementStatement.execute(String)SQLException - if a database error occursprotected ResultSet executeQueryInternal(Meta.Signature signature) throws SQLException
signature - Parsed querySQLException - if a database error occursvoid onResultSetClose(ResultSet resultSet)
resultSet - Result set or cell setprotected 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–2016 The Apache Software Foundation. All rights reserved.