Top Description Fields Constructors Methods
org.h2.message

public abstract Class TraceObject

extends Object
Class Inheritance
Known Direct Subclasses
org.h2.value.ValueToObjectConverter, org.h2.value.ValueToObjectConverter2, org.h2.jdbc.JdbcArray, org.h2.jdbc.JdbcConnection, org.h2.jdbc.JdbcDatabaseMetaData, org.h2.jdbc.JdbcLob, org.h2.jdbc.JdbcParameterMetaData, org.h2.jdbc.JdbcResultSet, org.h2.jdbc.JdbcResultSetMetaData, org.h2.jdbc.JdbcSavepoint, org.h2.jdbc.JdbcStatement, org.h2.jdbcx.JdbcDataSource, org.h2.jdbcx.JdbcXAConnection, org.h2.jdbcx.JdbcXid
Imports
java.math.BigDecimal, java.sql.SQLException, java.util.Map, java.util.concurrent.atomic.AtomicIntegerArray, org.h2.api.ErrorCode, org.h2.util.StringUtils

The base class for objects that can print trace information about themselves.

Field Summary

Modifier and TypeField and Description
protected static final int
ARRAY

The trace type id for array objects.

protected static final int
BLOB

The trace type id for blobs.

protected static final int
CALLABLE_STATEMENT

The trace type id for callable statements.

protected static final int
CLOB

The trace type id for clobs.

protected static final int
CONNECTION

The trace type id for connections.

protected static final int
DATA_SOURCE

The trace type id for data sources.

protected static final int
DATABASE_META_DATA

The trace type id for database meta data objects.

private static final AtomicIntegerArray
private int
private static final int
protected static final int
PARAMETER_META_DATA

The trace type id for parameter meta data objects.

private static final String[]
protected static final int
PREPARED_STATEMENT

The trace type id for prepared statements.

protected static final int
RESULT_SET

The trace type id for result sets.

protected static final int
RESULT_SET_META_DATA

The trace type id for result set meta data objects.

protected static final int
SAVEPOINT

The trace type id for savepoint objects.

private static final SQLException
protected static final int
SQLXML

The trace type id for SQLXML objects.

protected static final int
STATEMENT

The trace type id for statements.

protected Trace
trace

The trace module used by this object.

private int
protected static final int
XA_DATA_SOURCE

The trace type id for XA data sources.

protected static final int
XID

The trace type id for transaction ids.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected final void
debugCode(String
the trace text
text
)

Write trace information in the form objectName.text.

protected final void
debugCodeAssign(String
the class name of the result
className
,
int
the prefix type
newType
,
int
the trace object id of the created object
newId
,
String
the value to assign this new object to
value
)

Write trace information as an assignment in the form className prefixId = objectName.value.

protected final void
debugCodeCall(String
the method name
methodName
)

Write trace information as a method call in the form objectName.methodName().

protected final void
debugCodeCall(String
the method name
methodName
,
long
one single long parameter
param
)

Write trace information as a method call in the form objectName.methodName(param) where the parameter is formatted as a long value.

protected final void
debugCodeCall(String
the method name
methodName
,
String
one single string parameter
param
)

Write trace information as a method call in the form objectName.methodName(param) where the parameter is formatted as a Java string.

protected static int

Returns:

the new trace object id
getNextId
(int
the object type
type
)

Get the next trace object id for this object type.

public int

Returns:

id
getTraceId
()

INTERNAL

public String

Returns:

object name
getTraceObjectName
()

INTERNAL

protected final boolean

Returns:

true if it is
isDebugEnabled
()

Check if the debug trace level is enabled.

protected final boolean

Returns:

true if it is
isInfoEnabled
()

Check if info trace level is enabled.

protected SQLException

Returns:

the SQL exception object
logAndConvert
(Throwable
the exception
ex
)

Log an exception and convert it to a SQL exception if required.

protected static String

Returns:

the Java string literal
quote
(String
the string to convert
s
)

Format a string as a Java string literal.

protected static String

Returns:

the Java source code
quoteArray
(String[]
the string array to convert
s
)

Format a string array to the Java source code that represents this object.

protected static String

Returns:

the Java source code
quoteBigDecimal
(BigDecimal
the big decimal to convert
x
)

Format a big decimal to the Java source code that represents this object.

protected static String

Returns:

the Java source code
quoteBytes
(byte[]
the byte array to convert
x
)

Format a byte array to the Java source code that represents this object.

protected static String

Returns:

the Java source code
quoteDate
(Date
the date to convert
x
)

Format a date to the Java source code that represents this object.

protected static String

Returns:

the Java source code
quoteIntArray
(int[]
the int array to convert
s
)

Format an int array to the Java source code that represents this object.

protected static String

Returns:

the Java source code
quoteMap
(Map<String, Class<?>>
the map to convert
map
)

Format a map to the Java source code that represents this object.

protected static String

Returns:

the Java source code
quoteTime
(Time
the time to convert
x
)

Format a time to the Java source code that represents this object.

protected static String

Returns:

the Java source code
quoteTimestamp
(Timestamp
the timestamp to convert
x
)

Format a timestamp to the Java source code that represents this object.

protected void
setTrace(Trace
the trace object
trace
,
int
the trace object type
type
,
int
the trace object id
id
)

Set the options to use when writing trace message.

protected SQLException

Returns:

the SQL exception
unsupported
(String
the message
message
)

Get a SQL exception meaning this feature is not supported.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ARRAYback to summary
protected static final int ARRAY

The trace type id for array objects.

BLOBback to summary
protected static final int BLOB

The trace type id for blobs.

CALLABLE_STATEMENTback to summary
protected static final int CALLABLE_STATEMENT

The trace type id for callable statements.

CLOBback to summary
protected static final int CLOB

The trace type id for clobs.

CONNECTIONback to summary
protected static final int CONNECTION

The trace type id for connections.

DATA_SOURCEback to summary
protected static final int DATA_SOURCE

The trace type id for data sources.

DATABASE_META_DATAback to summary
protected static final int DATABASE_META_DATA

The trace type id for database meta data objects.

IDback to summary
private static final AtomicIntegerArray ID
idback to summary
private int id
LASTback to summary
private static final int LAST
PARAMETER_META_DATAback to summary
protected static final int PARAMETER_META_DATA

The trace type id for parameter meta data objects.

PREFIXback to summary
private static final String[] PREFIX
PREPARED_STATEMENTback to summary
protected static final int PREPARED_STATEMENT

The trace type id for prepared statements.

RESULT_SETback to summary
protected static final int RESULT_SET

The trace type id for result sets.

RESULT_SET_META_DATAback to summary
protected static final int RESULT_SET_META_DATA

The trace type id for result set meta data objects.

SAVEPOINTback to summary
protected static final int SAVEPOINT

The trace type id for savepoint objects.

SQL_OOMEback to summary
private static final SQLException SQL_OOME
SQLXMLback to summary
protected static final int SQLXML

The trace type id for SQLXML objects.

STATEMENTback to summary
protected static final int STATEMENT

The trace type id for statements.

traceback to summary
protected Trace trace

The trace module used by this object.

traceTypeback to summary
private int traceType
XA_DATA_SOURCEback to summary
protected static final int XA_DATA_SOURCE

The trace type id for XA data sources.

XIDback to summary
protected static final int XID

The trace type id for transaction ids.

Constructor Detail

TraceObjectback to summary
public TraceObject()

Method Detail

debugCodeback to summary
protected final void debugCode(String text)

Write trace information in the form objectName.text.

Parameters
text:String

the trace text

debugCodeAssignback to summary
protected final void debugCodeAssign(String className, int newType, int newId, String value)

Write trace information as an assignment in the form className prefixId = objectName.value.

Parameters
className:String

the class name of the result

newType:int

the prefix type

newId:int

the trace object id of the created object

value:String

the value to assign this new object to

debugCodeCallback to summary
protected final void debugCodeCall(String methodName)

Write trace information as a method call in the form objectName.methodName().

Parameters
methodName:String

the method name

debugCodeCallback to summary
protected final void debugCodeCall(String methodName, long param)

Write trace information as a method call in the form objectName.methodName(param) where the parameter is formatted as a long value.

Parameters
methodName:String

the method name

param:long

one single long parameter

debugCodeCallback to summary
protected final void debugCodeCall(String methodName, String param)

Write trace information as a method call in the form objectName.methodName(param) where the parameter is formatted as a Java string.

Parameters
methodName:String

the method name

param:String

one single string parameter

getNextIdback to summary
protected static int getNextId(int type)

Get the next trace object id for this object type.

Parameters
type:int

the object type

Returns:int

the new trace object id

getTraceIdback to summary
public int getTraceId()

INTERNAL

Returns:int

id

getTraceObjectNameback to summary
public String getTraceObjectName()

INTERNAL

Returns:String

object name

isDebugEnabledback to summary
protected final boolean isDebugEnabled()

Check if the debug trace level is enabled.

Returns:boolean

true if it is

isInfoEnabledback to summary
protected final boolean isInfoEnabled()

Check if info trace level is enabled.

Returns:boolean

true if it is

logAndConvertback to summary
protected SQLException logAndConvert(Throwable ex)

Log an exception and convert it to a SQL exception if required.

Parameters
ex:Throwable

the exception

Returns:SQLException

the SQL exception object

quoteback to summary
protected static String quote(String s)

Format a string as a Java string literal.

Parameters
s:String

the string to convert

Returns:String

the Java string literal

quoteArrayback to summary
protected static String quoteArray(String[] s)

Format a string array to the Java source code that represents this object.

Parameters
s:String[]

the string array to convert

Returns:String

the Java source code

quoteBigDecimalback to summary
protected static String quoteBigDecimal(BigDecimal x)

Format a big decimal to the Java source code that represents this object.

Parameters
x:BigDecimal

the big decimal to convert

Returns:String

the Java source code

quoteBytesback to summary
protected static String quoteBytes(byte[] x)

Format a byte array to the Java source code that represents this object.

Parameters
x:byte[]

the byte array to convert

Returns:String

the Java source code

quoteDateback to summary
protected static String quoteDate(Date x)

Format a date to the Java source code that represents this object.

Parameters
x:Date

the date to convert

Returns:String

the Java source code

quoteIntArrayback to summary
protected static String quoteIntArray(int[] s)

Format an int array to the Java source code that represents this object.

Parameters
s:int[]

the int array to convert

Returns:String

the Java source code

quoteMapback to summary
protected static String quoteMap(Map<String, Class<?>> map)

Format a map to the Java source code that represents this object.

Parameters
map:Map<String, Class<?>>

the map to convert

Returns:String

the Java source code

quoteTimeback to summary
protected static String quoteTime(Time x)

Format a time to the Java source code that represents this object.

Parameters
x:Time

the time to convert

Returns:String

the Java source code

quoteTimestampback to summary
protected static String quoteTimestamp(Timestamp x)

Format a timestamp to the Java source code that represents this object.

Parameters
x:Timestamp

the timestamp to convert

Returns:String

the Java source code

setTraceback to summary
protected void setTrace(Trace trace, int type, int id)

Set the options to use when writing trace message.

Parameters
trace:Trace

the trace object

type:int

the trace object type

id:int

the trace object id

unsupportedback to summary
protected SQLException unsupported(String message)

Get a SQL exception meaning this feature is not supported.

Parameters
message:String

the message

Returns:SQLException

the SQL exception