public abstract class DBManager extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
DBManager.BaseConsumer |
Modifier and Type | Field and Description |
---|---|
protected static File |
backupFolder |
protected static int |
backupIntervalMS |
protected String |
dbFileBaseFolder
dbFileName is used to open or create files that hold the state
of the db.
|
protected String |
dbFileName |
protected String |
dbName |
protected javax.jdo.PersistenceManagerFactory |
persistenceFactory |
Constructor and Description |
---|
DBManager()
Constructor for SQLDBManager
|
Modifier and Type | Method and Description |
---|---|
void |
backup()
checkpoint the db and create a backup
|
void |
close()
Shutdown the db and close the connection to the db.
|
String |
queryJSON(String expression)
Executes SQL command SELECT and invokes the given consumer, giging back JSON formatetted output.
|
protected static String |
quote(String string)
Produce a string in double quotes with backslash sequences in all the
right places.
|
static String |
toJSon(ResultSet resultSet) |
protected void |
zipFolder(File[] files) |
protected javax.jdo.PersistenceManagerFactory persistenceFactory
protected static File backupFolder
protected String dbFileBaseFolder
protected String dbFileName
protected String dbName
protected static int backupIntervalMS
public void close() throws Exception
Exception
public void backup() throws SQLException, Exception
SQLException
- if the CHECKPOINT query failsException
public String queryJSON(String expression) throws SQLException, Exception
expression
- the SQL expression to evaluateSQLException
- if the query failsException
- if the given resultset consumer failspublic static String toJSon(ResultSet resultSet) throws SQLException
resultSet
- SQLException
protected static String quote(String string)
string
- A StringCopyright © 2015. All Rights Reserved.