Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.hsqldb
Class TableWorks  view TableWorks download TableWorks.java

java.lang.Object
  extended byorg.hsqldb.TableWorks

class TableWorks
extends java.lang.Object

The methods in this class perform alterations to the structure of an existing table which may result in a new Table object

Version:
1.7.0

Field Summary
private  Table table
           
 
Constructor Summary
(package private) TableWorks(Table table)
           
 
Method Summary
(package private)  void addOrDropColumn(Column column, int colindex, int adjust)
           
(package private)  void createForeignKey(int[] fkcol, int[] expcol, HsqlName fkname, Table expTable, boolean cascade)
          Creates a foreign key according to current sql.strict_fk or sql.strong_fk settings.
(package private)  Index createIndex(int[] col, HsqlName name, boolean unique)
          Because of the way indexes and column data are held in memory and on disk, it is necessary to recreate the table when an index is added to a non-empty table.
(package private)  void createUniqueConstraint(int[] col, HsqlName name)
          A unique constraint relies on a unique indexe on the table.
(package private)  void dropConstraint(java.lang.String name)
          Method declaration
(package private)  void dropIndex(java.lang.String indexname)
          Because of the way indexes and column data are held in memory and on disk, it is necessary to recreate the table when an index is added to a non-empty table.
(package private)  Table getTable()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

table

private Table table
Constructor Detail

TableWorks

TableWorks(Table table)
Method Detail

getTable

Table getTable()

createForeignKey

void createForeignKey(int[] fkcol,
                      int[] expcol,
                      HsqlName fkname,
                      Table expTable,
                      boolean cascade)
                throws java.sql.SQLException
Creates a foreign key according to current sql.strict_fk or sql.strong_fk settings. Foreign keys are enforced via indexes on both the referencing (child) and referenced (parent) tables.

If sql.strict_fk is set (default for new databases) a pre-existing primary key or unique index is required on the referenced columns of the referenced table.

When there is no primary key or unique index, a new index is created automatically. If sql.strong_fk is set in the abasence of sql.strict_fk, this automatic index will be a unique index. Otherwise (for compatibility with existing data created with HSQLDB 1.61 or earlier) it will be an ordinary index. The non-unique index on the referencing table is created if none exits. The existence of a PK or unique constraint is required for backward referencing foreign keys. This is becuase the index must always be created before the foreign key DDL is processed. Any index, including a user-defined one can be used for forward referencing FK's. Foriegn keys on temp tables can reference other temp tables with the same rules above. When they reference other permanent tables, the sql.strict_fk is always applied. Foreign keys on permanent tables cannot reference temp tables. Currently, duplicate foreign keys can be declared, but they do not create any additional indexes. (fred@users)


createIndex

Index createIndex(int[] col,
                  HsqlName name,
                  boolean unique)
            throws java.sql.SQLException
Because of the way indexes and column data are held in memory and on disk, it is necessary to recreate the table when an index is added to a non-empty table. (fredt@users)


createUniqueConstraint

void createUniqueConstraint(int[] col,
                            HsqlName name)
                      throws java.sql.SQLException
A unique constraint relies on a unique indexe on the table. It can cover a single column or multiple columns.

All unique constraint names are generated by Database.java as unique within the database. Duplicate constraints (more than one unique constriant on the same set of columns are still allowed but the names will be different. (fredt@users)


dropIndex

void dropIndex(java.lang.String indexname)
         throws java.sql.SQLException
Because of the way indexes and column data are held in memory and on disk, it is necessary to recreate the table when an index is added to a non-empty table.

Originally, this method would break existing foreign keys as the table order in the DB was changed. The new table is now linked in place of the old table (fredt@users)


addOrDropColumn

void addOrDropColumn(Column column,
                     int colindex,
                     int adjust)
               throws java.sql.SQLException

dropConstraint

void dropConstraint(java.lang.String name)
              throws java.sql.SQLException
Method declaration