| java.lang.Object org.hsqldb.Database
Database | class Database implements MessageListener,MembershipListener(Code) | | Database is the root class for HSQL Database Engine database.
Although it either directly or indirectly provides all or most of the
services required for DBMS functionality, this class should not be used
directly by an application. Instead, to achieve portability and
generality, the jdbc* classes should be used.
version: 1.7.0 |
Inner Class :class Logger | |
Constructor Summary | |
| Database(String name) Constructs a new Database object that mounts or creates the database
files specified by the supplied name. |
Method Summary | |
public void | block() | synchronized Session | connect(String username, String password) Constructs a new Session that operates within (is connected to) the
context of this Database object. | void | dropTable(String name, boolean ifExists, boolean isView, Session session) Drops the specified user-defined view or table from this Database
object. | byte[] | execute(String user, String password, String statement) A specialized SQL statement executor, tailored for use by
WebServerConnection . | synchronized Result | execute(String statement, Session session) | synchronized Result | execute(String statement, Session session, boolean replicate) The main SQL statement executor. | public void | finalize() Called by the garbage collector on this Databases object when garbage
collection determines that there are no more references to it. | Table | findUserTable(String name) | Table | findUserTable(String name, Session session) | HsqlHashMap | getAlias() Retrieves a map from Java method-call name aliases to the
fully-qualified names of the Java methods themsleves. | String | getAlias(String s) Retieves a Java method's fully qualified name, given a String that is
supposedly an alias for it. | String | getName() Retrieves this Database object's name, as know to this Database
object. | HsqlDatabaseProperties | getProperties() Retrieves this Database object's properties. | Result | getScript(boolean drop, boolean insert, boolean cached, Session session) Generates a SQL script containing all or part of the SQL statements
required to recreate the current state of this Database object. | public Object | getState() | Table | getTable(String name, Session session) Retrieves the specified user defined table or view visible within the
context of the specified Session, or any system table of the given
name. | int | getTableIndex(Table table) Retrieves the index of a table or view in the HsqlArrayList that contains
these objects for a Database. | HsqlArrayList | getTables() Retrieves a HsqlArrayList containing references to all registered non-system
tables and views. | UserManager | getUserManager() Retrieves the UserManager object for this Database. | Table | getUserTable(String name, Session session) | Table | getUserTable(String name) | boolean | isIgnoreCase() isIgnoreCase attribute getter. | boolean | isReferentialIntegrity() isReferentialIntegrity attribute getter. | boolean | isShutdown() isShutdown attribute getter. | void | linkTable(Table t) Attempts to register the specified table or view with this Database
object. | String | printMessage(Message msg) | TempConstraint | processCreateFK(Tokenizer c, Session session, Table t, HsqlName cname) | public void | receive(Message msg) | void | registerSession(Session session) Binds the specified Session object into this Database object's active
session registry. | void | removeExportedKeys(Table toDrop) Removes any foreign key Constraint objects (exported keys) held by any
tables referenced by the specified table. | void | setReadOnly() Puts this Database object in global read-only mode. | void | setReferentialIntegrity(boolean ref) isReferentialIntegrity attribute setter. | public void | setState(Object state) | public void | suspect(Address suspected_mbr) | public void | viewAccepted(org.javagroups.View new_view) |
Database | Database(String name) throws SQLException(Code) | | Constructs a new Database object that mounts or creates the database
files specified by the supplied name.
Parameters: name - the path to and common name shared by the database filesthis Database uses exception: SQLException - if the specified path and common namecombination is illegal or unavailable, or the database files thename resolves to are in use by another process |
block | public void block()(Code) | | Block sending and receiving of messages until viewAccepted() is called
|
connect | synchronized Session connect(String username, String password) throws SQLException(Code) | | Constructs a new Session that operates within (is connected to) the
context of this Database object.
If successful, the new Session object initially operates on behalf of
the user specified by the supplied user name.
Parameters: username - the name of the initial user of this session. The usermust already exist in this Database object. Parameters: password - the password of the specified user. This must matchthe password, as known to this Database object, of the specifieduser a new Session object that initially that initially operates onbehalf of the specified user throws: SQLException - if the specified user does not exist or a badpassword is specified |
dropTable | void dropTable(String name, boolean ifExists, boolean isView, Session session) throws SQLException(Code) | | Drops the specified user-defined view or table from this Database
object.
The process of dropping a table or view includes:
- checking that the specified Session's currently connected User
has the right to perform this operation and refusing to proceed if
not by throwing.
- checking for referential constraints that conflict with this
operation and refusing to proceed if they exist by throwing.
- removing the specified Table from this Database object.
- removing any exported foreign keys Constraint objects held by
any tables referenced by the table to be dropped. This is especially
important so that the dropped Table ceases to be referenced,
eventually allowing its full garbage collection.
-
Parameters: name - of the table or view to drop Parameters: ifExists - if true and if the Table to drop does not exist, failsilently, else throw Parameters: isView - true if the name argument refers to a View Parameters: session - the connected context in which to perform thisoperation throws: SQLException - if any of the checks listed above fail |
execute | byte[] execute(String user, String password, String statement)(Code) | | A specialized SQL statement executor, tailored for use by
WebServerConnection . Calling this method fully connects the specified
user, executes the specifed statement, and then disconects.
Parameters: user - the name of the user for which to execute the specifiedstatement. The user must already exist in this Database object. Parameters: password - the password of the specified user. This must matchthe password, as known to this Database object, of the specifieduser Parameters: statement - the SQL statement to execute the result of executing the specified statement, in a formalready suitable for transmitting as part of an HTTP response. |
execute | synchronized Result execute(String statement, Session session, boolean replicate)(Code) | | The main SQL statement executor.
All requests to execute SQL statements against this Database object
eventually go through this method.
Parameters: statement - the SQL statement to execute Parameters: session - an object representing a connected user and acollection of session state attributes Parameters: replicate - If set the change will be replicated to other replicas. This is usedby the internal replication the result of executing the specified statement, in a formsuitable for either wrapping in a local ResultSet object or fortransmitting to a remote client via the native HSQLDB protocol |
finalize | public void finalize()(Code) | | Called by the garbage collector on this Databases object when garbage
collection determines that there are no more references to it.
|
getAlias | HsqlHashMap getAlias()(Code) | | Retrieves a map from Java method-call name aliases to the
fully-qualified names of the Java methods themsleves.
a map in the form of a HsqlHashMap |
getAlias | String getAlias(String s)(Code) | | Retieves a Java method's fully qualified name, given a String that is
supposedly an alias for it.
This is somewhat of a misnomer, since it is not an alias that is being
retrieved, but rather what the supplied alias maps to. If the
specified alias does not map to any registered Java method
fully-qualified name, then the specified String itself is returned.
Parameters: s - a call name alias that supposedly maps to a registered Javamethod a Java method fully-qualified name, or null if no method isregistered with the given alias |
getName | String getName()(Code) | | Retrieves this Database object's name, as know to this Database
object.
this Database object's name |
getProperties | HsqlDatabaseProperties getProperties()(Code) | | Retrieves this Database object's properties.
this Database object's properties object |
getScript | Result getScript(boolean drop, boolean insert, boolean cached, Session session) throws SQLException(Code) | | Generates a SQL script containing all or part of the SQL statements
required to recreate the current state of this Database object.
Parameters: drop - if true, include drop statements for each droppabledatabase object Parameters: insert - if true, include the insert statements required topopulate each of this Database object's memory tables to matchtheir current state. Parameters: cached - if true, include the insert statement required topopulate each of this Database object's CACHED tables to matchtheir current state. Parameters: session - the Session in which to generate the requested SQLscript A Result object consisting of one VARCHAR column with a rowfor each statement in the generated script throws: SQLException - if the specified Session's currently connectedUser does not have the right to call this method or there is someproblem generating the result |
getTable | Table getTable(String name, Session session) throws SQLException(Code) | | Retrieves the specified user defined table or view visible within the
context of the specified Session, or any system table of the given
name. This excludes any temp tables created in different Sessions.
Parameters: name - of the table or view to retrieve Parameters: session - the Session within which to search for user tables the user table or view, or system table throws: SQLException - if there is no such table or view |
getTableIndex | int getTableIndex(Table table)(Code) | | Retrieves the index of a table or view in the HsqlArrayList that contains
these objects for a Database.
Parameters: table - the Table object the index of the specified table or view, or -1 if not found |
getTables | HsqlArrayList getTables()(Code) | | Retrieves a HsqlArrayList containing references to all registered non-system
tables and views. This includes all tables and views registered with
this Database object via a call to
Database.linkTable linkTable .
a HsqlArrayList of all registered non-system tables and views |
getUserManager | UserManager getUserManager()(Code) | | Retrieves the UserManager object for this Database.
UserManager object |
isIgnoreCase | boolean isIgnoreCase()(Code) | | isIgnoreCase attribute getter.
the value of this Database object's isIgnoreCase attribute |
isReferentialIntegrity | boolean isReferentialIntegrity()(Code) | | isReferentialIntegrity attribute getter.
indicates whether this Database object is currently enforcingreferential integrity |
isShutdown | boolean isShutdown()(Code) | | isShutdown attribute getter.
the value of this Database object's isShutdown attribute |
linkTable | void linkTable(Table t) throws SQLException(Code) | | Attempts to register the specified table or view with this Database
object.
Parameters: t - the table of view to register throws: SQLException - if there is a problem |
printMessage | String printMessage(Message msg)(Code) | | ---------------------- End of MembershipListener interface ----------------------- *
|
receive | public void receive(Message msg)(Code) | | -------------------------- MessageListener interface -------------------------- *
|
registerSession | void registerSession(Session session)(Code) | | Binds the specified Session object into this Database object's active
session registry. This method is typically called from
Database.connect as the final step, when a successful connection has been
made.
Parameters: session - the Session object to register |
removeExportedKeys | void removeExportedKeys(Table toDrop)(Code) | | Removes any foreign key Constraint objects (exported keys) held by any
tables referenced by the specified table.
This method is called as the last step of a successful call to in
order to ensure that the dropped Table ceases to be referenced when
enforcing referential integrity.
Parameters: toDrop - The table to which other tables may be holding keys.This is typically a table that is in the process of being dropped. |
setReadOnly | void setReadOnly()(Code) | | Puts this Database object in global read-only mode. That is, after
this call, all existing and future sessions are limited to read-only
transactions. Any following attempts to update the state of the
database will result in throwing a SQLException.
|
setReferentialIntegrity | void setReferentialIntegrity(boolean ref)(Code) | | isReferentialIntegrity attribute setter.
Parameters: ref - if true, this Database object enforces referentialintegrity, else not |
suspect | public void suspect(Address suspected_mbr)(Code) | | Called when a member is suspected
|
viewAccepted | public void viewAccepted(org.javagroups.View new_view)(Code) | | -------------------------- MembershipListener interface -------------------------- *
|
|
|