com.davisor.data
Class SQLTextType

java.lang.Object
  extended byjava.text.Format
      extended bycom.davisor.data.Type
          extended bycom.davisor.data.TextType
              extended bycom.davisor.data.SQLTextType
All Implemented Interfaces:
java.lang.Cloneable, java.util.Comparator, com.davisor.core.Dupable, java.io.Serializable

public class SQLTextType
extends TextType

SQLTextType defines a data type that supports plain text values in SQL statements. The crucial difference with ordinary plain text is that SQL text may not contain any "'" characters, as they would conflict with the SQL string delimiters and therefore corrupt the SQL statements. This type guards the statements by replacing the "'" characters in text data values with "`" characters.

Since:
JDK1.1
See Also:
stringValue(java.lang.String, java.text.ParsePosition), TextData, TextType, Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.text.Format
java.text.Format.Field
 
Field Summary
static java.lang.String TYPENAME
          Type name ("SQLTEXT").
 
Fields inherited from class com.davisor.data.TextType
DEFAULT
 
Fields inherited from class com.davisor.data.Type
METADATA_GROUP, METADATA_NAME, METADATA_PARENT, METADATA_SUBCHANNELS
 
Constructor Summary
  SQLTextType()
          Default constructor.
  SQLTextType(SQLTextType stt)
          Copy constructor.
  SQLTextType(java.lang.String dataName)
          Creates a new default type with no identity.
  SQLTextType(java.lang.String dataName, java.lang.String id, java.util.Map metaData, int maxLength, java.lang.String prefix)
          Creates a new text type.
  SQLTextType(java.lang.String dataName, java.lang.String id, java.lang.String format)
          Constructs a new boolean type.
protected SQLTextType(java.lang.String typeName, java.lang.String dataName, java.lang.String id, java.util.Map metaData, int maxLength, java.lang.String prefix)
          Creates a new text type.
 
Method Summary
 com.davisor.core.Dupable dup()
          Makes a deep copy of this object.
 java.lang.String stringValue(java.lang.String value, java.text.ParsePosition status)
          Verifies that a text string first meets the given sub-class constraints, and then that it does not contain any "'" characters.
 
Methods inherited from class com.davisor.data.TextType
check, equals, getCompatibility, getFormat, getMaxLength, getPrefix, getSQLCode, getValueClass, hashCode, setFormat, setMaxLength, setPrefix, toData, zero
 
Methods inherited from class com.davisor.data.Type
ceil, check, compare, create, create, create, create, create, dup, floor, format, getDataName, getId, getID, getMetaData, getMetaData, getSpecs, getSQLName, getSQLName, getTypeName, isNull, parseObject, register, register, setDataName, setId, setID, setMetaData, setMetaData, setSpecs, toData, toData, toData, toString, toXML, xmlEnd, xmlStart
 
Methods inherited from class java.text.Format
clone, format, formatToCharacterIterator, parseObject
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPENAME

public static final java.lang.String TYPENAME
Type name ("SQLTEXT").

See Also:
Constant Field Values
Constructor Detail

SQLTextType

public SQLTextType()
Default constructor.


SQLTextType

public SQLTextType(SQLTextType stt)
Copy constructor.


SQLTextType

public SQLTextType(java.lang.String dataName)
Creates a new default type with no identity.

Parameters:
dataName - data name (may be null)

SQLTextType

public SQLTextType(java.lang.String dataName,
                   java.lang.String id,
                   java.lang.String format)
Constructs a new boolean type.

This is the constructor the SQL type mapper Type.create(Integer,String,String,String) method will call to create a type that matches given SQL type.

Parameters:
dataName - data name (may be null)
id - type identity (may be null)
format - type spesification (may be null)
See Also:
TextType.setFormat(java.lang.String)

SQLTextType

public SQLTextType(java.lang.String dataName,
                   java.lang.String id,
                   java.util.Map metaData,
                   int maxLength,
                   java.lang.String prefix)
Creates a new text type.

Parameters:
dataName - data name (may be null)
id - type identity (may be null)
metaData - type meta data map (may be null)
maxLength - maximum text length
prefix - mandatory text prefix (may be null)

SQLTextType

protected SQLTextType(java.lang.String typeName,
                      java.lang.String dataName,
                      java.lang.String id,
                      java.util.Map metaData,
                      int maxLength,
                      java.lang.String prefix)
Creates a new text type.

Parameters:
typeName - type name
dataName - data name (may be null)
id - type identity (may be null)
metaData - type meta data map (may be null)
maxLength - maximum text length
prefix - mandatory text prefix (may be null)
Method Detail

dup

public com.davisor.core.Dupable dup()
Makes a deep copy of this object.

Specified by:
dup in interface com.davisor.core.Dupable
Overrides:
dup in class TextType

stringValue

public java.lang.String stringValue(java.lang.String value,
                                    java.text.ParsePosition status)
                             throws InvalidDataException
Verifies that a text string first meets the given sub-class constraints, and then that it does not contain any "'" characters. If it does, all those characters are replaced with "`" characters.

Overrides:
stringValue in class TextType
Parameters:
value - data string
status - parse status (may be null)
Returns:
Verified data string.
Throws:
InvalidDataException - never thrown.
See Also:
TextType.check(java.lang.String)


Copyright © 2001-2004 Davisor Oy. All Rights Reserved.