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
static String errMsg
          The error message for the last fail of setupDB execution
 
Constructor Summary
Checker()
           
 
Method Summary
static boolean setupDatabase(Table[] ddl, DataStore ds)
          This method attempts to create the structure defined by ddl.
static boolean setupDS(DataStore ds)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

errMsg

public static String errMsg
The error message for the last fail of setupDB execution
Constructor Detail

Checker

public Checker()
Method Detail

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)