org.edg.info.sqlutil.parsql
Class CreateTableStatement

java.lang.Object
  extended byorg.edg.info.sqlutil.parsql.CreateTableStatement
All Implemented Interfaces:
java.io.Serializable, Statement

public class CreateTableStatement
extends java.lang.Object
implements Statement

An SQL CREATE statement. CreateStatement ::= CREATE TABLE name ( field_name field_type [modifiers], ... ) field_type ::= DATE | YEAR | ENUM | SET | ... modifiers ::= AUTO_INCREMENT | BINARY | NOT NULL | ...

See Also:
Serialized Form

Constructor Summary
CreateTableStatement(java.lang.String tableName)
          Create a CREATE statement on a given table
 
Method Summary
 boolean equals(java.lang.Object obj)
          Returns true if cts represents exactly the same CREATE TABLE statement as 'this'.
 java.util.Vector getColumns()
          Returns the columns.
 java.lang.String getDifferenceMessage()
          Returns a message outlining the reason for equals() returning false.
 java.lang.String getTableName()
          Returns the tableName.
 boolean isEquivalentTo(CreateTableStatement createTable)
          Returns true if cts is equivalent to this CreateTableStatement.
static CreateTableStatement parse(java.lang.String createStatement)
          Parses the CREATE TABLE statement into a CreateTableStatement object.
 void setColumns(java.util.Vector columns)
          Sets the list of columns.
 void setPrimaryKeyColumns(java.util.Vector pks)
          Sets the list of primary key columns.
 void setTableName(java.lang.String tableName)
          Sets the tableName.
 java.lang.String toString()
          Returns this CREATE statement as an SQL String.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CreateTableStatement

public CreateTableStatement(java.lang.String tableName)
Create a CREATE statement on a given table

Parameters:
tableName - Name of table to create.
Method Detail

setColumns

public void setColumns(java.util.Vector columns)
Sets the list of columns.

Parameters:
columns - The list of ColumnDefinition objects.

getColumns

public java.util.Vector getColumns()
Returns the columns.

Returns:
The list of ColumnDefinition objects.

setPrimaryKeyColumns

public void setPrimaryKeyColumns(java.util.Vector pks)
Sets the list of primary key columns.

Parameters:
pks - Column names that form the Primary Key.

setTableName

public void setTableName(java.lang.String tableName)
Sets the tableName.

Parameters:
tableName - The tableName to set

getTableName

public java.lang.String getTableName()
Returns the tableName.

Returns:
The table name.

equals

public boolean equals(java.lang.Object obj)
Returns true if cts represents exactly the same CREATE TABLE statement as 'this'. Overrides Object#equals(Object).

Returns:
True if this object matches the given object.

isEquivalentTo

public boolean isEquivalentTo(CreateTableStatement createTable)
Returns true if cts is equivalent to this CreateTableStatement.

Parameters:
createTable - CreateTableStatement.
Returns:
True if this CreateTableStatement is equivalent to the given CreateTableStatement.

parse

public static CreateTableStatement parse(java.lang.String createStatement)
                                  throws ParseException
Parses the CREATE TABLE statement into a CreateTableStatement object.

Parameters:
createStatement - SQL CREATE TABLE statement as a String.
Returns:
SQL CREATE TABLE statement as a CreateTableStatement.
Throws:
ParseException - Thrown if the CREATE TABLE statement is invalid.

getDifferenceMessage

public java.lang.String getDifferenceMessage()
Returns a message outlining the reason for equals() returning false.

Returns:
The difference message.

toString

public java.lang.String toString()
Returns this CREATE statement as an SQL String.

Returns:
This as a String.