jacquard 1.12.0 by The Web Engineering Factory and Toolworks

uk.co.weft.dbutil
Class CharacterColumnDescriptor

java.lang.Object
  extended byuk.co.weft.dbutil.ColumnDescriptor
      extended byuk.co.weft.dbutil.CharacterColumnDescriptor

public class CharacterColumnDescriptor
extends ColumnDescriptor

A descriptor for a character column.

Version:
$Revision: 1.10.4.5 $ This revision: $Author: simon $
Author:
Simon Brooke

Field Summary
protected  int fieldwidth
          field width of this column.
 
Constructor Summary
CharacterColumnDescriptor(java.lang.String n, int f)
          Create a new descriptor for a character of varchar column
 
Method Summary
protected  java.lang.String format(Context c)
          Format a character field for sending to the database.
protected  java.lang.String formatForMatch(Context c)
          Deprecated. use formatForMatch( Context,boolean)
protected  java.lang.String formatForMatch(Context c, boolean exact)
          format me appropriately for use in the select operation of a match query.
protected  java.lang.Object genKey(Context c)
          generate a new unique key for me given this context
protected  java.lang.String getRandomKey()
          Generate a random sequence of lower case characters to fill the field
 
Methods inherited from class uk.co.weft.dbutil.ColumnDescriptor
createColumnDescriptor, formatForInsert, formatForSelect, formatForUpdate, interpret, quoteValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fieldwidth

protected int fieldwidth
field width of this column.

Constructor Detail

CharacterColumnDescriptor

public CharacterColumnDescriptor(java.lang.String n,
                                 int f)
Create a new descriptor for a character of varchar column

Parameters:
n - the name of this column
f - the fieldwidth of this column
Method Detail

getRandomKey

protected java.lang.String getRandomKey()
Generate a random sequence of lower case characters to fill the field


format

protected java.lang.String format(Context c)
                           throws DataFormatException
Format a character field for sending to the database. Specialisation: if neccessary, truncate the value to the field length

Overrides:
format in class ColumnDescriptor
Throws:
DataFormatException

formatForMatch

protected java.lang.String formatForMatch(Context c)
                                   throws DataFormatException
Deprecated. use formatForMatch( Context,boolean)

Highly experimental: match character columns by using 'like' (i.e. fuzzy match)

Overrides:
formatForMatch in class ColumnDescriptor
Throws:
DataFormatException

formatForMatch

protected java.lang.String formatForMatch(Context c,
                                          boolean exact)
                                   throws DataFormatException
format me appropriately for use in the select operation of a match query.

Overrides:
formatForMatch in class ColumnDescriptor
Parameters:
c - the context to match
exact - whether or not an exact match is required
Throws:
DataFormatException

genKey

protected java.lang.Object genKey(Context c)
                           throws DataStoreException
generate a new unique key for me given this context

Overrides:
genKey in class ColumnDescriptor
Throws:
throws - DataStoreException if a unique key could not be generated If the field contains numeric values, use the next one. if it does not, generate a random sequence of characters and make sure it's unique.
DataStoreException

jacquard 1.12.0 by The Web Engineering Factory and Toolworks