2004.04.29


com.jdc.rdb.sql.ddl.create
Class Create

java.lang.Object
  |
  +--com.jdc.lang.Object
        |
        +--com.jdc.rdb.sql.SQL
              |
              +--com.jdc.rdb.sql.ddl.DDL
                    |
                    +--com.jdc.rdb.sql.ddl.create.Create
All Implemented Interfaces:
Serializable, Statement

public class Create
extends DDL

Create represents a Data Definition Language CREATE SQL statement. The Create statement creates a new Database Object.

Create is a structured query language (SQL) statement object used to create an object in the database. Valid object types are INDEX, SCHEMA, TABLE and VIEW.

If object type is SCHEMA, this SQL statement creates a schema with the specified name. By default, a database has three schema initially defined, SYS_INFO, SYS_JDBC and APP. The SYS_INFO and SYS_JDBC schema contain a number of important system tables and the APP schema is the default user schema.

If object type is TABLE, this SQL statement creates a table with the specified table name, column names, and primary key.

If object type is VIEW, this SQL statement creates a new view. A view is a virtual table based on the result of a SELECT query. The content of a view may reference any number of other tables and/or views. A view behaves like a regular table and may be queried as one would a database table created with the CREATE TABLE statement. Views are READ-ONLY.

Note: Create VIEW is not fully supported.

Version:
1.5
Author:
Jay Damon
See Also:
Schema, Table, IfNotExists, Serialized Form

Field Summary
static String COMMAND
          The Create statement command keyword.
 
Fields inherited from class com.jdc.rdb.sql.ddl.DDL
sql
 
Fields inherited from class com.jdc.lang.Object
string
 
Constructor Summary
Create()
          Constructs a new Create statement object.
Create(Schema schema)
          Constructs a new Create statement object for the specified Database Schema definition.
Create(String statement)
          Constructs a new Create statement object for the specified SQL String.
Create(Table table)
          Constructs a new Create statement object for the specified Database Table definition.
 
Method Summary
 CreateStatus execute()
          Executes the Create statement and returns a CreateStatus object.
 String getColumns()
          Returns the columns clause for the CREATE command.
 String getConstraint()
          Returns the CONSTRAINT clause for the CREATE command.
 String getUnique()
          Returns the UNIQUE clause for the CREATE command.
 Create set(CreateClause clause)
          Sets a CreateClause for this Create statement.
 Create setColumns(String columnNames)
          Sets the columns clause for the CREATE command.
 Create setColumns(String[] columnNames)
          Sets the columns clause for the CREATE command.
 Create setConstraint(String constraintClause)
          Sets the optional CONSTRAINT clause for the CREATE command.
 Create setUnique(String uniqueClause)
          Sets the optional UNIQUE clause for the CREATE command.
 
Methods inherited from class com.jdc.rdb.sql.ddl.DDL
finalize, getConnection, getDatabase, getObject, isValid, setObject
 
Methods inherited from class com.jdc.rdb.sql.SQL
addClause, execute, getClause, getCommand, getStatement, setCommand, setConnection, setStatement, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COMMAND

public static final String COMMAND
The Create statement command keyword.

See Also:
Constant Field Values
Constructor Detail

Create

public Create()
Constructs a new Create statement object.


Create

public Create(Schema schema)
Constructs a new Create statement object for the specified Database Schema definition.

Throws:
SQLInvalidException - No schema definition is specified.

Create

public Create(Table table)
Constructs a new Create statement object for the specified Database Table definition.

Throws:
SQLInvalidException - No table definition is specified.

Create

public Create(String statement)
Constructs a new Create statement object for the specified SQL String. If you specify a custom SQL String, you must also specify a Database Connection to use.

Throws:
SQLInvalidException - No CREATE statement is specified.
See Also:
SQL.setConnection(java.sql.Connection)
Method Detail

execute

public CreateStatus execute()
Executes the Create statement and returns a CreateStatus object.

Returns:
The Create statement status.

getColumns

public String getColumns()
Returns the columns clause for the CREATE command.

Returns:
String The CREATE command columns clause.

getConstraint

public String getConstraint()
Returns the CONSTRAINT clause for the CREATE command.

Returns:
String The CREATE command CONSTRAINT clause.

getUnique

public String getUnique()
Returns the UNIQUE clause for the CREATE command.

Returns:
String The CREATE command UNIQUE clause.

set

public Create set(CreateClause clause)
Sets a CreateClause for this Create statement. Use this method to specify a custom Create clause.

Returns:
This Create statement object.
Throws:
SQLInvalidException - No DROP statement clause is specified.

setColumns

public Create setColumns(String columnNames)
Sets the columns clause for the CREATE command.

Returns:
Create This Create statement object.

setColumns

public Create setColumns(String[] columnNames)
Sets the columns clause for the CREATE command.

Returns:
Create This Create statement object.

setConstraint

public Create setConstraint(String constraintClause)
Sets the optional CONSTRAINT clause for the CREATE command.

Returns:
Create This Create statement object.

setUnique

public Create setUnique(String uniqueClause)
Sets the optional UNIQUE clause for the CREATE command.

Returns:
Create This Create statement object.

2004.04.29



Copyright © 2004 J. Damon & Co.; All Rights Reserved WorldWide.