public class Database
extends java.lang.Object
Constructor and Description |
---|
Database() |
Modifier and Type | Method and Description |
---|---|
void |
beginTransaction()
Begins a new transaction.
|
void |
close()
Closes the Database.
|
void |
commitTransaction()
Persists all changes in DB
|
void |
execute(java.lang.String sql)
Executes a single SQL statement that is NOT a SELECT or any other SQL statement that returns data.
|
DatabaseType |
getDatabaseType()
Returns the current database type that is running.
|
java.lang.String |
getPath() |
Statement |
prepareStatement(java.lang.String sql)
Compiles a single sql statement.
|
Cursor |
query(java.lang.String sql)
Executes a SELECT-statement
|
void |
rollbackTransaction()
Rolls back current transaction
|
public void beginTransaction() throws DatabaseException
DatabaseException
- if the database is already in a transaction.public void commitTransaction() throws DatabaseException
DatabaseException
- if the database is not in a transactionpublic void rollbackTransaction() throws DatabaseException
DatabaseException
- if the database is not in a transactionpublic java.lang.String getPath()
DatabaseFactory.openOrCreate(String path)
methodpublic void close() throws DatabaseException
DatabaseException
- if the databse is already closed or could not be closed for some reasons.public Statement prepareStatement(java.lang.String sql) throws DatabaseException
sql
- - sql statementDatabaseException
public void execute(java.lang.String sql) throws DatabaseException
sql
- - SQL statementDatabaseException
public Cursor query(java.lang.String sql) throws DatabaseException
sql
- - to be executedCursor
objectDatabaseException
- if the sql string is empty or null.public DatabaseType getDatabaseType() throws DatabaseException
DatabaseException