Class StatementHistory

java.lang.Object
org.tentackle.dbms.StatementHistory

public class StatementHistory extends Object
History of statement execution.
Author:
harald
  • Constructor Details

    • StatementHistory

      public StatementHistory(StatementWrapper statement, String sql)
      Creates a statement execution history.
      Parameters:
      statement - the executed statement
      sql - optional SQL string if statement does not provide it
  • Method Details

    • setLogMinDurationMillis

      public static void setLogMinDurationMillis(long logMinDurationMillis)
      Sets the duration of statements to be logged as a warning.
      Parameters:
      logMinDurationMillis - the duration in milliseconds, 0 to disable (default)
    • getLogMinDurationMillis

      public static long getLogMinDurationMillis()
      Gets the duration of statements to be logged as a warning.
      Returns:
      the duration in milliseconds
    • end

      public void end()
      Sets the execution end.
    • getExecutionStart

      public long getExecutionStart()
      Gets the start of execution in epochal milliseconds.
      Returns:
      the start
    • getExecutionDuration

      public org.tentackle.misc.TimeKeeper getExecutionDuration()
      Gets the duration of the statement execution.
      Returns:
      the duration, never null
    • applyFetch

      public void applyFetch(org.tentackle.misc.TimeKeeper fetchDuration, int fetchCount)
      Applies the fetch duration and number of rows fetched if statement is a query.
      Parameters:
      fetchDuration - the fetch duration
      fetchCount - the number of rows fetched
    • getFetchDuration

      public org.tentackle.misc.TimeKeeper getFetchDuration()
      Gets the duration to fetch the result from a query statement.
      Returns:
      the duration, null if not a query
    • getFetchCount

      public int getFetchCount()
      Gets the number of rows fetched from the result set.
      Returns:
      the fetched rows (only valid if statement was a query)
      See Also:
    • getTxName

      public String getTxName()
      Gets the transaction name.
      Returns:
      the tx name, null if none or no transaction
    • getParameters

      public Map<Integer,Object> getParameters()
      Gets the parameter map.
      Returns:
      the parameters, null if not a prepared statement
    • getBatchParameters

      public List<Map<Integer,Object>> getBatchParameters()
      Gets the batched parameter map.
      Returns:
      the batched parameter, null if not batched or not a prepared statement
    • getSql

      public String getSql()
      Gets the sql string.
      Returns:
      the sql string
    • toString

      public String toString()
      Overrides:
      toString in class Object