Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.derby.impl.sql.compile
Class CLOBTypeCompiler  view CLOBTypeCompiler download CLOBTypeCompiler.java

java.lang.Object
  extended byorg.apache.derby.impl.sql.compile.BaseTypeCompiler
      extended byorg.apache.derby.impl.sql.compile.CLOBTypeCompiler
All Implemented Interfaces:
org.apache.derby.iapi.sql.compile.TypeCompiler

public class CLOBTypeCompiler
extends BaseTypeCompiler

This class implements TypeCompiler for the SQL LOB types.


Field Summary
 
Fields inherited from interface org.apache.derby.iapi.sql.compile.TypeCompiler
AVG_OP, BOOLEAN_MAXWIDTH_AS_CHAR, DEFAULT_DECIMAL_PRECISION, DEFAULT_DECIMAL_SCALE, DIVIDE_OP, DOUBLE_MAXWIDTH_AS_CHAR, INT_MAXWIDTH_AS_CHAR, LONGINT_MAXWIDTH_AS_CHAR, MAX_DECIMAL_PRECISION_SCALE, MINUS_OP, MOD_OP, PLUS_OP, REAL_MAXWIDTH_AS_CHAR, SMALLINT_MAXWIDTH_AS_CHAR, SUM_OP, TIMES_OP, TINYINT_MAXWIDTH_AS_CHAR
 
Constructor Summary
CLOBTypeCompiler()
           
 
Method Summary
 boolean comparable(org.apache.derby.iapi.types.TypeId otherType, boolean forEquals, org.apache.derby.iapi.services.loader.ClassFactory cf)
          Tell whether this type (LOB) can be compared to the given type.
 boolean compatible(org.apache.derby.iapi.types.TypeId otherType)
          Tell whether this type (CLOB) is compatible with the given type.
 boolean convertible(org.apache.derby.iapi.types.TypeId otherType, boolean forDataTypeFunction)
          Tell whether this type (LOB) can be converted to the given type.
protected  java.lang.String dataValueMethodName()
          Return the method name to get a Derby DataValueDescriptor object of the correct type.
 void generateDataValue(org.apache.derby.iapi.services.compiler.MethodBuilder mb, org.apache.derby.iapi.services.compiler.LocalField field)
          Generate the code necessary to produce a SQL value based on a value.
 void generateNull(org.apache.derby.iapi.services.compiler.MethodBuilder mb)
          Generate the code necessary to produce a SQL null of the appropriate type.
 int getCastToCharWidth(org.apache.derby.iapi.types.DataTypeDescriptor dts)
          Return the maximum width for this data type when cast to a char type.
 java.lang.String getCorrespondingPrimitiveTypeName()
          Get the name of the corresponding Java type.
 java.lang.String getMatchingNationalCharTypeName()
          Get the name of the matching national char type.
 java.lang.String getPrimitiveMethodName()
          Get the method name for getting out the corresponding primitive Java type.
protected  int getStoredFormatIdFromTypeId()
          Get the StoredFormatId from the corresponding TypeId.
protected  org.apache.derby.iapi.sql.compile.TypeCompiler getTypeCompiler(org.apache.derby.iapi.types.TypeId typeId)
          Get the TypeCompiler that corresponds to the given TypeId.
protected  org.apache.derby.iapi.types.TypeId getTypeId()
          Get the TypeId that corresponds to this TypeCompiler.
 java.lang.String interfaceName()
          Get the name of the interface for this type.
protected  java.lang.String nullMethodName()
           
 boolean numberComparable(org.apache.derby.iapi.types.TypeId otherType, boolean forEquals, org.apache.derby.iapi.services.loader.ClassFactory cf)
          Tell whether this numeric type can be compared to the given type.
 boolean numberConvertible(org.apache.derby.iapi.types.TypeId otherType, boolean forDataTypeFunction)
          Tell whether this numeric type can be converted to the given type.
 boolean numberStorable(org.apache.derby.iapi.types.TypeId thisType, org.apache.derby.iapi.types.TypeId otherType, org.apache.derby.iapi.services.loader.ClassFactory cf)
          Tell whether this numeric type can be stored into from the given type.
 org.apache.derby.iapi.types.DataTypeDescriptor resolveArithmeticOperation(org.apache.derby.iapi.types.DataTypeDescriptor leftType, org.apache.derby.iapi.types.DataTypeDescriptor rightType, java.lang.String operator)
          Type resolution methods on binary operators
(package private)  void setTypeId(org.apache.derby.iapi.types.TypeId typeId)
          Set the TypeCompiler that corresponds to the given TypeId.
 boolean storable(org.apache.derby.iapi.types.TypeId otherType, org.apache.derby.iapi.services.loader.ClassFactory cf)
          Tell whether this type (LOB) can be stored into from the given type.
protected  boolean userTypeStorable(org.apache.derby.iapi.types.TypeId thisType, org.apache.derby.iapi.types.TypeId otherType, org.apache.derby.iapi.services.loader.ClassFactory cf)
          Determine whether thisType is storable in otherType due to otherType being a user type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CLOBTypeCompiler

public CLOBTypeCompiler()
Method Detail

comparable

public boolean comparable(org.apache.derby.iapi.types.TypeId otherType,
                          boolean forEquals,
                          org.apache.derby.iapi.services.loader.ClassFactory cf)
Tell whether this type (LOB) can be compared to the given type. Clobs are not comparable.


convertible

public boolean convertible(org.apache.derby.iapi.types.TypeId otherType,
                           boolean forDataTypeFunction)
Tell whether this type (LOB) can be converted to the given type.


compatible

public boolean compatible(org.apache.derby.iapi.types.TypeId otherType)
Tell whether this type (CLOB) is compatible with the given type.


storable

public boolean storable(org.apache.derby.iapi.types.TypeId otherType,
                        org.apache.derby.iapi.services.loader.ClassFactory cf)
Tell whether this type (LOB) can be stored into from the given type.


interfaceName

public java.lang.String interfaceName()
Description copied from interface: org.apache.derby.iapi.sql.compile.TypeCompiler
Get the name of the interface for this type. For example, the interface for a SQLInteger is NumberDataValue. The full path name of the type is returned.


getCorrespondingPrimitiveTypeName

public java.lang.String getCorrespondingPrimitiveTypeName()
Description copied from interface: org.apache.derby.iapi.sql.compile.TypeCompiler
Get the name of the corresponding Java type. For numerics and booleans we will get the corresponding Java primitive type. e Each SQL type has a corresponding Java type. When a SQL value is passed to a Java method, it is translated to its corresponding Java type. For example, a SQL Integer will be mapped to a Java int, but a SQL date will be mapped to a java.sql.Date.


getMatchingNationalCharTypeName

public java.lang.String getMatchingNationalCharTypeName()
Description copied from interface: org.apache.derby.iapi.sql.compile.TypeCompiler
Get the name of the matching national char type.

Specified by:
getMatchingNationalCharTypeName in interface org.apache.derby.iapi.sql.compile.TypeCompiler
Overrides:
getMatchingNationalCharTypeName in class BaseTypeCompiler

getCastToCharWidth

public int getCastToCharWidth(org.apache.derby.iapi.types.DataTypeDescriptor dts)
Description copied from interface: org.apache.derby.iapi.sql.compile.TypeCompiler
Return the maximum width for this data type when cast to a char type.


nullMethodName

protected java.lang.String nullMethodName()
Specified by:
nullMethodName in class BaseTypeCompiler

dataValueMethodName

protected java.lang.String dataValueMethodName()
Description copied from class: BaseTypeCompiler
Return the method name to get a Derby DataValueDescriptor object of the correct type. This implementation returns "getDataValue".

Overrides:
dataValueMethodName in class BaseTypeCompiler

getPrimitiveMethodName

public java.lang.String getPrimitiveMethodName()
Get the method name for getting out the corresponding primitive Java type.

Specified by:
getPrimitiveMethodName in interface org.apache.derby.iapi.sql.compile.TypeCompiler

resolveArithmeticOperation

public org.apache.derby.iapi.types.DataTypeDescriptor resolveArithmeticOperation(org.apache.derby.iapi.types.DataTypeDescriptor leftType,
                                                                                 org.apache.derby.iapi.types.DataTypeDescriptor rightType,
                                                                                 java.lang.String operator)
                                                                          throws org.apache.derby.iapi.error.StandardException
Description copied from interface: org.apache.derby.iapi.sql.compile.TypeCompiler
Type resolution methods on binary operators

Specified by:
resolveArithmeticOperation in interface org.apache.derby.iapi.sql.compile.TypeCompiler

generateNull

public void generateNull(org.apache.derby.iapi.services.compiler.MethodBuilder mb)
Description copied from interface: org.apache.derby.iapi.sql.compile.TypeCompiler
Generate the code necessary to produce a SQL null of the appropriate type. The stack must contain a DataValueFactory and a null or a value of the correct type (interfaceName()).

Specified by:
generateNull in interface org.apache.derby.iapi.sql.compile.TypeCompiler

generateDataValue

public void generateDataValue(org.apache.derby.iapi.services.compiler.MethodBuilder mb,
                              org.apache.derby.iapi.services.compiler.LocalField field)
Description copied from interface: org.apache.derby.iapi.sql.compile.TypeCompiler
Generate the code necessary to produce a SQL value based on a value. The value's type is assumed to match the type of this TypeId. For example, a TypeId for the SQL int type should be given an value that evaluates to a Java int or Integer. If the type of the value is incorrect, the generated code will not work. The stack must contain data value factory value

Specified by:
generateDataValue in interface org.apache.derby.iapi.sql.compile.TypeCompiler

userTypeStorable

protected boolean userTypeStorable(org.apache.derby.iapi.types.TypeId thisType,
                                   org.apache.derby.iapi.types.TypeId otherType,
                                   org.apache.derby.iapi.services.loader.ClassFactory cf)
Determine whether thisType is storable in otherType due to otherType being a user type.


numberComparable

public boolean numberComparable(org.apache.derby.iapi.types.TypeId otherType,
                                boolean forEquals,
                                org.apache.derby.iapi.services.loader.ClassFactory cf)
Tell whether this numeric type can be compared to the given type.


numberConvertible

public boolean numberConvertible(org.apache.derby.iapi.types.TypeId otherType,
                                 boolean forDataTypeFunction)
Tell whether this numeric type can be converted to the given type.


numberStorable

public boolean numberStorable(org.apache.derby.iapi.types.TypeId thisType,
                              org.apache.derby.iapi.types.TypeId otherType,
                              org.apache.derby.iapi.services.loader.ClassFactory cf)
Tell whether this numeric type can be stored into from the given type.


getTypeId

protected org.apache.derby.iapi.types.TypeId getTypeId()
Get the TypeId that corresponds to this TypeCompiler.


getTypeCompiler

protected org.apache.derby.iapi.sql.compile.TypeCompiler getTypeCompiler(org.apache.derby.iapi.types.TypeId typeId)
Get the TypeCompiler that corresponds to the given TypeId.


setTypeId

void setTypeId(org.apache.derby.iapi.types.TypeId typeId)
Set the TypeCompiler that corresponds to the given TypeId.


getStoredFormatIdFromTypeId

protected int getStoredFormatIdFromTypeId()
Get the StoredFormatId from the corresponding TypeId.