com.caucho.db.table
Class TableFactory

java.lang.Object
  extended by com.caucho.db.table.TableFactory

public class TableFactory
extends java.lang.Object


Constructor Summary
TableFactory(Database database)
           
 
Method Summary
 Column addBinary(java.lang.String name, int size)
          Adds a binary
 Column addBlob(java.lang.String name)
          Adds a blob
 void addConstraint(Constraint constraint)
          Adds a constraint.
 Column addDateTime(java.lang.String name)
          Adds a datetime column
 Column addDouble(java.lang.String name)
          Adds a double
 Column addIdentity(java.lang.String name)
          Adds the identity column
 Column addInteger(java.lang.String name)
          Adds an integer
 Column addLong(java.lang.String name)
          Adds a long
 Column addNumeric(java.lang.String name, int precision, int scale)
          Adds a numeric
 void addPrimaryKey(java.util.ArrayList<java.lang.String> names)
          Sets the array of columns as the primary key
 Column addShort(java.lang.String name)
          Adds a short
 Column addTinytext(java.lang.String name)
          Adds a varchar
 void addUnique(java.util.ArrayList<java.lang.String> names)
          Sets the array of columns as unique
 Column addVarbinary(java.lang.String name, int size)
          Adds a binary
 Column addVarchar(java.lang.String name, int size)
          Adds a varchar
 void create()
          Creates the table.
 Constraint[] getConstraints()
          Returns the constraints.
 java.lang.String getName()
          Returns the table name.
 com.caucho.db.table.Row getRow()
          Returns the row.
 void setAutoIncrement(java.lang.String name, int min)
          Sets the named column as auto-increment
 void setDefault(java.lang.String name, Expr expr)
          Sets the column default
 void setNotNull(java.lang.String name)
          Sets the named column as not null
 void setPrimaryKey(java.lang.String name)
          Sets the named column as a primary key constraint.
 void setUnique(java.lang.String name)
          Sets the named column as unique
 void startTable(java.lang.String name)
          Creates a table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableFactory

public TableFactory(Database database)
Method Detail

getName

public java.lang.String getName()
Returns the table name.


getRow

public com.caucho.db.table.Row getRow()
Returns the row.


startTable

public void startTable(java.lang.String name)
Creates a table.


addTinytext

public Column addTinytext(java.lang.String name)
Adds a varchar


addVarchar

public Column addVarchar(java.lang.String name,
                         int size)
Adds a varchar


addVarbinary

public Column addVarbinary(java.lang.String name,
                           int size)
Adds a binary


addBinary

public Column addBinary(java.lang.String name,
                        int size)
Adds a binary


addBlob

public Column addBlob(java.lang.String name)
Adds a blob


addShort

public Column addShort(java.lang.String name)
Adds a short


addInteger

public Column addInteger(java.lang.String name)
Adds an integer


addLong

public Column addLong(java.lang.String name)
Adds a long


addIdentity

public Column addIdentity(java.lang.String name)
Adds the identity column


addDouble

public Column addDouble(java.lang.String name)
Adds a double


addDateTime

public Column addDateTime(java.lang.String name)
Adds a datetime column


addNumeric

public Column addNumeric(java.lang.String name,
                         int precision,
                         int scale)
Adds a numeric


setPrimaryKey

public void setPrimaryKey(java.lang.String name)
                   throws java.sql.SQLException
Sets the named column as a primary key constraint.

Throws:
java.sql.SQLException

setNotNull

public void setNotNull(java.lang.String name)
                throws java.sql.SQLException
Sets the named column as not null

Throws:
java.sql.SQLException

setDefault

public void setDefault(java.lang.String name,
                       Expr expr)
                throws java.sql.SQLException
Sets the column default

Throws:
java.sql.SQLException

setUnique

public void setUnique(java.lang.String name)
               throws java.sql.SQLException
Sets the named column as unique

Throws:
java.sql.SQLException

setAutoIncrement

public void setAutoIncrement(java.lang.String name,
                             int min)
                      throws java.sql.SQLException
Sets the named column as auto-increment

Throws:
java.sql.SQLException

addUnique

public void addUnique(java.util.ArrayList<java.lang.String> names)
               throws java.sql.SQLException
Sets the array of columns as unique

Throws:
java.sql.SQLException

addPrimaryKey

public void addPrimaryKey(java.util.ArrayList<java.lang.String> names)
                   throws java.sql.SQLException
Sets the array of columns as the primary key

Throws:
java.sql.SQLException

addConstraint

public void addConstraint(Constraint constraint)
Adds a constraint.


getConstraints

public Constraint[] getConstraints()
Returns the constraints.


create

public void create()
            throws java.sql.SQLException,
                   java.io.IOException
Creates the table.

Throws:
java.sql.SQLException
java.io.IOException