com.mortbay.JDBC
Class Column

java.lang.Object
  |
  +--com.mortbay.JDBC.Column

public class Column
extends java.lang.Object

Meta data for database column

Provides the Type, name, label and size of a column in a JDBC database.

Notes

DATETIME and ENUMs are converted to int as mSQL does not support those types yet.

Usage

 See TestHarness
 

Version:
$Id: Column.java,v 2.2 1999/09/22 15:08:40 gregw Exp $
Author:
Greg Wilkins
See Also:
Class.ThisShouldHaveBeenChanged

Field Summary
static int DATETIME
           
static int ENUM
           
static int INT
           
static int KEY
           
static int NONE
           
static int PRIMARY
           
static int REAL
           
 
Constructor Summary
Column(java.lang.String name, java.lang.String label, int type, int options)
          Column constructor
Column(java.lang.String name, java.lang.String label, java.lang.String[] enum, int options)
          Column constructor for enumerated column
 
Method Summary
static int CHAR(int length)
           
static java.lang.String[] ENUM(java.lang.String[] e)
           
 java.lang.String enum2str(int e)
          Get the String value of an enumerated type
 DbAdaptor getAdaptor()
           
 java.lang.String getLabel()
           
 java.lang.String getName()
           
 boolean isChar()
           
 boolean isEnum()
           
 boolean isKey()
           
 boolean isPrimary()
           
 boolean isText()
           
 boolean isType(int type)
           
static void main(java.lang.String[] args)
           
 java.lang.Object nullValue()
          Get the null value for column
 int size()
           
 int str2enum(java.lang.String s)
          Get the index of a String value of an enumerated type
static int TEXT()
           
static int TEXT(int length)
           
 java.lang.String toClause(java.lang.String op, java.lang.Object value)
          Format the WHERE clause string in the form "colname op value"
 java.lang.String toString()
           
 java.lang.String toString(java.lang.Object value)
          Format the value by column type
static int VARCHAR(int length)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INT

public static final int INT

REAL

public static final int REAL

DATETIME

public static final int DATETIME

ENUM

public static final int ENUM

NONE

public static final int NONE

KEY

public static final int KEY

PRIMARY

public static final int PRIMARY
Constructor Detail

Column

public Column(java.lang.String name,
              java.lang.String label,
              int type,
              int options)
Column constructor
Parameters:
name - The name of the column in the database.
label - A long descriptive name of the column for humans
type - The type of value the column can hold
optional - status indicators for the column

Column

public Column(java.lang.String name,
              java.lang.String label,
              java.lang.String[] enum,
              int options)
Column constructor for enumerated column
Parameters:
name - The name of the column in the database.
label - A long descriptive name of the column for humans
enum - An array of string enum descriptors.
optional - status indicators for the column
Method Detail

CHAR

public static final int CHAR(int length)

TEXT

public static final int TEXT()

TEXT

public static final int TEXT(int length)

VARCHAR

public static final int VARCHAR(int length)

ENUM

public static final java.lang.String[] ENUM(java.lang.String[] e)

getName

public java.lang.String getName()

getLabel

public java.lang.String getLabel()

getAdaptor

public DbAdaptor getAdaptor()

isKey

public boolean isKey()

isPrimary

public boolean isPrimary()

isChar

public boolean isChar()

isText

public boolean isText()

isEnum

public boolean isEnum()

isType

public boolean isType(int type)

size

public int size()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(java.lang.Object value)
Format the value by column type

toClause

public java.lang.String toClause(java.lang.String op,
                                 java.lang.Object value)
Format the WHERE clause string in the form "colname op value"

nullValue

public java.lang.Object nullValue()
Get the null value for column

enum2str

public java.lang.String enum2str(int e)
Get the String value of an enumerated type

str2enum

public int str2enum(java.lang.String s)
Get the index of a String value of an enumerated type

main

public static void main(java.lang.String[] args)