public class TinyDatabase extends Object
| Constructor and Description |
|---|
TinyDatabase(String sFolder)
Constructs a new TinyDatabse located in the given folder
|
| Modifier and Type | Method and Description |
|---|---|
TinyTable |
createTable(String sTableName,
Class<?> keyClass,
Class<?> recordClass)
Creates a new table in the database
|
boolean |
dropTable(String sTableName) |
static TinyDatabase |
getCurrentDatabase()
Returns the current database
|
String |
getDatabaseFolder()
Returns the database filesystem folder (where the tables are saved as files)
|
TinyTable |
getTable(String sTableName)
Returns the table object for the given table name
If the table doesn't exist an exception is thrown The table returned is ready to use (its records are loaded) |
TinyTable |
getTable(String sTableName,
boolean mustExist)
Returns the table object for the given table name (or null if the table is unknown and 'mustExist' flag = 'false')
If a table is returned, it is ready to use (its records are loaded) |
String[] |
getTableNames()
Returns all the table names registered in the database dictionary
|
void |
loadAllTables()
Loads all the tables in memory
|
void |
saveAllTables()
Saves all the tables in the filesystem
|
public TinyDatabase(String sFolder)
sFolder - public String getDatabaseFolder()
public static TinyDatabase getCurrentDatabase()
public void loadAllTables()
public void saveAllTables()
public String[] getTableNames()
public TinyTable getTable(String sTableName)
sTableName - the table namepublic TinyTable getTable(String sTableName, boolean mustExist)
sTableName - the table namemustExist - if true the table must exist (if it doesn't exist an exception is thrown), public TinyTable createTable(String sTableName, Class<?> keyClass, Class<?> recordClass)
sTableName - the name of the tablerecordClass - the class of the records stored in this tablepublic boolean dropTable(String sTableName)
Copyright © 2016. All rights reserved.