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 AutoCloseable
close
in interface Statement
SQLException
- if real operation failspublic final Connection getConnection()
getConnection
in interface Statement
protected 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 Statement
sql
- sql commandSQLException
- if real calls failsSimonResultSet
public final int executeUpdate(String sql) throws SQLException
executeUpdate
in interface Statement
sql
- sql commandSQLException
- if real calls failspublic final int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException
executeUpdate
in interface Statement
sql
- sql commandautoGeneratedKeys
- autoGeneratedKeys flagSQLException
- if real calls failspublic final int executeUpdate(String sql, int[] columnIndexes) throws SQLException
executeUpdate
in interface Statement
sql
- 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 Statement
sql
- 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 Statement
sql
- 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 Statement
sql
- 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 Statement
sql
- 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 Statement
sql
- 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 Statement
s
- sql commandSQLException
- if real calls failspublic int[] executeBatch() throws SQLException
executeBatch
in interface Statement
SQLException
- if real calls failspublic void clearBatch() throws SQLException
clearBatch
in interface Statement
SQLException
- if real calls failspublic final int getMaxFieldSize() throws SQLException
getMaxFieldSize
in interface Statement
SQLException
public final void setMaxFieldSize(int i) throws SQLException
setMaxFieldSize
in interface Statement
SQLException
public final int getMaxRows() throws SQLException
getMaxRows
in interface Statement
SQLException
public final void setMaxRows(int i) throws SQLException
setMaxRows
in interface Statement
SQLException
public final void setEscapeProcessing(boolean b) throws SQLException
setEscapeProcessing
in interface Statement
SQLException
public final int getQueryTimeout() throws SQLException
getQueryTimeout
in interface Statement
SQLException
public final void setQueryTimeout(int i) throws SQLException
setQueryTimeout
in interface Statement
SQLException
public final void cancel() throws SQLException
cancel
in interface Statement
SQLException
public final SQLWarning getWarnings() throws SQLException
getWarnings
in interface Statement
SQLException
public final void clearWarnings() throws SQLException
clearWarnings
in interface Statement
SQLException
public final void setCursorName(String s) throws SQLException
setCursorName
in interface Statement
SQLException
public final ResultSet getResultSet() throws SQLException
getResultSet
in interface Statement
SQLException
public final int getUpdateCount() throws SQLException
getUpdateCount
in interface Statement
SQLException
public final boolean getMoreResults() throws SQLException
getMoreResults
in interface Statement
SQLException
public final void setFetchDirection(int i) throws SQLException
setFetchDirection
in interface Statement
SQLException
public final int getFetchDirection() throws SQLException
getFetchDirection
in interface Statement
SQLException
public final void setFetchSize(int i) throws SQLException
setFetchSize
in interface Statement
SQLException
public final int getFetchSize() throws SQLException
getFetchSize
in interface Statement
SQLException
public final int getResultSetConcurrency() throws SQLException
getResultSetConcurrency
in interface Statement
SQLException
public final int getResultSetType() throws SQLException
getResultSetType
in interface Statement
SQLException
public final boolean getMoreResults(int i) throws SQLException
getMoreResults
in interface Statement
SQLException
public final ResultSet getGeneratedKeys() throws SQLException
getGeneratedKeys
in interface Statement
SQLException
public final int getResultSetHoldability() throws SQLException
getResultSetHoldability
in interface Statement
SQLException
public final boolean isClosed() throws SQLException
isClosed
in interface Statement
SQLException
public final void setPoolable(boolean b) throws SQLException
setPoolable
in interface Statement
SQLException
public final 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 final <T> T unwrap(Class<T> tClass) throws SQLException
unwrap
in interface Wrapper
SQLException
public final boolean isWrapperFor(Class<?> aClass) throws SQLException
isWrapperFor
in interface Wrapper
SQLException
Copyright © 2019. All rights reserved.