gate.db
Class Checker
java.lang.Object
|
+--gate.db.Checker
- public class Checker
- extends Object
This class provides some static methods needed by other classes for
database check/setup-ing.
It also holds the database structure needed by Gate2 in order to be
able to work with a given database.
Field Summary |
protected static Table[] |
DDL
This represents the database structure required by Gate2 to run. |
private static boolean |
DEBUG
Debug flag |
static String |
errMsg
The error message for the last fail of setupDB execution |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
DEBUG
private static final boolean DEBUG
- Debug flag
errMsg
public static String errMsg
- The error message for the last fail of setupDB execution
DDL
protected static Table[] DDL
- This represents the database structure required by Gate2 to run.
These are tables that need to exist regardless of the contents of the
database (that is they need to be there even in a database that contains
no resources)
Checker
public Checker()
setupDatabase
public static boolean setupDatabase(Table[] ddl,
DataStore ds)
- This method attempts to create the structure defined by ddl.
Before trying to create each table it will check if such a table doesn't
already exist. If it finds a table with the given name, it will check if
the structure of the table complies with the requested structure.
If it cannot find a table with the given name, it will create a table with
the requested name and structure.
- Parameters:
ddl
- An array of table definitions (using gate.db.Database.Table).
This parameter is actually an array of objects of type gate.db.Table.
An example of how to statically define such an array can be found at
the bottom of this file. For aditional information regarding working with
Table objects please read the documentation from gate.db.Table.- Returns:
- true if the structure of the database complies with the request or
if the structure of the database has been successfuly altered so it now
complies with the request.
false if the database could not be altered such that it complies with the
request (e.g. one of the tables exists and has a different structure).
Note that this method will fail (return false) only if the structure found
in the database cannot be converted so it complies with the request. It
will not fail for example if a column in a table has a size larger than
the requested one but it will fail if the size found in the database is
smaller than the requested one.
setupDS
public static boolean setupDS(DataStore ds)
static void ()