|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--AsciiDatabase.Manager
A flexable method of turning flat ascii files into databases. The config file hard coded here contains pointers to table configuration files and data files. The table configuration file describes the format of the data in the data file.
At the moment, this code also handles the choice of file names for indexes of tables. This needs to be rethought as ModSQL should handle indices it creates all by itself.
| Field Summary | |
static String |
defasciiconf
Default config file location for AsciiDatabase |
private static int |
majorVersion
|
private static int |
minorVersion
|
private RCFile |
rcfile
|
| Constructor Summary | |
Manager()
Create new Manager. |
|
Manager(String rcfilename)
Create new Manager with specifed configuration file. |
|
| Method Summary | |
boolean |
createIndex(String name,
String column)
Create an index of the specifed column in the specified table. |
DatabaseTable |
createTable(String tablename,
boolean temporary)
Create the named table. |
boolean |
dropIndex(String name,
String column)
Delete the specified index. |
void |
dropTable(String name)
Delete the specified table. |
protected void |
finalize()
Closes the configuration file to free up a file descriptor. |
Function |
getFunction(String function_name)
Get a database specific function for use in SQL. |
int |
getMajorVersion()
Returns the major version number of this database. |
int |
getMinorVersion()
Returns the minor version number of this database. |
boolean |
hasTable(String name)
Checks if this database contains the named table. |
DatabaseTable |
openTable(String name)
Opens the named table for read only access. |
DatabaseTable |
openTable(String name,
boolean readonly)
Opens the named table. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
public static final String defasciiconf
private static final int majorVersion
private static final int minorVersion
private RCFile rcfile
| Constructor Detail |
public Manager()
throws IOException
rcfilename - name of configuration fileIOException - if an error occurs reading the configuration file
public Manager(String rcfilename)
throws IOException
rcfilename - name of configuration fileIOException - if an error occurs reading the configuration file| Method Detail |
protected void finalize()
finalize in class Objectpublic int getMajorVersion()
getMajorVersion in interface DatabaseManagerpublic int getMinorVersion()
getMinorVersion in interface DatabaseManagerpublic boolean hasTable(String name)
hasTable in interface DatabaseManagername - table desired
public DatabaseTable openTable(String name)
throws DatabaseException
openTable in interface DatabaseManagername - desired table
public DatabaseTable openTable(String name,
boolean readonly)
throws DatabaseException
openTable in interface DatabaseManagername - desired tablereadonly - flag indicating that the table be opened readonlyDatabaseException - if read/write access was requested
public DatabaseTable createTable(String tablename,
boolean temporary)
throws DatabaseException
createTable in interface DatabaseManagertablename - name of new table
public boolean createIndex(String name,
String column)
createIndex in interface DatabaseManagername - name of table to indexcolumn - name of column to index
public void dropTable(String name)
throws DatabaseException
dropTable in interface DatabaseManagertablename - name of table to dropDatabaseException - if the operation failed
public boolean dropIndex(String name,
String column)
throws DatabaseException
dropIndex in interface DatabaseManagertablename - name of indexed tablecolumnname - name of indexed columnpublic 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 | ||||||||