public class HSQLSession
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
java.sql.Connection |
con |
An object representing the connection to the database.
|
Constructor | Description |
---|---|
HSQLSession(java.lang.String db_file_name_prefix,
java.lang.String url,
java.lang.String username,
java.lang.String password) |
Creates a new database session.
|
Modifier and Type | Method | Description |
---|---|---|
void |
commit() |
Commits changes made in the database.
|
void |
connect() |
Sets a connection to the database.
|
void |
delIsf(java.lang.String isfName) |
Delets from the database a given decision problem.
|
java.util.ArrayList<java.lang.String> |
getIsfNames() |
Lists the names of all decision problems stored in the database.
|
void |
rollback() |
Performs rollback (cancels all the changes made since latest commit)
|
void |
showTable(java.lang.String table,
int wid) |
Displays a database table on the standard output.
|
void |
startTransaction() |
starts a database transaction.
|
public java.sql.Connection con
public HSQLSession(java.lang.String db_file_name_prefix, java.lang.String url, java.lang.String username, java.lang.String password)
db_file_name_prefix
- all database filenames are prefixed with this stringurl
- the address in format //NODENAME[:PORT]username
- the database loginpassword
- the database passwordpublic void connect() throws java.sql.SQLException
java.sql.SQLException
- when the url is invalid, the database doesn't exist
or access for the user is deniedpublic void commit() throws java.sql.SQLException
java.sql.SQLException
- when the database operation failespublic void rollback() throws java.sql.SQLException
java.sql.SQLException
- when problems with rollback are encounteredpublic void startTransaction() throws java.sql.SQLException
java.sql.SQLException
- when starting the transaction was found impossiblepublic java.util.ArrayList<java.lang.String> getIsfNames()
public void delIsf(java.lang.String isfName) throws java.sql.SQLException
isfName
- the name of the decision problem.java.sql.SQLException
- when there was no such isf name or the database operation failedpublic void showTable(java.lang.String table, int wid) throws java.sql.SQLException
table
- the table to be displayedwid
- the number of chars for each table columnjava.sql.SQLException
- when theres no such table or the database operation failes