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

Quick Search    Search Deep

org.apache.derby.iapi.types
Class SQLNationalVarchar  view SQLNationalVarchar download SQLNationalVarchar.java

java.lang.Object
  extended byorg.apache.derby.iapi.types.DataType
      extended byorg.apache.derby.iapi.types.SQLChar
          extended byorg.apache.derby.iapi.types.SQLVarchar
              extended byorg.apache.derby.iapi.types.SQLNationalVarchar
All Implemented Interfaces:
CloneableObject, ConcatableDataValue, DataValueDescriptor, java.io.Externalizable, org.apache.derby.iapi.services.io.Formatable, Orderable, java.io.Serializable, org.apache.derby.iapi.services.io.Storable, org.apache.derby.iapi.services.io.StreamStorable, StringDataValue, org.apache.derby.iapi.services.io.TypedFormat, VariableSizeDataValue
Direct Known Subclasses:
SQLNClob

public class SQLNationalVarchar
extends SQLVarchar

SQLNationalVarchar satisfies the DataValueDescriptor interfaces (i.e., OrderableDataType). It implements a 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, SQLNationalVarchar can play a role in either a DataType/ValueRow or a OrderableDataType/KeyRow, interchangeably. SQLNationalVarchar is mostly the same as SQLVarchar, so it is implemented as a subclass of SQLVarchar. Only those methods with different behavior are implemented here.


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
SQLNationalVarchar()
           
SQLNationalVarchar(java.lang.String val, org.apache.derby.iapi.services.i18n.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()
          Get a value that represents this Object, as uniquely as possible within the confines of an int.
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 SQLVarchar, for example, when inserting into a SQLVarchar 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.SQLVarchar
growBy, normalize
 
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, hasNonBlankChars, isNull, lessOrEquals, lessThan, like, like, loadStream, locate, lower, nationalGetDate, nationalGetTime, nationalGetTimestamp, nationalHashCode, 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

SQLNationalVarchar

public SQLNationalVarchar()

SQLNationalVarchar

public SQLNationalVarchar(java.lang.String val,
                          org.apache.derby.iapi.services.i18n.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 SQLVarchar

stringCompare

protected int stringCompare(SQLChar char1,
                            SQLChar char2)
                     throws org.apache.derby.iapi.error.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

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 SQLVarchar

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 SQLVarchar

getTypeFormatId

public int getTypeFormatId()
Return my format identifier.

Specified by:
getTypeFormatId in interface org.apache.derby.iapi.services.io.TypedFormat
Overrides:
getTypeFormatId in class SQLVarchar

getDate

public java.sql.Date getDate(java.util.Calendar cal)
                      throws org.apache.derby.iapi.error.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

getTime

public java.sql.Time getTime(java.util.Calendar cal)
                      throws org.apache.derby.iapi.error.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

getTimestamp

public java.sql.Timestamp getTimestamp(java.util.Calendar cal)
                                throws org.apache.derby.iapi.error.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

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 SQLVarchar

getNewVarchar

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

Overrides:
getNewVarchar in class SQLChar

isNationalString

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

Overrides:
isNationalString in class SQLChar

setValue

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

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

setValue

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

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

setValue

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

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

normalize

public void normalize(DataTypeDescriptor desiredType,
                      DataValueDescriptor source)
               throws org.apache.derby.iapi.error.StandardException
Description copied from class: SQLVarchar
Normalization method - this method may be called when putting a value into a SQLVarchar, for example, when inserting into a SQLVarchar column. See NormalizeResultSet in execution.

Specified by:
normalize in interface DataValueDescriptor
Overrides:
normalize in class SQLVarchar

setFrom

protected void setFrom(DataValueDescriptor theValue)
                throws org.apache.derby.iapi.error.StandardException
Overrides:
setFrom in class SQLChar

hashCode

public int hashCode()
Description copied from class: java.lang.Object
Get a value that represents this Object, as uniquely as possible within the confines of an int.

There are some requirements on this method which subclasses must follow:

  • Semantic equality implies identical hashcodes. In other words, if a.equals(b) is true, then a.hashCode() == b.hashCode() must be as well. However, the reverse is not necessarily true, and two objects may have the same hashcode without being equal.
  • It must be consistent. Whichever value o.hashCode() returns on the first invocation must be the value returned on all later invocations as long as the object exists. Notice, however, that the result of hashCode may change between separate executions of a Virtual Machine, because it is not invoked on the same object.

Notice that since hashCode is used in java.util.Hashtable and other hashing classes, a poor implementation will degrade the performance of hashing (so don't blindly implement it as returning a constant!). Also, if calculating the hash is time-consuming, a class may consider caching the results.

The default implementation returns System.identityHashCode(this)

Overrides:
hashCode in class SQLChar