|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gcube.vremanagement.softwarerepository.db.SQLDBManager
public class SQLDBManager
This class is used for submitting query on db.
| Nested Class Summary | |
|---|---|
static interface |
SQLDBManager.BaseConsumer
Describe the Consumer of ResultSet returned quering the db |
| Constructor Summary | |
|---|---|
SQLDBManager()
Constructor for SQLDBManager |
|
SQLDBManager(java.lang.String dbFileName,
java.lang.String username,
java.lang.String password,
java.io.File queriesFile)
Constructor for SQLDBManager |
|
| Method Summary | |
|---|---|
void |
close()
Shutdown the db and close the connection to the db. |
void |
open()
Load the HSQL Database Engine JDBC driver and open the connection to the db. |
void |
queryAndConsume(java.lang.String expression,
SQLDBManager.BaseConsumer consumer)
Executes SQL command SELECT and invokes the given consumer. |
void |
runSQLQuery(java.lang.String expression)
Executes SQL commands CREATE, DROP, INSERT and UPDATE. |
java.sql.ResultSet |
runSQLSelect(java.lang.String expression)
Executes SQL command SELECT and invokes the given consumer. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SQLDBManager()
public SQLDBManager(java.lang.String dbFileName,
java.lang.String username,
java.lang.String password,
java.io.File queriesFile)
dbFileName - file name of the dbusername - usernamepassword - passwordqueriesFile - query file for db initialization| Method Detail |
|---|
public void open()
throws java.lang.ClassNotFoundException,
java.sql.SQLException,
java.lang.Exception
java.lang.ClassNotFoundException - if the HSQL Database Engine JDBC driver is not loaded
java.sql.SQLException - if the connection to the db fails
java.lang.Exception - if the tables creation fails
public void close()
throws java.sql.SQLException
java.sql.SQLException - if the SHUTDOWN query fails
public void queryAndConsume(java.lang.String expression,
SQLDBManager.BaseConsumer consumer)
throws java.sql.SQLException,
java.lang.Exception
expression - the SQL expression to evaluateconsumer - the resultset consumer to invoke
java.sql.SQLException - if the query fails
java.lang.Exception - if the given resultset consumer fails
public java.sql.ResultSet runSQLSelect(java.lang.String expression)
throws java.sql.SQLException,
java.lang.Exception
expression - the SQL expression to evaluate
java.sql.SQLException - if the query fails
java.lang.Exception - if the given resultset consumer fails
public void runSQLQuery(java.lang.String expression)
throws java.sql.SQLException
expression - the SQL expression to modify the db
java.sql.SQLException - if the query fails
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||