Top Description Fields Constructors Methods
org.hsqldb.dbinfo

pack-priv Class DatabaseInformationMain

extends DatabaseInformation
Class Inheritance
Known Direct Subclasses
org.hsqldb.dbinfo.DatabaseInformationFull
Imports
org.hsqldb.ColumnSchema, .Constraint, .Database, .HsqlException, .HsqlNameManager, .HsqlNameManager.HsqlName, .NumberSequence, .Routine, .RoutineSchema, .SchemaObject, .Session, .SqlInvariants, .Table, .TableBase, .Tokens, .TypeInvariants, org.hsqldb.index.Index, org.hsqldb.lib.HashSet, .HsqlArrayList, .Iterator, .OrderedHashSet, .WrapperIterator, org.hsqldb.map.ValuePool, org.hsqldb.persist.HsqlDatabaseProperties, .HsqlProperties, .HsqlProperties.PropertyMeta, .PersistentStore, org.hsqldb.rights.GrantConstants, .Grantee, .GranteeManager, .Right, .User, org.hsqldb.types.Charset, .DateTimeType, .IntervalType, .NumberType, .Type, .Types

Provides definitions for a few of the SQL Standard Schemata views that are supported by HSQLDB.

Provides definitions for some of HSQLDB's additional system view. The views supported in this class are mainly those that are needed to build the ResultSet objects that are returned by JDBC DatabaseMetaData calls.

The definitions for the rest of SQL standard and HSQLDB specific system views are provided by DatabaseInformationFull, which extends this class.

Produces a collection of views that form the system data dictionary.

Implementations use a group of arrays of equal size to store various attributes or cached instances of system tables.

Two fixed static lists of reserved table names are kept in String[] and HsqlName[] forms. These are shared by all implementations of DatabaseInformtion.

Each implementation keeps a lookup set of names for those tables whose contents are never cached (nonCachedTablesSet).

An instance of this class uses three lists named sysTablexxxx for caching system tables.

sysTableSessionDependent indicates which tables contain data that is dependent on the user rights of the User associated with the Session.

sysTableSessions contains the Session with whose rights each cached table was built.

sysTables contains the cached tables.

At the time of instantiation, which is part of the Database.open() method invocation, an empty table is created and placed in sysTables with calls to generateTable(int) for each name in sysTableNames. Some of these table entries may be null if an implementation does not produce them.

Calls to setStore(String, Session) return a cached table if various caching rules are met (see below), or it will delete all rows of the table and rebuild the contents via generateTable(int).

generateTable(int) calls the appropriate single method for each table. These methods either build and return an empty table (if sysTables contains null for the table slot) or populate the table with up-to-date rows.

Rules for caching are applied as follows:

If a table has non-cached contents, its contents are cleared and rebuilt.

For the rest of the tables, if the table has not been built for the Session object, or it is out of date, the table contents are cleared and rebuilt.

(fredt@users)

Authors
Campbell Burnet (campbell-burnet@users dot sourceforge.net), Fred Toussi (fredt@users dot sourceforge.net)
Since
1.7.2
Version
2.7.3

Field Summary

Modifier and TypeField and Description
pack-priv static Type
pack-priv static Type
protected static final HashSet<String>
nonCachedTablesSet

Set: { names of system tables that are not to be cached }

pack-priv static Type
protected static final HsqlNameManager.HsqlName[]
sysTableHsqlNames

The HsqlNames of the system tables.

protected final Table[]
sysTables

cache of system tables

protected static final boolean[]
sysTableSessionDependent

true if the contents of a cached system table depends on the session

protected static final String[]
tableTypes

The table types HSQLDB supports.

pack-priv static Type
pack-priv static Type
Inherited from org.hsqldb.dbinfo.DatabaseInformation:
ADMINISTRABLE_ROLE_AUTHORIZATIONSAPPLICABLE_ROLESASSERTIONSAUTHORIZATIONSCHARACTER_SETSCHECK_CONSTRAINT_ROUTINE_USAGECHECK_CONSTRAINTSCOLLATIONSCOLUMN_COLUMN_USAGECOLUMN_DOMAIN_USAGECOLUMN_PRIVILEGESCOLUMN_UDT_USAGECOLUMNSCONSTRAINT_COLUMN_USAGECONSTRAINT_PERIOD_USAGECONSTRAINT_TABLE_USAGEDATA_TYPE_PRIVILEGESdatabaseDOMAIN_CONSTRAINTSDOMAINSELEMENT_TYPESENABLED_ROLESINFORMATION_SCHEMA_CATALOG_NAMEJAR_JAR_USAGEJARSKEY_COLUMN_USAGEKEY_PERIOD_USAGEMETHOD_SPECIFICATIONSMODULE_COLUMN_USAGEMODULE_PRIVILEGESMODULE_TABLE_USAGEMODULESPARAMETERSPERIODSREFERENTIAL_CONSTRAINTSROLE_AUTHORIZATION_DESCRIPTORSROLE_COLUMN_GRANTSROLE_MODULE_GRANTSROLE_ROUTINE_GRANTSROLE_TABLE_GRANTSROLE_UDT_GRANTSROLE_USAGE_GRANTSROUTINE_COLUMN_USAGEROUTINE_JAR_USAGEROUTINE_PERIOD_USAGEROUTINE_PRIVILEGESROUTINE_ROUTINE_USAGEROUTINE_SEQUENCE_USAGEROUTINE_TABLE_USAGEROUTINESSCHEMATASEQUENCESSQL_FEATURESSQL_IMPLEMENTATION_INFOSQL_PACKAGESSQL_PARTSSQL_SIZINGSQL_SIZING_PROFILESsysTableNamessysTableNamesMapSYSTEM_BESTROWIDENTIFIERSYSTEM_CACHEINFOSYSTEM_COLUMN_SEQUENCE_USAGESYSTEM_COLUMNSSYSTEM_COMMENTSSYSTEM_CONNECTION_PROPERTIESSYSTEM_CROSSREFERENCESYSTEM_INDEXINFOSYSTEM_INDEXSTATSSYSTEM_KEY_INDEX_USAGESYSTEM_PRIMARYKEYSSYSTEM_PROCEDURECOLUMNSSYSTEM_PROCEDURESSYSTEM_PROPERTIESSYSTEM_SCHEMASSYSTEM_SEQUENCESSYSTEM_SESSIONINFOSYSTEM_SESSIONSSYSTEM_SYNONYMSSYSTEM_TABLESSYSTEM_TABLESTATSSYSTEM_TABLETYPESSYSTEM_TEXTTABLESSYSTEM_TYPEINFOSYSTEM_UDTATTRIBUTESSYSTEM_UDTSSYSTEM_USERSSYSTEM_VERSIONCOLUMNSTABLE_CONSTRAINTSTABLE_PRIVILEGESTABLESTRANSLATIONSTRIGGER_COLUMN_USAGETRIGGER_PERIOD_USAGETRIGGER_ROUTINE_USAGETRIGGER_SEQUENCE_USAGETRIGGER_TABLE_USAGETRIGGERED_UPDATE_COLUMNSTRIGGERSTYPE_JAR_USAGEUDT_PRIVILEGESUSAGE_PRIVILEGESUSER_DEFINED_TYPESVIEW_COLUMN_USAGEVIEW_PERIOD_USAGEVIEW_ROUTINE_USAGEVIEW_TABLE_USAGEVIEWSwithContent

Constructor Summary

AccessConstructor and Description
pack-priv
DatabaseInformationMain(Database
the Database object for which this object produces system tables
db
)

Constructs a table producer which provides system tables for the specified Database object.

Method Summary

Modifier and TypeMethod and Description
protected final void
addColumn(Table t, String name, Type type)

protected void
addPColRows(Session session, Table
the table in which the rows are to be inserted
t
,
HsqlArrayList<String>
the list of procedure name aliases to which the specified column values apply
l
,
String
the procedure's catalog name
cat
,
String
the procedure's schema name
schem
,
String
the procedure's simple base (non-alias) name
pName
,
String
the procedure column name
cName
,
Integer
the column type (return, parameter, result)
cType
,
Integer
the column's data type code
dType
,
String
the column's canonical data type name
tName
,
Integer
the column's precision
prec
,
Integer
the column's buffer length
len
,
Integer
the column's scale (decimal digits)
scale
,
Integer
the column's numeric precision radix
radix
,
Integer
the column's java.sql.DatbaseMetaData nullabiliy code
nullability
,
String
a human-readable remark regarding the column
remark
,
String
String
colDefault
,
Integer
helper value to back JDBC contract sort order
sqlDataType
,
Integer
Integer
sqlDateTimeSub
,
Integer
Integer
charOctetLength
,
Integer
Integer
ordinalPosition
,
String
String
isNullable
,
String
the specific name of the procedure (typically but not limited to a fully qualified Java Method name and signature)
specificName
)

Inserts a set of procedure column description rows into the Table specified by the t argument.

protected void
addProcRows(Session session, Table
the table into which the specified rows will eventually be inserted
t
,
HsqlArrayList<String>
the list of procedure name aliases to which the specified column values apply
l
,
String
the procedure catalog name
cat
,
String
the procedure schema name
schem
,
String
the base (non-alias) procedure name
pName
,
Integer
the procedure input parameter count
ip
,
Integer
the procedure output parameter count
op
,
Integer
the procedure result column count
rs
,
String
a human-readable remark regarding the procedure
remark
,
Integer
the procedure type code, indicating whether it is a function, procedure, or uncatagorized (i.e. returns a value, does not return a value, or it is unknown if it returns a value)
pType
,
String
the specific name of the procedure (typically but not limited to a fully qualified Java Method name and signature)
specificName
,
String
origin of the procedure, e.g. (["BUILTIN" | "USER DEFINED"] "ROUTINE" | "TRIGGER") | "ALIAS", etc.
origin
)

Inserts a set of procedure description rows into the Table object specified by the t argument.

protected final Iterator<Table>

Returns:

an enumeration over all the tables in this database
allTables
()

Retrieves an enumeration over all the tables in this database.

protected final Iterator<Table>
protected final Long
cardinal(long value)

ensures int or long value is CARDINAL_NUMBER (Long) for insertion in sys table

pack-priv final Table

Returns:

a Table object describing the visible access rights for all visible columns of all accessible tables defined within this database
COLUMN_PRIVILEGES
(Session session, PersistentStore store)

Retrieves a Table object describing the visible access rights for all visible columns of all accessible tables defined within this database.

protected final Table

Returns:

a new system table
createBlankTable
(HsqlNameManager.HsqlName
of the table
name
)

Creates a new primoidal system table with the specified name.

protected Table

Returns:

the system table corresponding to the specified tableIndex value
generateTable
(Session session, PersistentStore store, int
int value identifying the system table to generate
tableIndex
)

Retrieves the system table corresponding to the specified tableIndex value.

public final Table

Returns:

a system table corresponding to the name and session arguments
getSystemTable
(Session
the Session object requesting the table
session
,
String
a String identifying the desired table database access error occurs
name
)

Overrides org.hsqldb.dbinfo.DatabaseInformation.getSystemTable.

Retrieves the system Table object corresponding to the given name and session arguments.

pack-priv final Table

Returns:

a Table object naming the accessible catalogs defined within this database
INFORMATION_SCHEMA_CATALOG_NAME
(Session session, PersistentStore store)

Retrieves a Table object naming the accessible catalogs defined within this database.

protected final void
init(Session session)

One time initialisation of instance attributes at construction time.

protected final Integer
integer32(int value)

ensures int value is Integer for insertion in sys table

private boolean

Returns:

true if the table is accessible, else false
isAccessible
(Session session, SchemaObject
the schmea object for which to check accessibility
object
)

Retrieves whether any form of SQL access is allowed against the specified table w.r.t the database access rights assigned to current Session object's User.

public boolean
pack-priv final Table

Returns:

Table
SEQUENCES
(Session session, PersistentStore store)

The SEQUENCES view has one row for each external sequence generator.

public final void
setStore(Session session, Table table, PersistentStore store)

Overrides org.hsqldb.dbinfo.DatabaseInformation.setStore.

Sets the store for the given session, populates the store if necessary.

pack-priv final Table

Returns:

a Table object describing the optimal set of visible columns that uniquely identifies a row for each accessible table defined within this database
SYSTEM_BESTROWIDENTIFIER
(Session session, PersistentStore store)

Retrieves a Table object describing the optimal set of visible columns that uniquely identifies a row for each accessible table defined within this database.

pack-priv final Table

Returns:

a Table object describing the visible columns of all accessible tables defined within this database.
SYSTEM_COLUMNS
(Session session, PersistentStore store)

Retrieves a Table object describing the visible columns of all accessible tables defined within this database.

pack-priv final Table

Returns:

Result
  • NAME String : The name of the client info property
  • MAX_LEN int : The maximum length of the value for the property
  • DEFAULT_VALUE String : The default value of the property
  • DESCRIPTION String : A description of the property. This will typically contain information as to where this property is stored in the database.
SYSTEM_CONNECTION_PROPERTIES
(Session session, PersistentStore store)

getClientInfoProperties

pack-priv final Table

Returns:

a Table object describing how accessible tables import other accessible tables' primary key and/or unique constraint columns
SYSTEM_CROSSREFERENCE
(Session session, PersistentStore store)

Retrieves a Table object describing, for each accessible referencing and referenced table, how the referencing tables import, for the purposes of referential integrity, the columns of the referenced tables.

pack-priv final Table

Returns:

a Table object describing the visible Index objects for each accessible table defined within this database.
SYSTEM_INDEXINFO
(Session session, PersistentStore store)

Retrieves a Table object describing the visible Index objects for each accessible table defined within this database.

pack-priv final Table

Returns:

a Table object describing the visible primary key columns of each accessible table defined within this database.
SYSTEM_PRIMARYKEYS
(Session session, PersistentStore store)

Retrieves a Table object describing the visible primary key columns of each accessible table defined within this database.

pack-priv Table

Returns:

a Table object describing the return, parameter and result columns of the accessible routines defined within this database.
SYSTEM_PROCEDURECOLUMNS
(Session session, PersistentStore store)

Retrieves a Table object describing the return, parameter and result columns of the accessible routines defined within this database.

pack-priv Table

Returns:

a Table object describing the accessible routines defined within this database
SYSTEM_PROCEDURES
(Session session, PersistentStore store)

Retrieves a Table object describing the accessible routines (both functions and procedures) defined within this database.

pack-priv final Table

Returns:

table containing information about schemas defined within this database
SYSTEM_SCHEMAS
(Session session, PersistentStore store)

Retrieves a Table object describing the accessible schemas defined within this database.

pack-priv final Table
pack-priv final Table

Returns:

a Table object describing the accessible tables defined within this database
SYSTEM_TABLES
(Session session, PersistentStore store)

Retrieves a Table object describing the accessible tables defined within this database.

pack-priv Table

Returns:

a Table object describing the table types available in this database
SYSTEM_TABLETYPES
(Session session, PersistentStore store)

Retrieves a Table object describing the table types available in this database.

pack-priv final Table

Returns:

a Table object describing the system-defined SQL types supported as table columns
SYSTEM_TYPEINFO
(Session session, PersistentStore store)

Retrieves a Table object describing the result expected by the JDBC DatabaseMetaData interface implementation for system-defined SQL types supported as table columns.

pack-priv Table

Returns:

a Table object describing the accessible attrubutes of the accessible user-defined type (UDT) objects defined within this database
SYSTEM_UDTATTRIBUTES
(Session session, PersistentStore store)

Retrieves a Table object describing the accessible attributes of the accessible user-defined type (UDT) objects defined within this database.

pack-priv Table

Returns:

a Table object describing the accessible user-defined types defined in this database
SYSTEM_UDTS
(Session session, PersistentStore store)

Retrieves a Table object describing the accessible user-defined types defined in this database.

pack-priv Table

Returns:

table containing information about the users defined within this database
SYSTEM_USERS
(Session session, PersistentStore store)

Retrieves a Table object describing the visible Users defined within this database.

pack-priv Table

Returns:

a Table object describing the columns that are automatically updated when any value in a row is updated
SYSTEM_VERSIONCOLUMNS
(Session session, PersistentStore store)

Retrieves a Table object describing the accessible columns that are automatically updated when any value in a row is updated.

pack-priv final Table

Returns:

a Table object describing the visible access rights for each accessible table defined within this database
TABLE_PRIVILEGES
(Session session, PersistentStore store)

The TABLE_PRIVILEGES view has one row for each visible access right for each accessible table defined within this database.

pack-priv Table
TABLES(Session session, PersistentStore store)

Inherited from org.hsqldb.dbinfo.DatabaseInformation:
getSysTableIDisSystemTablenewDatabaseInformationsetWithContent