|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--SampleDatabase.Manager
A sample DatabaseManager implementation for ModSQL. This class will automatically register itself with ModSQL.MetaManager when it is loaded. This class the table named 'tablename_Table' when the table 'tablename' is requested. A list of valid tables is found in this class. All table classes are assumed to be included in the SampleDatabase package.
The purpose of this database is to provided a strictly in memory set of tables for testing purposes. This database will also support insert, update, delete, and create table. All changes to this database will occur only in memory and will be lost when the database connection is closed.
| Field Summary | |
private static int |
majorVersion
|
private static int |
minorVersion
|
private static String |
pkg
|
private static String[] |
tables
|
| Constructor Summary | |
Manager()
|
|
| Method Summary | |
boolean |
createIndex(String name,
String column)
Create an index of the specified column in the specified table (if capable). |
DatabaseTable |
createTable(String name,
boolean temporary)
Create a new table. |
boolean |
dropIndex(String name,
String column)
Drop an index. |
void |
dropTable(String name)
Drop a table. |
Function |
getFunction(String function_name)
Get a database specific function for use in SQL. |
int |
getMajorVersion()
Get the driver's major version number. |
int |
getMinorVersion()
Get the driver's minor version number. |
boolean |
hasTable(String name)
Checks whether this database has the specified table. |
DatabaseTable |
openTable(String name)
Opens the database table with the specified name for read only access. |
DatabaseTable |
openTable(String name,
boolean readonly)
Opens the database table with the specified name with read only or read write access. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
private static final int majorVersion
private static final int minorVersion
private static final String pkg
private static final String[] tables
| Constructor Detail |
public Manager()
| Method Detail |
public int getMajorVersion()
DatabaseManagergetMajorVersion in interface DatabaseManagerModSQL.DatabaseManagerpublic int getMinorVersion()
DatabaseManagergetMinorVersion in interface DatabaseManagerModSQL.DatabaseManagerpublic boolean hasTable(String name)
DatabaseManagerhasTable in interface DatabaseManagerModSQL.DatabaseManagertablename - name of the tableDatabaseException - if a database-access error occurs
public DatabaseTable openTable(String name)
throws DatabaseException
DatabaseManageropenTable in interface DatabaseManagerModSQL.DatabaseManagertablename - name of the table to openDatabaseException - if a database-access error occurs
public DatabaseTable openTable(String name,
boolean readonly)
throws DatabaseException
DatabaseManageropenTable in interface DatabaseManagerModSQL.DatabaseManagertablename - name of the table to openreadonly - true to open table read onlyDatabaseException - if a database-access error occurs
public DatabaseTable createTable(String name,
boolean temporary)
throws DatabaseException
DatabaseManagercreateTable in interface DatabaseManagerModSQL.DatabaseManagertablename - name of the table to createtemporary - table is temporaryDatabaseException - if a database-access error occurs
public boolean createIndex(String name,
String column)
DatabaseManagercreateIndex in interface DatabaseManagerModSQL.DatabaseManagertablename - name of the table to indexcolumnname - name of the column to indexDatabaseException - if a database-access error occurs
public void dropTable(String name)
throws DatabaseException
DatabaseManagerdropTable in interface DatabaseManagerModSQL.DatabaseManagertablename - name of the table to dropDatabaseException - if a database-access error occurs
public boolean dropIndex(String name,
String column)
throws DatabaseException
DatabaseManagerdropIndex in interface DatabaseManagerModSQL.DatabaseManagertablename - name of the table with indexcolumnname - name of the column with indexDatabaseException - if a database-access error occurspublic Function getFunction(String function_name)
DatabaseManagerGet a database specific function for use in SQL. This function may be used in any SQL query (not just queries involving this database's tables). Note that when looking up function names, ModSQL will always check for database specific functions before using built-in functions, so this method may be used to override the built-in SQL functions.
This method should return null if a function by the specified name is not found.
getFunction in interface DatabaseManagerModSQL.DatabaseManagername - name of function to lookup (always lowercase)DatabaseException - if a database-access error occurs
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||