Top Description Inners Fields Constructors Methods
org.h2.tools

public Class ConvertTraceFile

extends Tool
Class Inheritance
Imports
java.io.IOException, .LineNumberReader, .PrintWriter, java.sql.SQLException, java.util.ArrayList, .Collections, .HashMap, .StringTokenizer, org.h2.message.DbException, org.h2.store.fs.FileUtils, org.h2.util.IOUtils, .StringUtils, .Tool

Converts a .trace.db file to a SQL script and Java source code. SQL statement statistics are listed as well.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
ConvertTraceFile.Stat

This class holds statistics about a SQL statement.

Field Summary

Modifier and TypeField and Description
private final HashMap<String, ConvertTraceFile.Stat>
private long
Inherited from org.h2.util.Tool:
out

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
addToStats(String sql, int resultCount, long time)

private void
convertFile(String traceFileName, String javaClassName, String script)

Converts a trace file to a Java class file and a script file.

public static void
main(String...
the command line arguments
args
)

Options are case sensitive.

private static String
padNumberLeft(long number, int digits)

private static String
public void
runTool(String...
the argument list
args
)

Implements abstract org.h2.util.Tool.runTool.

Run the tool with the given output stream and arguments.

Inherited from org.h2.util.Tool:
getMainClassNameisOptionprintNoDatabaseFilesFoundsetOutshowUsageshowUsageAndThrowUnsupportedOptionthrowUnsupportedOption

Field Detail

statsback to summary
private final HashMap<String, ConvertTraceFile.Stat> stats
timeTotalback to summary
private long timeTotal

Constructor Detail

ConvertTraceFileback to summary
public ConvertTraceFile()

Method Detail

addToStatsback to summary
private void addToStats(String sql, int resultCount, long time)
convertFileback to summary
private void convertFile(String traceFileName, String javaClassName, String script) throws IOException

Converts a trace file to a Java class file and a script file.

mainback to summary
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:String[]

the command line arguments

Exceptions
SQLException:
on failure
padNumberLeftback to summary
private static String padNumberLeft(long number, int digits)
removeNewlinesback to summary
private static String removeNewlines(String s)
runToolback to summary
public void runTool(String... args) throws SQLException

Implements abstract org.h2.util.Tool.runTool.

Doc from org.h2.util.Tool.runTool.

Run the tool with the given output stream and arguments.

Parameters
args:String[]

the argument list

Annotations
@Override
Exceptions
SQLException:
on failure
org.h2.tools back to summary

pack-priv Class ConvertTraceFile.Stat

extends Object
implements Comparable<ConvertTraceFile.Stat>
Class Inheritance
All Implemented Interfaces
java.lang.Comparable

This class holds statistics about a SQL statement.

Field Summary

Modifier and TypeField and Description
pack-priv int
pack-priv long
pack-priv String
pack-priv long

Constructor Summary

AccessConstructor and Description
pack-priv
Stat()

Method Summary

Modifier and TypeMethod and Description
public int
compareTo(ConvertTraceFile.Stat
the object to be compared.
other
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

executeCountback to summary
pack-priv int executeCount
resultCountback to summary
pack-priv long resultCount
sqlback to summary
pack-priv String sql
timeback to summary
pack-priv long time

Constructor Detail

Statback to summary
pack-priv Stat()

Method Detail

compareToback to summary
public int compareTo(ConvertTraceFile.Stat other)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
other:ConvertTraceFile.Stat

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Annotations
@Override