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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
ConvertTraceFile.Stat
This class holds statistics about a SQL statement.
-
Field Summary
Fields Modifier and Type Field Description private java.util.HashMap<java.lang.String,ConvertTraceFile.Stat>
stats
private long
timeTotal
-
Constructor Summary
Constructors Constructor Description ConvertTraceFile()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addToStats(java.lang.String sql, int resultCount, long time)
private void
convertFile(java.lang.String traceFileName, java.lang.String javaClassName, java.lang.String script)
Converts a trace file to a Java class file and a script file.static void
main(java.lang.String... args)
Options are case sensitive.private static java.lang.String
padNumberLeft(long number, int digits)
private static java.lang.String
removeNewlines(java.lang.String s)
void
runTool(java.lang.String... args)
Run the tool with the given output stream and arguments.-
Methods inherited from class org.h2.util.Tool
isOption, printNoDatabaseFilesFound, setOut, showUsage, showUsageAndThrowUnsupportedOption, throwUnsupportedOption
-
-
-
-
Field Detail
-
stats
private final java.util.HashMap<java.lang.String,ConvertTraceFile.Stat> stats
-
timeTotal
private long timeTotal
-
-
Method Detail
-
main
public static void main(java.lang.String... args) throws java.sql.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:
java.sql.SQLException
- on failure
-
runTool
public void runTool(java.lang.String... args) throws java.sql.SQLException
Description copied from class:Tool
Run the tool with the given output stream and arguments.
-
convertFile
private void convertFile(java.lang.String traceFileName, java.lang.String javaClassName, java.lang.String script) throws java.io.IOException
Converts a trace file to a Java class file and a script file.- Throws:
java.io.IOException
-
removeNewlines
private static java.lang.String removeNewlines(java.lang.String s)
-
padNumberLeft
private static java.lang.String padNumberLeft(long number, int digits)
-
addToStats
private void addToStats(java.lang.String sql, int resultCount, long time)
-
-