public class SimonStatement extends Object implements Statement
Statement| Modifier and Type | Field and Description |
|---|---|
protected List<String> |
batchSql
List of batched SQL statements.
|
protected Connection |
conn
SQL connection.
|
protected String |
prefix
Hierarchy prefix for JDBC Simons.
|
protected Split |
split
Stopwatch split measuring the lifespan of the statement until it is closed across all executes.
|
protected String |
sqlCmdLabel
SQL statement label containing part up to the SQL command type.
|
protected SqlNormalizer |
sqlNormalizer
SQL normalizer helper object.
|
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 s)
Adds given SQL command into batch list of sql and also into real batch.
|
void |
cancel() |
void |
clearBatch()
Clears batch sql list and real batch too.
|
void |
clearWarnings() |
void |
close()
Closes real statement, stops lifespan Simon and decrease active Simon.
|
void |
closeOnCompletion() |
boolean |
execute(String sql)
Measure and execute SQL operation.
|
boolean |
execute(String sql,
int autoGeneratedKeys)
Measure and execute SQL operation.
|
boolean |
execute(String sql,
int[] columnIndexes)
Measure and execute SQL operation.
|
boolean |
execute(String sql,
String[] columnNames)
Measure and execute SQL operation.
|
int[] |
executeBatch()
Measure and execute SQL operation.
|
ResultSet |
executeQuery(String sql)
Measure and execute SQL operation.
|
int |
executeUpdate(String sql)
Measure and execute SQL operation.
|
int |
executeUpdate(String sql,
int autoGeneratedKeys)
Measure and execute SQL operation.
|
int |
executeUpdate(String sql,
int[] columnIndexes)
Measure and execute SQL operation.
|
int |
executeUpdate(String sql,
String[] columnNames)
Measure and execute SQL operation.
|
protected void |
finish(Split split)
Called after each SQL command execution.
|
Connection |
getConnection()
Returns a connection object (simon impl.).
|
int |
getFetchDirection() |
int |
getFetchSize() |
ResultSet |
getGeneratedKeys() |
int |
getMaxFieldSize() |
int |
getMaxRows() |
boolean |
getMoreResults() |
boolean |
getMoreResults(int i) |
int |
getQueryTimeout() |
ResultSet |
getResultSet() |
int |
getResultSetConcurrency() |
int |
getResultSetHoldability() |
int |
getResultSetType() |
int |
getUpdateCount() |
SQLWarning |
getWarnings() |
boolean |
isClosed() |
boolean |
isCloseOnCompletion() |
boolean |
isPoolable() |
boolean |
isWrapperFor(Class<?> aClass) |
protected Split |
prepare(List<String> sqls)
Called before each SQL command execution.
|
protected Split |
prepare(String sql)
Called before each SQL command execution.
|
void |
setCursorName(String s) |
void |
setEscapeProcessing(boolean b) |
void |
setFetchDirection(int i) |
void |
setFetchSize(int i) |
void |
setMaxFieldSize(int i) |
void |
setMaxRows(int i) |
void |
setPoolable(boolean b) |
void |
setQueryTimeout(int i) |
protected Split |
startSplit()
Starts the split for the SQL specific stopwatch, sets the note and returns the split.
|
<T> T |
unwrap(Class<T> tClass) |
protected Connection conn
protected String sqlCmdLabel
protected SqlNormalizer sqlNormalizer
public final void close() throws SQLException
close in interface AutoCloseableclose in interface StatementSQLException - if real operation failspublic final Connection getConnection()
getConnection in interface Statementprotected final Split prepare(String sql)
Stopwatch Simon
for measure SQL operation.sql - sql command for executionprotected final Split prepare(List<String> sqls)
Stopwatch Simon
for measure bach SQL operations.sqls - list of sql commandsprotected Split startSplit()
protected final void finish(Split split)
prepare(String)),
also adds time to SQL command type Simon and sets human readable SQL cmd as note.split - started Stopwatch splitpublic final ResultSet executeQuery(String sql) throws SQLException
executeQuery in interface Statementsql - sql commandSQLException - if real calls failsSimonResultSetpublic final int executeUpdate(String sql) throws SQLException
executeUpdate in interface Statementsql - sql commandSQLException - if real calls failspublic final int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException
executeUpdate in interface Statementsql - sql commandautoGeneratedKeys - autoGeneratedKeys flagSQLException - if real calls failspublic final int executeUpdate(String sql, int[] columnIndexes) throws SQLException
executeUpdate in interface Statementsql - sql commandcolumnIndexes - an array of column indexes indicating the columns that should be
returned from the inserted rowSQLException - if real calls failspublic final int executeUpdate(String sql, String[] columnNames) throws SQLException
executeUpdate in interface Statementsql - sql commandcolumnNames - an array of column indexes indicating the columns that should be
returned from the inserted rowSQLException - if real calls failspublic final boolean execute(String sql) throws SQLException
execute in interface Statementsql - sql commandtrue if the first result is a ResultSet object;
false if it is an update count or there are no resultsSQLException - if real calls failspublic final boolean execute(String sql, int autoGeneratedKeys) throws SQLException
execute in interface Statementsql - sql commandautoGeneratedKeys - autoGeneratedKeys flagtrue if the first result is a ResultSet object;
false if it is an update count or there are no resultsSQLException - if real calls failspublic final boolean execute(String sql, int[] columnIndexes) throws SQLException
execute in interface Statementsql - sql commandcolumnIndexes - an array of column indexes indicating the columns that should be
returned from the inserted rowtrue if the first result is a ResultSet object;
false if it is an update count or there are no resultsSQLException - if real calls failspublic final boolean execute(String sql, String[] columnNames) throws SQLException
execute in interface Statementsql - sql commandcolumnNames - an array of column indexes indicating the columns that should be
returned from the inserted rowtrue if the first result is a ResultSet object;
false if it is an update count or there are no resultsSQLException - if real calls failspublic final void addBatch(String s) throws SQLException
addBatch in interface Statements - sql commandSQLException - if real calls failspublic int[] executeBatch() throws SQLException
executeBatch in interface StatementSQLException - if real calls failspublic void clearBatch() throws SQLException
clearBatch in interface StatementSQLException - if real calls failspublic final int getMaxFieldSize() throws SQLException
getMaxFieldSize in interface StatementSQLExceptionpublic final void setMaxFieldSize(int i) throws SQLException
setMaxFieldSize in interface StatementSQLExceptionpublic final int getMaxRows() throws SQLException
getMaxRows in interface StatementSQLExceptionpublic final void setMaxRows(int i) throws SQLException
setMaxRows in interface StatementSQLExceptionpublic final void setEscapeProcessing(boolean b) throws SQLException
setEscapeProcessing in interface StatementSQLExceptionpublic final int getQueryTimeout() throws SQLException
getQueryTimeout in interface StatementSQLExceptionpublic final void setQueryTimeout(int i) throws SQLException
setQueryTimeout in interface StatementSQLExceptionpublic final void cancel() throws SQLException
cancel in interface StatementSQLExceptionpublic final SQLWarning getWarnings() throws SQLException
getWarnings in interface StatementSQLExceptionpublic final void clearWarnings() throws SQLException
clearWarnings in interface StatementSQLExceptionpublic final void setCursorName(String s) throws SQLException
setCursorName in interface StatementSQLExceptionpublic final ResultSet getResultSet() throws SQLException
getResultSet in interface StatementSQLExceptionpublic final int getUpdateCount() throws SQLException
getUpdateCount in interface StatementSQLExceptionpublic final boolean getMoreResults() throws SQLException
getMoreResults in interface StatementSQLExceptionpublic final void setFetchDirection(int i) throws SQLException
setFetchDirection in interface StatementSQLExceptionpublic final int getFetchDirection() throws SQLException
getFetchDirection in interface StatementSQLExceptionpublic final void setFetchSize(int i) throws SQLException
setFetchSize in interface StatementSQLExceptionpublic final int getFetchSize() throws SQLException
getFetchSize in interface StatementSQLExceptionpublic final int getResultSetConcurrency() throws SQLException
getResultSetConcurrency in interface StatementSQLExceptionpublic final int getResultSetType() throws SQLException
getResultSetType in interface StatementSQLExceptionpublic final boolean getMoreResults(int i) throws SQLException
getMoreResults in interface StatementSQLExceptionpublic final ResultSet getGeneratedKeys() throws SQLException
getGeneratedKeys in interface StatementSQLExceptionpublic final int getResultSetHoldability() throws SQLException
getResultSetHoldability in interface StatementSQLExceptionpublic final boolean isClosed() throws SQLException
isClosed in interface StatementSQLExceptionpublic final void setPoolable(boolean b) throws SQLException
setPoolable in interface StatementSQLExceptionpublic final boolean isPoolable() throws SQLException
isPoolable in interface StatementSQLExceptionpublic void closeOnCompletion() throws SQLException
closeOnCompletion in interface StatementSQLExceptionpublic boolean isCloseOnCompletion() throws SQLException
isCloseOnCompletion in interface StatementSQLExceptionpublic final <T> T unwrap(Class<T> tClass) throws SQLException
unwrap in interface WrapperSQLExceptionpublic final boolean isWrapperFor(Class<?> aClass) throws SQLException
isWrapperFor in interface WrapperSQLExceptionCopyright © 2019. All rights reserved.