Package org.h2.tools

Class ConvertTraceFile

java.lang.Object
org.h2.util.Tool
org.h2.tools.ConvertTraceFile

public class ConvertTraceFile extends Tool
Converts a .trace.db file to a SQL script and Java source code. SQL statement statistics are listed as well.
  • Field Details

  • Constructor Details

    • ConvertTraceFile

      public ConvertTraceFile()
  • Method Details

    • main

      public static void main(String... args) throws SQLException
      Options are case sensitive.
      Supported options
      [-help] or [-?] Print the list of options
      [-traceFile <file>] The trace file name (default: test.trace.db)
      [-script <file>] The script file name (default: test.sql)
      [-javaClass <file>] The Java directory and class file name (default: Test)
      Parameters:
      args - the command line arguments
      Throws:
      SQLException - on failure
    • runTool

      public void runTool(String... args) throws SQLException
      Description copied from class: Tool
      Run the tool with the given output stream and arguments.
      Specified by:
      runTool in class Tool
      Parameters:
      args - the argument list
      Throws:
      SQLException - on failure
    • convertFile

      private void convertFile(String traceFileName, String javaClassName, String script) throws IOException
      Converts a trace file to a Java class file and a script file.
      Throws:
      IOException
    • removeNewlines

      private static String removeNewlines(String s)
    • padNumberLeft

      private static String padNumberLeft(long number, int digits)
    • addToStats

      private void addToStats(String sql, int resultCount, long time)