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

Quick Search    Search Deep

org.hsqldb
Class View  view View download View.java

java.lang.Object
  extended byorg.hsqldb.Table
      extended byorg.hsqldb.View

class View
extends Table

Implementation of SQL VIEWS based on a SELECT query.

Version:
1.7.0

Field Summary
(package private) static int CACHED_TABLE
           
protected  Cache cCache
           
protected  Database dDatabase
           
(package private) static java.lang.String DEFAULT_PK
           
protected  int iColumnCount
           
protected  int indexType
           
protected  boolean isCached
           
protected  boolean isReadOnly
           
protected  boolean isTemp
           
protected  int iVisibleColumns
           
(package private) static int MEMORY_TABLE
           
protected  Session ownerSession
           
(package private)  java.lang.String sStatement
           
(package private) static int SYSTEM_TABLE
           
protected  HsqlName tableName
           
protected  int tableType
           
(package private) static int TEMP_TABLE
           
(package private) static int TEMP_TEXT_TABLE
           
(package private) static int TEXT_TABLE
           
(package private)  java.util.Vector vConstraint
           
(package private) static int VIEW
           
(package private)  java.util.Vector[] vTrigs
           
 
Constructor Summary
(package private) View(Database db, HsqlName name)
           
 
Method Summary
(package private)  void addColumn(Column column)
          Performs the table level checks and adds a column to the table at the DDL level.
(package private)  void addColumn(java.lang.String name, int type)
          Method declaration
(package private)  void addColumns(Result result)
          Method declaration
(package private)  void addConstraint(Constraint c)
          Method declaration
(package private)  void addTrigger(TriggerDef trigDef)
          Method declaration
(package private)  void checkCascadeDelete(java.lang.Object[] row, Session session, boolean delete)
          Method is called recursively on a tree of tables from the current one until no referring foreign-key table is left.
(package private)  void checkColumnsMatch(int[] col, Table other, int[] othercol)
          Match two columns arrays for length and type of coluns
(package private)  void checkDropIndex(java.lang.String indexname, java.util.Hashtable ignore)
          Checks for use of a named index in table constraints
(package private)  void checkUpdate(int[] col, Result deleted, Result inserted)
          Method declaration
(package private)  void cleanUp()
           
(package private)  Index createIndexPrivate(int[] column, HsqlName name, boolean unique)
          Method declaration
(package private)  void createPrimaryKey()
          Shortcut for creating default PK's
(package private)  void createPrimaryKey(HsqlName pkName, int[] columns)
          Adds the SYSTEM_ID column if no primary key is specified in DDL.
(package private)  void delete(java.lang.Object[] row, Session session)
          Method declaration
(package private)  void deleteNoCheck(java.lang.Object[] row, Session c, boolean log)
          Method declaration
protected  Table duplicate()
           
(package private)  boolean equals(java.lang.String other)
           
(package private)  boolean equals(java.lang.String other, Session c)
           
(package private)  void fireAll(int trigVecIndx)
          Method declaration
(package private)  void fireAll(int trigVecIndx, java.lang.Object[] row)
          Method declaration
(package private)  Column getColumn(int i)
          Method declaration
(package private)  int getColumnCount()
          Method declaration
(package private)  int getColumnNr(java.lang.String c)
          Method declaration
(package private)  int[] getColumnTypes()
          Method declaration
(package private)  Constraint getConstraint(java.lang.String s)
          return the named constriant
(package private)  int getConstraintIndex(java.lang.String s)
          Return the position of the constraint within the list
(package private)  Index getConstraintIndexForColumns(int[] col, boolean unique)
          Get the index supporting a constraint that can be used as an index of the given type and index column signature.
(package private)  java.util.Vector getConstraints()
          Method declaration
protected  java.lang.String getDataSource()
           
(package private)  int getIdentityColumn()
          Method declaration
protected  Index getIndex(int i)
          Method declaration
(package private)  Index getIndex(java.lang.String s)
          Method declaration
(package private)  int getIndexCount()
          Method declaration
(package private)  Index getIndexForColumn(int column)
          Method declaration
(package private)  Index getIndexForColumns(int[] col, boolean unique)
          Finds an existing index for a foreign key column group
(package private)  java.lang.String getIndexRoots()
          Method declaration
(package private)  int[] getIndexRootsArray()
          Return the list of file pointers to root nodes for this table's indexes.
(package private)  int getIndexType()
           
(package private)  java.lang.String getInsertStatement(java.lang.Object[] row)
          Method declaration
(package private)  int getInternalColumnCount()
          Method declaration
(package private)  HsqlName getName()
          Method declaration
(package private)  java.lang.Object[] getNewRow()
          Method declaration
(package private)  int getNextConstraintIndex(int from, int type)
          Method declaration
(package private)  Index getNextIndex(Index index)
          Method declaration
(package private)  Session getOwnerSession()
           
(package private)  Index getPrimaryIndex()
          Method declaration
(package private)  Row getRow(int pos)
          Method declaration
(package private)  java.lang.String getStatement()
           
(package private)  void indexRow(Row r, boolean inserted)
           
(package private)  void insert(java.lang.Object[] row, Session c)
          Method declaration
(package private)  void insert(Result result, Session c)
          Method declaration
(package private)  void insertNoCheck(java.lang.Object[] row, Session c, boolean log)
          Method declaration
(package private)  boolean isCached()
          Method declaration
(package private)  boolean isDataReadOnly()
           
protected  boolean isDescDataSource()
           
(package private)  boolean isEmpty()
          Method declaration
(package private)  boolean isIndexCached()
          Method declaration
(package private)  boolean isTemp()
           
(package private)  boolean isText()
           
(package private)  boolean isView()
           
(package private)  void moveData(Table from, int colindex, int adjust)
          Method declaration
(package private)  Table moveDefinition(java.lang.String withoutindex, Column newcolumn, int colindex, int adjust)
          DROP INDEX and CREATE INDEX on non empty tables both recreate the table and the data to reflect the new indexing structure.
(package private)  void putRow(CachedRow r)
           
(package private)  void removeRow(CachedRow r)
           
(package private)  int searchColumn(java.lang.String c)
          Method declaration
(package private)  void setDataReadOnly(boolean value)
           
protected  void setDataSource(java.lang.String source, boolean isDesc, Session s)
           
(package private)  void setIndexRoots(int[] roots)
          Method declaration
(package private)  void setIndexRoots(java.lang.String s)
          Method declaration
(package private)  void setName(java.lang.String name, boolean isquoted)
          Changes table name.
(package private)  void setStatement(java.lang.String s)
          Tokenize the SELECT statement to get rid of any comment line that may exist at the end.
(package private)  void updateConstraints(Table to, int colindex, int adjust)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sStatement

java.lang.String sStatement

SYSTEM_TABLE

static final int SYSTEM_TABLE
See Also:
Constant Field Values

TEMP_TABLE

static final int TEMP_TABLE
See Also:
Constant Field Values

MEMORY_TABLE

static final int MEMORY_TABLE
See Also:
Constant Field Values

CACHED_TABLE

static final int CACHED_TABLE
See Also:
Constant Field Values

TEMP_TEXT_TABLE

static final int TEMP_TEXT_TABLE
See Also:
Constant Field Values

TEXT_TABLE

static final int TEXT_TABLE
See Also:
Constant Field Values

VIEW

static final int VIEW
See Also:
Constant Field Values

DEFAULT_PK

static final java.lang.String DEFAULT_PK
See Also:
Constant Field Values

vConstraint

java.util.Vector vConstraint

vTrigs

java.util.Vector[] vTrigs

iColumnCount

protected int iColumnCount

iVisibleColumns

protected int iVisibleColumns

dDatabase

protected Database dDatabase

cCache

protected Cache cCache

tableName

protected HsqlName tableName

tableType

protected int tableType

ownerSession

protected Session ownerSession

isReadOnly

protected boolean isReadOnly

isTemp

protected boolean isTemp

isCached

protected boolean isCached

indexType

protected int indexType
Constructor Detail

View

View(Database db,
     HsqlName name)
throws java.sql.SQLException
Method Detail

addColumns

void addColumns(Result result)
          throws java.sql.SQLException
Description copied from class: Table
Method declaration

Overrides:
addColumns in class Table

setStatement

void setStatement(java.lang.String s)
            throws java.sql.SQLException
Tokenize the SELECT statement to get rid of any comment line that may exist at the end. Store the result for performing selects and logging the DDL at checkpoints.


getStatement

java.lang.String getStatement()
                        throws java.sql.SQLException

equals

boolean equals(java.lang.String other,
               Session c)

equals

boolean equals(java.lang.String other)

isText

final boolean isText()

isTemp

final boolean isTemp()

isView

final boolean isView()

getIndexType

final int getIndexType()

isDataReadOnly

final boolean isDataReadOnly()

setDataReadOnly

void setDataReadOnly(boolean value)
               throws java.sql.SQLException

getOwnerSession

Session getOwnerSession()

setDataSource

protected void setDataSource(java.lang.String source,
                             boolean isDesc,
                             Session s)
                      throws java.sql.SQLException

getDataSource

protected java.lang.String getDataSource()
                                  throws java.sql.SQLException

isDescDataSource

protected boolean isDescDataSource()
                            throws java.sql.SQLException

addConstraint

void addConstraint(Constraint c)
Method declaration


getConstraints

java.util.Vector getConstraints()
Method declaration


getConstraintIndexForColumns

Index getConstraintIndexForColumns(int[] col,
                                   boolean unique)
Get the index supporting a constraint that can be used as an index of the given type and index column signature.


getNextConstraintIndex

int getNextConstraintIndex(int from,
                           int type)
Method declaration


addColumn

void addColumn(java.lang.String name,
               int type)
         throws java.sql.SQLException
Method declaration


addColumn

void addColumn(Column column)
         throws java.sql.SQLException
Performs the table level checks and adds a column to the table at the DDL level.


getName

HsqlName getName()
Method declaration


setName

void setName(java.lang.String name,
             boolean isquoted)
Changes table name. Used by 'alter table rename to'


getInternalColumnCount

int getInternalColumnCount()
Method declaration


duplicate

protected Table duplicate()
                   throws java.sql.SQLException

checkColumnsMatch

void checkColumnsMatch(int[] col,
                       Table other,
                       int[] othercol)
                 throws java.sql.SQLException
Match two columns arrays for length and type of coluns


moveDefinition

Table moveDefinition(java.lang.String withoutindex,
                     Column newcolumn,
                     int colindex,
                     int adjust)
               throws java.sql.SQLException
DROP INDEX and CREATE INDEX on non empty tables both recreate the table and the data to reflect the new indexing structure. The new structure should be reflected in the DDL script, otherwise if a SHUTDOWN IMMEDIATE occures, the following will happen:
If the table is cached, the index roots will be different from what is specified in SET INDEX ROOTS.
If the table is memory, the old index will be used until the script reaches drop index etc. and data is recreated again. The fix avoids scripting the row insert and delete ops. Constraints that need removing are removed outside this (fredt@users)


updateConstraints

void updateConstraints(Table to,
                       int colindex,
                       int adjust)
                 throws java.sql.SQLException

getColumnCount

int getColumnCount()
Method declaration


getIndexCount

int getIndexCount()
Method declaration


getIdentityColumn

int getIdentityColumn()
Method declaration


getColumnNr

int getColumnNr(java.lang.String c)
          throws java.sql.SQLException
Method declaration


searchColumn

int searchColumn(java.lang.String c)
Method declaration


getPrimaryIndex

Index getPrimaryIndex()
Method declaration


getIndexForColumn

Index getIndexForColumn(int column)
                  throws java.sql.SQLException
Method declaration


getIndexForColumns

Index getIndexForColumns(int[] col,
                         boolean unique)
                   throws java.sql.SQLException
Finds an existing index for a foreign key column group


getIndexRootsArray

int[] getIndexRootsArray()
                   throws java.sql.SQLException
Return the list of file pointers to root nodes for this table's indexes.


getIndexRoots

java.lang.String getIndexRoots()
                         throws java.sql.SQLException
Method declaration


setIndexRoots

void setIndexRoots(int[] roots)
             throws java.sql.SQLException
Method declaration


setIndexRoots

void setIndexRoots(java.lang.String s)
             throws java.sql.SQLException
Method declaration


getNextIndex

Index getNextIndex(Index index)
Method declaration


createPrimaryKey

void createPrimaryKey()
                throws java.sql.SQLException
Shortcut for creating default PK's


createPrimaryKey

void createPrimaryKey(HsqlName pkName,
                      int[] columns)
                throws java.sql.SQLException
Adds the SYSTEM_ID column if no primary key is specified in DDL. Creates a single or multi-column primary key and index. sets the colTypes array. Finalises the creation of the table. (fredt@users)


createIndexPrivate

Index createIndexPrivate(int[] column,
                         HsqlName name,
                         boolean unique)
                   throws java.sql.SQLException
Method declaration


checkDropIndex

void checkDropIndex(java.lang.String indexname,
                    java.util.Hashtable ignore)
              throws java.sql.SQLException
Checks for use of a named index in table constraints


isEmpty

boolean isEmpty()
Method declaration


getNewRow

java.lang.Object[] getNewRow()
Method declaration


moveData

void moveData(Table from,
              int colindex,
              int adjust)
        throws java.sql.SQLException
Method declaration


checkUpdate

void checkUpdate(int[] col,
                 Result deleted,
                 Result inserted)
           throws java.sql.SQLException
Method declaration


insert

void insert(Result result,
            Session c)
      throws java.sql.SQLException
Method declaration


insert

void insert(java.lang.Object[] row,
            Session c)
      throws java.sql.SQLException
Method declaration


insertNoCheck

void insertNoCheck(java.lang.Object[] row,
                   Session c,
                   boolean log)
             throws java.sql.SQLException
Method declaration


fireAll

void fireAll(int trigVecIndx,
             java.lang.Object[] row)
Method declaration


fireAll

void fireAll(int trigVecIndx)
Method declaration


addTrigger

void addTrigger(TriggerDef trigDef)
Method declaration


checkCascadeDelete

void checkCascadeDelete(java.lang.Object[] row,
                        Session session,
                        boolean delete)
                  throws java.sql.SQLException
Method is called recursively on a tree of tables from the current one until no referring foreign-key table is left. In the process, if a non-cascading foreign-key referring table contains data, an exception is thrown. Parameter delete indicates whether to delete refering rows. The method is called first to check if the row can be deleted, then to delete the row and all the refering rows. (fredt@users)


delete

void delete(java.lang.Object[] row,
            Session session)
      throws java.sql.SQLException
Method declaration


deleteNoCheck

void deleteNoCheck(java.lang.Object[] row,
                   Session c,
                   boolean log)
             throws java.sql.SQLException
Method declaration


getInsertStatement

java.lang.String getInsertStatement(java.lang.Object[] row)
                              throws java.sql.SQLException
Method declaration


isCached

boolean isCached()
Method declaration


isIndexCached

boolean isIndexCached()
Method declaration


getIndex

Index getIndex(java.lang.String s)
Method declaration


getConstraintIndex

int getConstraintIndex(java.lang.String s)
Return the position of the constraint within the list


getConstraint

Constraint getConstraint(java.lang.String s)
return the named constriant


getColumn

Column getColumn(int i)
Method declaration


getColumnTypes

int[] getColumnTypes()
Method declaration


getIndex

protected Index getIndex(int i)
Method declaration


getRow

Row getRow(int pos)
     throws java.sql.SQLException
Method declaration


putRow

void putRow(CachedRow r)
      throws java.sql.SQLException

removeRow

void removeRow(CachedRow r)
         throws java.sql.SQLException

cleanUp

void cleanUp()
       throws java.sql.SQLException

indexRow

void indexRow(Row r,
              boolean inserted)
        throws java.sql.SQLException