com.uwyn.rife.database.queries
Class CreateTable

java.lang.Object
  extended by com.uwyn.rife.database.queries.CreateTable
All Implemented Interfaces:
Query, Cloneable

public class CreateTable
extends Object
implements Cloneable

Object representation of a SQL "CREATE TABLE" query.

This object may be used to dynamically construct a SQL statement in a database-independent fashion. After it is finished, it may be executed using DbQueryManager.executeUpdate().

Since:
1.0
Version:
$Revision: 3750 $
Author:
Geert Bevin (gbevin[remove] at uwyn dot com), Steven Grimm (koreth[remove] at midwinter dot com)

Nested Class Summary
 class CreateTable.CheckConstraint
           
 class CreateTable.Column
           
 class CreateTable.ColumnsConstraint
           
 class CreateTable.Constraint
           
 class CreateTable.ForeignKey
           
static class CreateTable.Nullable
           
 class CreateTable.PrimaryKey
           
 class CreateTable.UniqueConstraint
           
static class CreateTable.ViolationAction
           
 
Field Summary
static CreateTable.ViolationAction CASCADE
           
protected  Datasource mDatasource
           
protected  boolean mExcludeUnsupportedCapabilities
           
protected  String mSql
           
static CreateTable.ViolationAction NOACTION
           
static CreateTable.Nullable NOTNULL
           
static CreateTable.Nullable NULL
           
static CreateTable.ViolationAction RESTRICT
           
static CreateTable.ViolationAction SETDEFAULT
           
static CreateTable.ViolationAction SETNULL
           
 
Constructor Summary
CreateTable(Datasource datasource)
           
 
Method Summary
 CreateTable check(String expression)
           
 CreateTable check(String name, String expression)
           
 void clear()
           
protected  void clearGenerated()
           
 CreateTable clone()
           
 CreateTable column(String name, Class type)
           
 CreateTable column(String name, Class type, CreateTable.Nullable nullable)
           
 CreateTable column(String name, Class type, int precision)
           
 CreateTable column(String name, Class type, int precision, CreateTable.Nullable nullable)
           
 CreateTable column(String name, Class type, int precision, int scale)
           
 CreateTable column(String name, Class type, int precision, int scale, CreateTable.Nullable nullable)
           
 CreateTable column(String name, Class type, int precision, int scale, String typeAttribute)
           
 CreateTable column(String name, Class type, int precision, int scale, String typeAttribute, CreateTable.Nullable nullable)
           
 CreateTable column(String name, Class type, int precision, String typeAttribute)
           
 CreateTable column(String name, Class type, int precision, String typeAttribute, CreateTable.Nullable nullable)
           
 CreateTable column(String name, Class type, String typeAttribute)
           
 CreateTable column(String name, Class type, String typeAttribute, CreateTable.Nullable nullable)
           
 CreateTable columns(Class beanClass)
           
 CreateTable columns(Object[] keyValues)
           
 CreateTable columnsExcluded(Class beanClass, String[] excludedFields)
           
 CreateTable columnsFiltered(Class beanClass, String[] includedFields, String[] excludedFields)
           
 CreateTable columnsIncluded(Class beanClass, String[] includedFields)
           
 CreateTable customAttribute(String name, String attribute)
           
 CreateTable defaultFunction(String name, String defaultFunction)
           
 CreateTable defaultValue(String name, boolean value)
           
 CreateTable defaultValue(String name, byte value)
           
 CreateTable defaultValue(String name, char value)
           
 CreateTable defaultValue(String name, double value)
           
 CreateTable defaultValue(String name, float value)
           
 CreateTable defaultValue(String name, int value)
           
 CreateTable defaultValue(String name, long value)
           
 CreateTable defaultValue(String name, Object value)
           
 CreateTable defaultValue(String name, short value)
           
 CreateTable foreignKey(String foreignTable, String[] columnsMapping)
           
 CreateTable foreignKey(String foreignTable, String[] columnsMapping, CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete)
           
 CreateTable foreignKey(String foreignTable, String localColumn, String foreignColumn)
           
 CreateTable foreignKey(String name, String foreignTable, String[] columnsMapping)
           
 CreateTable foreignKey(String name, String foreignTable, String[] columnsMapping, CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete)
           
 CreateTable foreignKey(String foreignTable, String localColumn, String foreignColumn, CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete)
           
 CreateTable foreignKey(String name, String foreignTable, String localColumn, String foreignColumn)
           
 CreateTable foreignKey(String name, String foreignTable, String localColumn, String foreignColumn, CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete)
           
 com.uwyn.rife.database.capabilities.Capabilities getCapabilities()
           
 List<CreateTable.CheckConstraint> getCheckConstraints()
           
 Map<String,CreateTable.Column> getColumnMapping()
           
 Datasource getDatasource()
           
 List<CreateTable.ForeignKey> getForeignKeys()
           
 QueryParameters getParameters()
           
 List<CreateTable.PrimaryKey> getPrimaryKeys()
           
 String getSql()
           
 String getTable()
           
 List<CreateTable.UniqueConstraint> getUniqueConstraints()
           
 boolean isTemporary()
           
 CreateTable nullable(String name, CreateTable.Nullable nullable)
           
 CreateTable precision(String name, int precision)
           
 CreateTable precision(String name, int precision, int scale)
           
 CreateTable primaryKey(String column)
           
 CreateTable primaryKey(String[] columns)
           
 CreateTable primaryKey(String name, String column)
           
 CreateTable primaryKey(String name, String[] columns)
           
 void setExcludeUnsupportedCapabilities(boolean flag)
           
 CreateTable table(String table)
           
 CreateTable temporary(boolean temporary)
           
 String toString()
           
 CreateTable unique(String column)
           
 CreateTable unique(String[] columns)
           
 CreateTable unique(String name, String column)
           
 CreateTable unique(String name, String[] columns)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NULL

public static final CreateTable.Nullable NULL

NOTNULL

public static final CreateTable.Nullable NOTNULL

NOACTION

public static final CreateTable.ViolationAction NOACTION

RESTRICT

public static final CreateTable.ViolationAction RESTRICT

CASCADE

public static final CreateTable.ViolationAction CASCADE

SETNULL

public static final CreateTable.ViolationAction SETNULL

SETDEFAULT

public static final CreateTable.ViolationAction SETDEFAULT

mDatasource

protected Datasource mDatasource

mSql

protected String mSql

mExcludeUnsupportedCapabilities

protected boolean mExcludeUnsupportedCapabilities
Constructor Detail

CreateTable

public CreateTable(Datasource datasource)
Method Detail

clear

public void clear()
Specified by:
clear in interface Query

getCapabilities

public com.uwyn.rife.database.capabilities.Capabilities getCapabilities()
Specified by:
getCapabilities in interface Query

getTable

public String getTable()

isTemporary

public boolean isTemporary()

getColumnMapping

public Map<String,CreateTable.Column> getColumnMapping()

getPrimaryKeys

public List<CreateTable.PrimaryKey> getPrimaryKeys()

getForeignKeys

public List<CreateTable.ForeignKey> getForeignKeys()

getUniqueConstraints

public List<CreateTable.UniqueConstraint> getUniqueConstraints()

getCheckConstraints

public List<CreateTable.CheckConstraint> getCheckConstraints()

getSql

public String getSql()
              throws DbQueryException
Specified by:
getSql in interface Query
Throws:
DbQueryException

table

public CreateTable table(String table)

temporary

public CreateTable temporary(boolean temporary)

column

public CreateTable column(String name,
                          Class type)

column

public CreateTable column(String name,
                          Class type,
                          String typeAttribute)

column

public CreateTable column(String name,
                          Class type,
                          int precision)

column

public CreateTable column(String name,
                          Class type,
                          int precision,
                          String typeAttribute)

column

public CreateTable column(String name,
                          Class type,
                          int precision,
                          int scale)

column

public CreateTable column(String name,
                          Class type,
                          int precision,
                          int scale,
                          String typeAttribute)

column

public CreateTable column(String name,
                          Class type,
                          CreateTable.Nullable nullable)

column

public CreateTable column(String name,
                          Class type,
                          String typeAttribute,
                          CreateTable.Nullable nullable)

column

public CreateTable column(String name,
                          Class type,
                          int precision,
                          CreateTable.Nullable nullable)

column

public CreateTable column(String name,
                          Class type,
                          int precision,
                          String typeAttribute,
                          CreateTable.Nullable nullable)

column

public CreateTable column(String name,
                          Class type,
                          int precision,
                          int scale,
                          CreateTable.Nullable nullable)

column

public CreateTable column(String name,
                          Class type,
                          int precision,
                          int scale,
                          String typeAttribute,
                          CreateTable.Nullable nullable)

columns

public CreateTable columns(Object[] keyValues)

precision

public CreateTable precision(String name,
                             int precision)

precision

public CreateTable precision(String name,
                             int precision,
                             int scale)

nullable

public CreateTable nullable(String name,
                            CreateTable.Nullable nullable)

defaultValue

public CreateTable defaultValue(String name,
                                char value)

defaultValue

public CreateTable defaultValue(String name,
                                boolean value)

defaultValue

public CreateTable defaultValue(String name,
                                byte value)

defaultValue

public CreateTable defaultValue(String name,
                                double value)

defaultValue

public CreateTable defaultValue(String name,
                                float value)

defaultValue

public CreateTable defaultValue(String name,
                                int value)

defaultValue

public CreateTable defaultValue(String name,
                                long value)

defaultValue

public CreateTable defaultValue(String name,
                                short value)

defaultValue

public CreateTable defaultValue(String name,
                                Object value)

defaultFunction

public CreateTable defaultFunction(String name,
                                   String defaultFunction)

customAttribute

public CreateTable customAttribute(String name,
                                   String attribute)

columns

public CreateTable columns(Class beanClass)
                    throws DbQueryException
Throws:
DbQueryException

columnsIncluded

public CreateTable columnsIncluded(Class beanClass,
                                   String[] includedFields)
                            throws DbQueryException
Throws:
DbQueryException

columnsExcluded

public CreateTable columnsExcluded(Class beanClass,
                                   String[] excludedFields)
                            throws DbQueryException
Throws:
DbQueryException

columnsFiltered

public CreateTable columnsFiltered(Class beanClass,
                                   String[] includedFields,
                                   String[] excludedFields)
                            throws DbQueryException
Throws:
DbQueryException

primaryKey

public CreateTable primaryKey(String column)

primaryKey

public CreateTable primaryKey(String[] columns)

primaryKey

public CreateTable primaryKey(String name,
                              String column)

primaryKey

public CreateTable primaryKey(String name,
                              String[] columns)

foreignKey

public CreateTable foreignKey(String foreignTable,
                              String localColumn,
                              String foreignColumn)

foreignKey

public CreateTable foreignKey(String foreignTable,
                              String localColumn,
                              String foreignColumn,
                              CreateTable.ViolationAction onUpdate,
                              CreateTable.ViolationAction onDelete)

foreignKey

public CreateTable foreignKey(String foreignTable,
                              String[] columnsMapping)

foreignKey

public CreateTable foreignKey(String foreignTable,
                              String[] columnsMapping,
                              CreateTable.ViolationAction onUpdate,
                              CreateTable.ViolationAction onDelete)

foreignKey

public CreateTable foreignKey(String name,
                              String foreignTable,
                              String localColumn,
                              String foreignColumn)

foreignKey

public CreateTable foreignKey(String name,
                              String foreignTable,
                              String localColumn,
                              String foreignColumn,
                              CreateTable.ViolationAction onUpdate,
                              CreateTable.ViolationAction onDelete)

foreignKey

public CreateTable foreignKey(String name,
                              String foreignTable,
                              String[] columnsMapping)

foreignKey

public CreateTable foreignKey(String name,
                              String foreignTable,
                              String[] columnsMapping,
                              CreateTable.ViolationAction onUpdate,
                              CreateTable.ViolationAction onDelete)

unique

public CreateTable unique(String column)

unique

public CreateTable unique(String[] columns)

unique

public CreateTable unique(String name,
                          String column)

unique

public CreateTable unique(String name,
                          String[] columns)

check

public CreateTable check(String expression)

check

public CreateTable check(String name,
                         String expression)

clone

public CreateTable clone()

getDatasource

public Datasource getDatasource()

getParameters

public QueryParameters getParameters()
Specified by:
getParameters in interface Query

setExcludeUnsupportedCapabilities

public void setExcludeUnsupportedCapabilities(boolean flag)
Specified by:
setExcludeUnsupportedCapabilities in interface Query

clearGenerated

protected void clearGenerated()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2001-2007 Uwyn sprl/bvba. All Rights Reserved.