org.objectweb.cjdbc.driver.protocol
Class TypeTag

java.lang.Object
  extended byorg.objectweb.cjdbc.driver.protocol.TypeTag

public final class TypeTag
extends java.lang.Object

This class implements protocol type tags with an internal String, but offers an abstract interface on top of it in order to be transparently substituted some day (with enums for instance).

Advantages of using string types is human-readability (debugging, trace analysis, etc.) and earlier detection in case of protocol corruption. Drawback maybe a small performance cost.

Check "the importance of being textual" - by Eric S. Raymond. http://www.faqs.org/docs/artu/ch05s01.html

Version:
1.0
Author:
Marc Herbert

Field Summary
static TypeTag BACKEND_EXCEPTION
          Constant for an exception
static TypeTag BIGDECIMAL
          Constant for a SQL/Java type
static TypeTag BLOB
          Constant for a SQL/Java type
static TypeTag BOOLEAN
          Constant for a SQL/Java type
static TypeTag BYTE_ARRAY
          Constant for a SQL/Java type
static TypeTag CLOB
          Constant for a SQL/Java type
static TypeTag COL_TYPES
          Constant for a SQL structure
static TypeTag CONTROLLER_READY
          Constant for internal protocol data
static TypeTag CORE_EXCEPTION
          Constant for an exception
static TypeTag DOUBLE
          Constant for a SQL/Java type
static TypeTag EXCEPTION
          Constant for an exception
static TypeTag FIELD
          Constant for a SQL structure
static TypeTag FLOAT
          Constant for a SQL/Java type
static TypeTag INTEGER
          Constant for a SQL/Java type
private  java.lang.String internalString
           
static TypeTag LONG
          Constant for a SQL/Java type
static TypeTag NOT_EXCEPTION
          used when there is no type ambiguity; no need to type
static TypeTag NULL_RESULTSET
          Null ResultSet
static TypeTag RESULTSET
          Constant for a SQL structure
static TypeTag ROW
          Constant for a SQL structure
static TypeTag SQL_DATE
          Constant for a SQL/Java type
static TypeTag SQL_TIME
          Constant for a SQL/Java type
static TypeTag SQL_TIMESTAMP
          Constant for a SQL/Java type
static TypeTag STRING
          Constant for a SQL/Java type
private static java.lang.String TPREFIX
          Actual Types ***
static TypeTag TYPE_ERROR
          Constant for a SQL/Java type
 
Constructor Summary
  TypeTag(CJDBCInputStream in)
          Read/deserialize/construct a TypeTag from a stream.
private TypeTag(java.lang.String init)
           
 
Method Summary
 boolean equals(java.lang.Object o)
          Deprecated.  
 boolean equals(TypeTag b)
          Compares two TypeTags.
static TypeTag jdbcToJavaObjectType(int jdbcType)
          Gives the standard JDBC type to Java Object type conversion according to table "JDBC type to Java Object Type" of the JDBC reference book.
 void sendToStream(CJDBCOutputStream out)
          Serialize "this" tag on the stream.
 java.lang.String toSring()
          Returns a string representation, useful for logging and debugging.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

internalString

private java.lang.String internalString

TPREFIX

private static final java.lang.String TPREFIX
Actual Types ***

See Also:
Constant Field Values

TYPE_ERROR

public static final TypeTag TYPE_ERROR
Constant for a SQL/Java type


STRING

public static final TypeTag STRING
Constant for a SQL/Java type


BIGDECIMAL

public static final TypeTag BIGDECIMAL
Constant for a SQL/Java type


BOOLEAN

public static final TypeTag BOOLEAN
Constant for a SQL/Java type


INTEGER

public static final TypeTag INTEGER
Constant for a SQL/Java type


LONG

public static final TypeTag LONG
Constant for a SQL/Java type


FLOAT

public static final TypeTag FLOAT
Constant for a SQL/Java type


DOUBLE

public static final TypeTag DOUBLE
Constant for a SQL/Java type


BYTE_ARRAY

public static final TypeTag BYTE_ARRAY
Constant for a SQL/Java type


SQL_DATE

public static final TypeTag SQL_DATE
Constant for a SQL/Java type


SQL_TIME

public static final TypeTag SQL_TIME
Constant for a SQL/Java type


SQL_TIMESTAMP

public static final TypeTag SQL_TIMESTAMP
Constant for a SQL/Java type


CLOB

public static final TypeTag CLOB
Constant for a SQL/Java type


BLOB

public static final TypeTag BLOB
Constant for a SQL/Java type


RESULTSET

public static final TypeTag RESULTSET
Constant for a SQL structure


NULL_RESULTSET

public static final TypeTag NULL_RESULTSET
Null ResultSet


FIELD

public static final TypeTag FIELD
Constant for a SQL structure


COL_TYPES

public static final TypeTag COL_TYPES
Constant for a SQL structure


ROW

public static final TypeTag ROW
Constant for a SQL structure


NOT_EXCEPTION

public static final TypeTag NOT_EXCEPTION
used when there is no type ambiguity; no need to type


EXCEPTION

public static final TypeTag EXCEPTION
Constant for an exception


BACKEND_EXCEPTION

public static final TypeTag BACKEND_EXCEPTION
Constant for an exception


CORE_EXCEPTION

public static final TypeTag CORE_EXCEPTION
Constant for an exception


CONTROLLER_READY

public static final TypeTag CONTROLLER_READY
Constant for internal protocol data

Constructor Detail

TypeTag

private TypeTag(java.lang.String init)

TypeTag

public TypeTag(CJDBCInputStream in)
        throws java.io.IOException
Read/deserialize/construct a TypeTag from a stream.

Parameters:
in - input stream
Throws:
java.io.IOException - stream error
Method Detail

sendToStream

public void sendToStream(CJDBCOutputStream out)
                  throws java.io.IOException
Serialize "this" tag on the stream.

Parameters:
out - output stream
Throws:
java.io.IOException - stream error

equals

public boolean equals(java.lang.Object o)
Deprecated.  

Calling this method is a bug, check the type of your argument.

Parameters:
o - compared object (which should be a TypeTag!)
Returns:
a buggy result
See Also:
Object.equals(java.lang.Object)

equals

public boolean equals(TypeTag b)
Compares two TypeTags.

Parameters:
b - compared TypeTag
Returns:
true if same value

toSring

public java.lang.String toSring()
Returns a string representation, useful for logging and debugging.

Returns:
string representation of the tag

jdbcToJavaObjectType

public static TypeTag jdbcToJavaObjectType(int jdbcType)
Gives the standard JDBC type to Java Object type conversion according to table "JDBC type to Java Object Type" of the JDBC reference book. (Table 47.9.3 in 2nd Edition, table 50.3 in 3rd edition). This is the conversion that the getObject() method of every JDBC driver should perform by default.

Parameters:
jdbcType - the JDBC type to convert
Returns:
the Java Object type resulting from the standard type conversion.
See Also:
Types


Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.