its.SQL
Class Schema

java.lang.Object
  extended byits.SQL.Schema

public class Schema
extends java.lang.Object

Provides an object-oriented view of the SDD Schema frame. Created and used by the SDD Parser to store information parsed from the SDD Schema frame.


Constructor Summary
Schema()
          Creates an empty Schema object.
Schema(Schema s)
          Returns a new Schema object that is a clone of the given Schema object.
Schema(java.lang.String def)
          Creates a Schema object given a String containing the SQL CREATE SCHEMA statement.
 
Method Summary
 void addTable(Table t)
          Used by the SDD Schema parser to build up a Schema object.
 Table getTable(java.lang.String name)
           
 java.util.Vector getTableNames()
           
 boolean hasTable(java.lang.String name)
           
 Table removeTable(java.lang.String tableName)
           
 java.util.Enumeration tables()
           
 java.lang.String toSql()
          Generates the CREATE SCHEMA statement that defines this schema.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Schema

public Schema()
Creates an empty Schema object. Tables can be added with the addTable method.


Schema

public Schema(java.lang.String def)
       throws SchemaParserException,
              java.lang.Exception
Creates a Schema object given a String containing the SQL CREATE SCHEMA statement. Invokes the SDD Schema parser, which only handles a subset of entry-level SQL. Intended use is for database applications that need the functionality of the Schema, Table, Variable, and ContentsData classes, but that define their own database schemas. SDD Receivers, on the other hand, should obtain the SDD Schema object from SchemaEvent.getSchemaObject.

Throws:
SchemaParserException - if the given statement does not parse
java.lang.Exception
See Also:
Parser.parseSchema(java.lang.String)

Schema

public Schema(Schema s)
Returns a new Schema object that is a clone of the given Schema object. Makes copies of the Table and Variable objects contained within the Schema.

Method Detail

addTable

public void addTable(Table t)
Used by the SDD Schema parser to build up a Schema object. If a table with the same name as the given table already exists in the Schema, it will be replaced.


removeTable

public Table removeTable(java.lang.String tableName)
Returns:
the table object that was removed, or null if the given table does not exist

getTableNames

public java.util.Vector getTableNames()
Returns:
the list of table names defined in the SDD Schema

getTable

public Table getTable(java.lang.String name)
               throws java.lang.IllegalArgumentException
Returns:
the table with the given name
Throws:
java.lang.IllegalArgumentException - if the table is not defined in the SDD Schema

tables

public java.util.Enumeration tables()
Returns:
an Enumeration of the tables in this schema

hasTable

public boolean hasTable(java.lang.String name)
Returns:
true if the schema defines a table with the given name

toSql

public java.lang.String toSql()
Generates the CREATE SCHEMA statement that defines this schema.