org.apache.derby.iapi.types
Class SQLNationalChar

java.lang.Object
  extended byorg.apache.derby.iapi.types.DataType
      extended byorg.apache.derby.iapi.types.SQLChar
          extended byorg.apache.derby.iapi.types.SQLNationalChar
All Implemented Interfaces:
CloneableObject, ConcatableDataValue, DataValueDescriptor, java.io.Externalizable, Formatable, Orderable, java.io.Serializable, Storable, StreamStorable, StringDataValue, TypedFormat, VariableSizeDataValue

public class SQLNationalChar
extends SQLChar

SQLNationalChar satisfies the DataValueDescriptor interfaces (i.e., OrderableDataType). It implements an String holder, e.g. for storing a column value; it can be specified when constructed to not allow nulls. Nullability cannot be changed after construction.

Because OrderableDataType is a subclass of DataType, SQLNationalChar can play a role in either a DataType/ValueRow or a OrderableDataType/KeyRow, interchangeably.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.derby.iapi.types.SQLChar
arg_passer, RETURN_SPACE_THRESHOLD, stream
 
Fields inherited from interface org.apache.derby.iapi.types.StringDataValue
BOTH, LEADING, TRAILING
 
Fields inherited from interface org.apache.derby.iapi.types.Orderable
ORDER_OP_EQUALS, ORDER_OP_GREATEROREQUALS, ORDER_OP_GREATERTHAN, ORDER_OP_LESSOREQUALS, ORDER_OP_LESSTHAN
 
Fields inherited from interface org.apache.derby.iapi.types.VariableSizeDataValue
IGNORE_PRECISION
 
Constructor Summary
SQLNationalChar()
          no-arg constructor, required by Formattable.
SQLNationalChar(java.lang.String val, LocaleFinder localeFinder)
           
 
Method Summary
 DataValueDescriptor getClone()
          Clone this DataValueDescriptor.
 java.sql.Date getDate(java.util.Calendar cal)
          Gets the value in the data value descriptor as a java.sql.Date.
 DataValueDescriptor getNewNull()
          Get a new null value of the same type as this data value.
protected  StringDataValue getNewVarchar()
          Get a SQLVarchar for a built-in string function.
 java.sql.Time getTime(java.util.Calendar cal)
          Gets the value in the data value descriptor as a java.sql.Time.
 java.sql.Timestamp getTimestamp(java.util.Calendar cal)
          Gets the value in the data value descriptor as a java.sql.Timestamp.
 int getTypeFormatId()
          Return my format identifier.
 java.lang.String getTypeName()
          Get the SQL name of the datatype
 int hashCode()
           
protected  boolean isNationalString()
          Return whether or not this is a national character datatype.
 void normalize(DataTypeDescriptor desiredType, DataValueDescriptor source)
          Normalization method - this method may be called when putting a value into a SQLChar, for example, when inserting into a SQLChar column.
protected  void setFrom(DataValueDescriptor theValue)
           
 void setValue(java.sql.Date theValue, java.util.Calendar cal)
          Set the value of this DataValueDescriptor.
 void setValue(java.sql.Time theValue, java.util.Calendar cal)
          Set the value of this DataValueDescriptor.
 void setValue(java.sql.Timestamp theValue, java.util.Calendar cal)
          Set the value of this DataValueDescriptor.
protected  int stringCompare(SQLChar char1, SQLChar char2)
          Compare two SQLChars.
 int typePrecedence()
          Each built-in type in JSQL has a precedence.
 
Methods inherited from class org.apache.derby.iapi.types.SQLChar
appendBlanks, charLength, cloneObject, compare, compare, concatenate, copyState, equals, estimateMemoryUsage, getBoolean, getByte, getCharArray, getCollationKey, getDate, getDateFormat, getDateFormat, getDouble, getFloat, getInt, getLength, getLocaleFinder, getLong, getObject, getShort, getStream, getString, getTime, getTimeFormat, getTimeFormat, getTimestamp, getTimestampFormat, getTimestampFormat, greaterOrEquals, greaterThan, growBy, hasNonBlankChars, isNull, lessOrEquals, lessThan, like, like, loadStream, locate, lower, nationalGetDate, nationalGetTime, nationalGetTimestamp, nationalHashCode, normalize, notEquals, readExternal, readExternalFromArray, restoreToNull, returnStream, setBigDecimal, setInto, setLocaleFinder, setStream, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueFromResultSet, setWidth, stringCollatorCompare, stringCompare, stringCompare, substring, toString, trim, typeToBigDecimal, upper, writeExternal, XMLParse
 
Methods inherited from class org.apache.derby.iapi.types.DataType
checkHostVariable, coalesce, dataTypeConversion, equals, flip, genericSetObject, getBytes, getNationalString, in, invalidFormat, isNotNull, isNullOp, outOfRange, setInto, setObjectForCast, setToNull, setValue, setValue, setValue, setValue, throwLangSetMismatch, throwLangSetMismatch
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.derby.iapi.types.DataValueDescriptor
checkHostVariable, coalesce, getBytes, in, isNotNull, isNullOp, setInto, setObjectForCast, setToNull, setValue, setValue, setValue, setValue
 

Constructor Detail

SQLNationalChar

public SQLNationalChar()
no-arg constructor, required by Formattable.


SQLNationalChar

public SQLNationalChar(java.lang.String val,
                       LocaleFinder localeFinder)
Method Detail

getTypeName

public java.lang.String getTypeName()
Description copied from interface: DataValueDescriptor
Get the SQL name of the datatype

Specified by:
getTypeName in interface DataValueDescriptor
Overrides:
getTypeName in class SQLChar

getTypeFormatId

public int getTypeFormatId()
Return my format identifier.

Specified by:
getTypeFormatId in interface TypedFormat
Overrides:
getTypeFormatId in class SQLChar
See Also:
TypedFormat.getTypeFormatId()

getClone

public DataValueDescriptor getClone()
Description copied from interface: DataValueDescriptor
Clone this DataValueDescriptor. Results in a new object that has the same value as this but can be modified independently.

Specified by:
getClone in interface DataValueDescriptor
Overrides:
getClone in class SQLChar
See Also:
DataValueDescriptor.getClone()

getNewNull

public DataValueDescriptor getNewNull()
Description copied from interface: DataValueDescriptor
Get a new null value of the same type as this data value.

Specified by:
getNewNull in interface DataValueDescriptor
Overrides:
getNewNull in class SQLChar
See Also:
DataValueDescriptor.getNewNull()

getDate

public java.sql.Date getDate(java.util.Calendar cal)
                      throws StandardException
Description copied from interface: DataValueDescriptor
Gets the value in the data value descriptor as a java.sql.Date. Throws an exception if the data value is not a Date.

Specified by:
getDate in interface DataValueDescriptor
Overrides:
getDate in class SQLChar
Throws:
StandardException - thrown on failure to convert
See Also:
DataValueDescriptor.getDate(java.util.Calendar)

getTime

public java.sql.Time getTime(java.util.Calendar cal)
                      throws StandardException
Description copied from interface: DataValueDescriptor
Gets the value in the data value descriptor as a java.sql.Time. Throws an exception if the data value is not a Time.

Specified by:
getTime in interface DataValueDescriptor
Overrides:
getTime in class SQLChar
Throws:
StandardException - thrown on failure to convert
See Also:
DataValueDescriptor.getTime(java.util.Calendar)

getTimestamp

public java.sql.Timestamp getTimestamp(java.util.Calendar cal)
                                throws StandardException
Description copied from interface: DataValueDescriptor
Gets the value in the data value descriptor as a java.sql.Timestamp. Throws an exception if the data value is not a Timestamp.

Specified by:
getTimestamp in interface DataValueDescriptor
Overrides:
getTimestamp in class SQLChar
Throws:
StandardException - thrown on failure to convert
See Also:
DataValueDescriptor.getTimestamp(java.util.Calendar)

setValue

public void setValue(java.sql.Date theValue,
                     java.util.Calendar cal)
              throws StandardException
Description copied from interface: DataValueDescriptor
Set the value of this DataValueDescriptor.

Specified by:
setValue in interface DataValueDescriptor
Overrides:
setValue in class SQLChar
Throws:
StandardException - Thrown on error
See Also:
DataValueDescriptor.setValue(java.lang.Object)

setValue

public void setValue(java.sql.Time theValue,
                     java.util.Calendar cal)
              throws StandardException
Description copied from interface: DataValueDescriptor
Set the value of this DataValueDescriptor.

Specified by:
setValue in interface DataValueDescriptor
Overrides:
setValue in class SQLChar
Throws:
StandardException - Thrown on error
See Also:
DataValueDescriptor.setValue(java.lang.Object)

setValue

public void setValue(java.sql.Timestamp theValue,
                     java.util.Calendar cal)
              throws StandardException
Description copied from interface: DataValueDescriptor
Set the value of this DataValueDescriptor.

Specified by:
setValue in interface DataValueDescriptor
Overrides:
setValue in class SQLChar
Throws:
StandardException - Thrown on error
See Also:
DataValueDescriptor.setValue(java.lang.Object)

typePrecedence

public int typePrecedence()
Description copied from interface: DataValueDescriptor
Each built-in type in JSQL has a precedence. This precedence determines how to do type promotion when using binary operators. For example, float has a higher precedence than int, so when adding an int to a float, the result type is float. The precedence for some types is arbitrary. For example, it doesn't matter what the precedence of the boolean type is, since it can't be mixed with other types. But the precedence for the number types is critical. The SQL standard requires that exact numeric types be promoted to approximate numeric when one operator uses both. Also, the precedence is arranged so that one will not lose precision when promoting a type.

Specified by:
typePrecedence in interface DataValueDescriptor
Overrides:
typePrecedence in class SQLChar
See Also:
DataValueDescriptor.typePrecedence()

stringCompare

protected int stringCompare(SQLChar char1,
                            SQLChar char2)
                     throws StandardException
Compare two SQLChars. This method will be overriden in the National char wrappers so that the appropriate comparison is done.

Overrides:
stringCompare in class SQLChar
Throws:
StandardException - Thrown on error

getNewVarchar

protected StringDataValue getNewVarchar()
                                 throws StandardException
Get a SQLVarchar for a built-in string function. (Could be either a SQLVarchar or SQLNationalVarchar.)

Overrides:
getNewVarchar in class SQLChar
Returns:
a SQLVarchar or SQLNationalVarchar.
Throws:
StandardException - Thrown on error

normalize

public void normalize(DataTypeDescriptor desiredType,
                      DataValueDescriptor source)
               throws StandardException
Normalization method - this method may be called when putting a value into a SQLChar, for example, when inserting into a SQLChar column. See NormalizeResultSet in execution.

Specified by:
normalize in interface DataValueDescriptor
Overrides:
normalize in class SQLChar
Parameters:
desiredType - The type to normalize the source column to
source - The value to normalize
Returns:
The normalized SQLChar
Throws:
StandardException - Thrown for null into non-nullable column, and for truncation error

setFrom

protected void setFrom(DataValueDescriptor theValue)
                throws StandardException
Overrides:
setFrom in class SQLChar
Throws:
StandardException

isNationalString

protected boolean isNationalString()
Return whether or not this is a national character datatype.

Overrides:
isNationalString in class SQLChar

hashCode

public int hashCode()
Overrides:
hashCode in class SQLChar
See Also:
Object.hashCode()

Built on Mon 2007-06-04 09:58:47+0400, from revision ???

Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.