public class SQLDatabaseQueue
extends java.lang.Object
Constructor and Description |
---|
SQLDatabaseQueue(java.lang.String filename)
Creates an SQLQueue for the database specified.
|
SQLDatabaseQueue(java.lang.String filename,
KeyProvider provider)
Creates an SQLQueue for the SQLCipher-based database specified.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getSQLiteVersion()
Returns the SQLite Version.
|
int |
getVersion()
Returns the current version of the database.
|
boolean |
isShutdown()
Checks if
shutdown() has been called |
void |
shutdown()
Shuts down this database queue and closes
the underlying database connection.
|
<T> java.util.concurrent.Future<T> |
submit(SQLCallable<T> callable)
Submits a database task for execution
|
<T> java.util.concurrent.Future<T> |
submitTransaction(SQLCallable<T> callable)
Submits a database task for execution in a transaction
|
void |
updateSchema(Migration migration,
int version)
Updates the schema of the database.
|
public SQLDatabaseQueue(java.lang.String filename) throws java.io.IOException, java.sql.SQLException
filename
- The file where the database is locatedjava.io.IOException
- If an problem is encountered creating the DBjava.sql.SQLException
- If the database cannot be opened.public SQLDatabaseQueue(java.lang.String filename, KeyProvider provider) throws java.io.IOException, java.sql.SQLException
filename
- The file where the database is locatedprovider
- The key provider object that contains the user-defined SQLCipher key.
Supply a NullKeyProvider to use a non-encrypted database.java.io.IOException
- If a problem occurs creating the databasejava.sql.SQLException
- If the database cannot be opened.public void updateSchema(Migration migration, int version)
migration
- Object which performs migration; should not check or set versionversion
- The version of the schemapublic int getVersion() throws java.sql.SQLException
java.sql.SQLException
- Throws if there was an error getting the current database versionpublic <T> java.util.concurrent.Future<T> submit(SQLCallable<T> callable)
T
- The type of object that is returned from the taskcallable
- The task to be performedjava.util.concurrent.RejectedExecutionException
- Thrown when the queue has been shutdownpublic <T> java.util.concurrent.Future<T> submitTransaction(SQLCallable<T> callable)
T
- The type of object that is returned from the taskcallable
- The task to be performedjava.util.concurrent.RejectedExecutionException
- thrown when the queue has been shutdownpublic void shutdown()
public boolean isShutdown()
shutdown()
has been calledshutdown()
has been called.public java.lang.String getSQLiteVersion()