Package com.pyranid
Class StatementLog
java.lang.Object
com.pyranid.StatementLog
- All Implemented Interfaces:
Serializable
A collection of SQL statement execution diagnostics.
Created via builder, for example
StatementLog statementLog = StatementLog.forSql("SELECT * FROM car WHERE id=?").parameters(singletonList(123)).build();
- Since:
- 1.0.0
- Author:
- Mark Allen
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionThe size of the batch operation.How long did it take to acquire aConnection
from theDataSource
, in nanoseconds?boolean
The exception that occurred during SQL statement execution.How long did it take to execute the SQL statement, in nanoseconds?static StatementLog.Builder
Creates aStatementLog
builder for the givensql
.int
hashCode()
The parameters bound to the SQL statement that was executed.How long did it take to bind data to thePreparedStatement
, in nanoseconds?How long did it take to extract data from theResultSet
, in nanoseconds?sql()
The SQL statement that was executed.The metadata associated with this SQL statement.toString()
How long did it take to perform the database operation in total?
-
Method Details
-
toString
-
equals
-
hashCode
-
forSql
Creates aStatementLog
builder for the givensql
.- Parameters:
sql
- the SQL statement- Returns:
- a
StatementLog
builder
-
connectionAcquisitionTime
How long did it take to acquire aConnection
from theDataSource
, in nanoseconds?- Returns:
- how long it took to acquire a
Connection
, if available
-
preparationTime
How long did it take to bind data to thePreparedStatement
, in nanoseconds?- Returns:
- how long it took to bind data to the
PreparedStatement
, if available
-
executionTime
How long did it take to execute the SQL statement, in nanoseconds?- Returns:
- how long it took to execute the SQL statement, if available
-
resultSetMappingTime
How long did it take to extract data from theResultSet
, in nanoseconds?- Returns:
- how long it took to extract data from the
ResultSet
, if available
-
totalTime
How long did it take to perform the database operation in total?This is the sum of
connectionAcquisitionTime()
+preparationTime()
+executionTime()
+resultSetMappingTime()
.- Returns:
- how long the database operation took in total
-
sql
The SQL statement that was executed.- Returns:
- the SQL statement that was executed.
-
parameters
The parameters bound to the SQL statement that was executed.- Returns:
- the parameters bound to the SQL statement that was executed, or an empty
List
if none
-
batchSize
The size of the batch operation.- Returns:
- how many records were processed as part of the batch operation, if available
-
exception
The exception that occurred during SQL statement execution.- Returns:
- the exception that occurred during SQL statement execution, if available
-
statementMetadata
The metadata associated with this SQL statement.- Returns:
- he metadata associated with this SQL statement, if available
-