public class SimonStatement extends java.lang.Object implements java.sql.Statement
Statement
Modifier and Type | Field and Description |
---|---|
protected java.util.List<java.lang.String> |
batchSql
List of batched SQL statements.
|
protected java.sql.Connection |
conn
SQL connection.
|
protected java.lang.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 java.lang.String |
sqlCmdLabel
SQL statement label containing part up to the SQL command type.
|
protected SqlNormalizer |
sqlNormalizer
SQL normalizer helper object.
|
Modifier and Type | Method and Description |
---|---|
void |
addBatch(java.lang.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(java.lang.String sql)
Measure and execute SQL operation.
|
boolean |
execute(java.lang.String sql,
int autoGeneratedKeys)
Measure and execute SQL operation.
|
boolean |
execute(java.lang.String sql,
int[] columnIndexes)
Measure and execute SQL operation.
|
boolean |
execute(java.lang.String sql,
java.lang.String[] columnNames)
Measure and execute SQL operation.
|
int[] |
executeBatch()
Measure and execute SQL operation.
|
java.sql.ResultSet |
executeQuery(java.lang.String sql)
Measure and execute SQL operation.
|
int |
executeUpdate(java.lang.String sql)
Measure and execute SQL operation.
|
int |
executeUpdate(java.lang.String sql,
int autoGeneratedKeys)
Measure and execute SQL operation.
|
int |
executeUpdate(java.lang.String sql,
int[] columnIndexes)
Measure and execute SQL operation.
|
int |
executeUpdate(java.lang.String sql,
java.lang.String[] columnNames)
Measure and execute SQL operation.
|
protected void |
finish(Split split)
Called after each SQL command execution.
|
java.sql.Connection |
getConnection()
Returns a connection object (simon impl.).
|
int |
getFetchDirection() |
int |
getFetchSize() |
java.sql.ResultSet |
getGeneratedKeys() |
int |
getMaxFieldSize() |
int |
getMaxRows() |
boolean |
getMoreResults() |
boolean |
getMoreResults(int i) |
int |
getQueryTimeout() |
java.sql.ResultSet |
getResultSet() |
int |
getResultSetConcurrency() |
int |
getResultSetHoldability() |
int |
getResultSetType() |
int |
getUpdateCount() |
java.sql.SQLWarning |
getWarnings() |
boolean |
isClosed() |
boolean |
isCloseOnCompletion() |
boolean |
isPoolable() |
boolean |
isWrapperFor(java.lang.Class<?> aClass) |
protected Split |
prepare(java.util.List<java.lang.String> sqls)
Called before each SQL command execution.
|
protected Split |
prepare(java.lang.String sql)
Called before each SQL command execution.
|
void |
setCursorName(java.lang.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(java.lang.Class<T> tClass) |
protected final java.util.List<java.lang.String> batchSql
protected java.sql.Connection conn
protected java.lang.String prefix
protected java.lang.String sqlCmdLabel
protected SqlNormalizer sqlNormalizer
public final void close() throws java.sql.SQLException
close
in interface java.lang.AutoCloseable
close
in interface java.sql.Statement
java.sql.SQLException
- if real operation failspublic final java.sql.Connection getConnection()
getConnection
in interface java.sql.Statement
protected final Split prepare(java.lang.String sql)
Stopwatch Simon
for measure SQL operation.sql
- sql command for executionprotected final Split prepare(java.util.List<java.lang.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 java.sql.ResultSet executeQuery(java.lang.String sql) throws java.sql.SQLException
executeQuery
in interface java.sql.Statement
sql
- sql commandjava.sql.SQLException
- if real calls failsSimonResultSet
public final int executeUpdate(java.lang.String sql) throws java.sql.SQLException
executeUpdate
in interface java.sql.Statement
sql
- sql commandjava.sql.SQLException
- if real calls failspublic final int executeUpdate(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLException
executeUpdate
in interface java.sql.Statement
sql
- sql commandautoGeneratedKeys
- autoGeneratedKeys flagjava.sql.SQLException
- if real calls failspublic final int executeUpdate(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLException
executeUpdate
in interface java.sql.Statement
sql
- sql commandcolumnIndexes
- an array of column indexes indicating the columns that should be
returned from the inserted rowjava.sql.SQLException
- if real calls failspublic final int executeUpdate(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLException
executeUpdate
in interface java.sql.Statement
sql
- sql commandcolumnNames
- an array of column indexes indicating the columns that should be
returned from the inserted rowjava.sql.SQLException
- if real calls failspublic final boolean execute(java.lang.String sql) throws java.sql.SQLException
execute
in interface java.sql.Statement
sql
- sql commandtrue
if the first result is a ResultSet
object;
false
if it is an update count or there are no resultsjava.sql.SQLException
- if real calls failspublic final boolean execute(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLException
execute
in interface java.sql.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 resultsjava.sql.SQLException
- if real calls failspublic final boolean execute(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLException
execute
in interface java.sql.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 resultsjava.sql.SQLException
- if real calls failspublic final boolean execute(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLException
execute
in interface java.sql.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 resultsjava.sql.SQLException
- if real calls failspublic final void addBatch(java.lang.String s) throws java.sql.SQLException
addBatch
in interface java.sql.Statement
s
- sql commandjava.sql.SQLException
- if real calls failspublic int[] executeBatch() throws java.sql.SQLException
executeBatch
in interface java.sql.Statement
java.sql.SQLException
- if real calls failspublic void clearBatch() throws java.sql.SQLException
clearBatch
in interface java.sql.Statement
java.sql.SQLException
- if real calls failspublic final int getMaxFieldSize() throws java.sql.SQLException
getMaxFieldSize
in interface java.sql.Statement
java.sql.SQLException
public final void setMaxFieldSize(int i) throws java.sql.SQLException
setMaxFieldSize
in interface java.sql.Statement
java.sql.SQLException
public final int getMaxRows() throws java.sql.SQLException
getMaxRows
in interface java.sql.Statement
java.sql.SQLException
public final void setMaxRows(int i) throws java.sql.SQLException
setMaxRows
in interface java.sql.Statement
java.sql.SQLException
public final void setEscapeProcessing(boolean b) throws java.sql.SQLException
setEscapeProcessing
in interface java.sql.Statement
java.sql.SQLException
public final int getQueryTimeout() throws java.sql.SQLException
getQueryTimeout
in interface java.sql.Statement
java.sql.SQLException
public final void setQueryTimeout(int i) throws java.sql.SQLException
setQueryTimeout
in interface java.sql.Statement
java.sql.SQLException
public final void cancel() throws java.sql.SQLException
cancel
in interface java.sql.Statement
java.sql.SQLException
public final java.sql.SQLWarning getWarnings() throws java.sql.SQLException
getWarnings
in interface java.sql.Statement
java.sql.SQLException
public final void clearWarnings() throws java.sql.SQLException
clearWarnings
in interface java.sql.Statement
java.sql.SQLException
public final void setCursorName(java.lang.String s) throws java.sql.SQLException
setCursorName
in interface java.sql.Statement
java.sql.SQLException
public final java.sql.ResultSet getResultSet() throws java.sql.SQLException
getResultSet
in interface java.sql.Statement
java.sql.SQLException
public final int getUpdateCount() throws java.sql.SQLException
getUpdateCount
in interface java.sql.Statement
java.sql.SQLException
public final boolean getMoreResults() throws java.sql.SQLException
getMoreResults
in interface java.sql.Statement
java.sql.SQLException
public final void setFetchDirection(int i) throws java.sql.SQLException
setFetchDirection
in interface java.sql.Statement
java.sql.SQLException
public final int getFetchDirection() throws java.sql.SQLException
getFetchDirection
in interface java.sql.Statement
java.sql.SQLException
public final void setFetchSize(int i) throws java.sql.SQLException
setFetchSize
in interface java.sql.Statement
java.sql.SQLException
public final int getFetchSize() throws java.sql.SQLException
getFetchSize
in interface java.sql.Statement
java.sql.SQLException
public final int getResultSetConcurrency() throws java.sql.SQLException
getResultSetConcurrency
in interface java.sql.Statement
java.sql.SQLException
public final int getResultSetType() throws java.sql.SQLException
getResultSetType
in interface java.sql.Statement
java.sql.SQLException
public final boolean getMoreResults(int i) throws java.sql.SQLException
getMoreResults
in interface java.sql.Statement
java.sql.SQLException
public final java.sql.ResultSet getGeneratedKeys() throws java.sql.SQLException
getGeneratedKeys
in interface java.sql.Statement
java.sql.SQLException
public final int getResultSetHoldability() throws java.sql.SQLException
getResultSetHoldability
in interface java.sql.Statement
java.sql.SQLException
public final boolean isClosed() throws java.sql.SQLException
isClosed
in interface java.sql.Statement
java.sql.SQLException
public final void setPoolable(boolean b) throws java.sql.SQLException
setPoolable
in interface java.sql.Statement
java.sql.SQLException
public final boolean isPoolable() throws java.sql.SQLException
isPoolable
in interface java.sql.Statement
java.sql.SQLException
public void closeOnCompletion() throws java.sql.SQLException
closeOnCompletion
in interface java.sql.Statement
java.sql.SQLException
public boolean isCloseOnCompletion() throws java.sql.SQLException
isCloseOnCompletion
in interface java.sql.Statement
java.sql.SQLException
public final <T> T unwrap(java.lang.Class<T> tClass) throws java.sql.SQLException
unwrap
in interface java.sql.Wrapper
java.sql.SQLException
public final boolean isWrapperFor(java.lang.Class<?> aClass) throws java.sql.SQLException
isWrapperFor
in interface java.sql.Wrapper
java.sql.SQLException
Copyright © 2018. All Rights Reserved.