Package asia.hombre.asyncqlitekt
Class AsyncQLiteConnection
-
- All Implemented Interfaces:
public final class AsyncQLiteConnectionA wrapper for SQLiteConnection to provide asynchronous capabilities.
All SQL calls from concurrent threads must go through this wrapper class to ensure serial access.
- Since:
0.0.1
Ron Lauren Hombre
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classAsyncQLiteConnection.Companion
-
Field Summary
Fields Modifier and Type Field Description private final SQLiteConnectionsyncedpublic final static AsyncQLiteConnection.CompanionCompanion
-
Method Summary
Modifier and Type Method Description final SQLiteConnectiongetSynced()final UnitexecSQL(String sql, Function1<Exception, Unit> onSuccess)Adds the SQL to the Job Queue to be executed. final AsyncQLiteStatementprepare(String sql, Function1<Exception, Unit> onSuccess)Prepares a virtual SQL Statement and adds it to the Job Queue with AsyncQLiteStatement.step. final Unitclose()Signals the Consumer Thread to die once the Job Queue is empty. -
-
Method Detail
-
getSynced
final SQLiteConnection getSynced()
-
execSQL
final Unit execSQL(String sql, Function1<Exception, Unit> onSuccess)
Adds the SQL to the Job Queue to be executed.
This returns nothing.
- Parameters:
sql- The SQL Statement.onSuccess- Called after the SQL has been executed in the Job Queue.
-
prepare
final AsyncQLiteStatement prepare(String sql, Function1<Exception, Unit> onSuccess)
Prepares a virtual SQL Statement and adds it to the Job Queue with AsyncQLiteStatement.step.
Values to get must be declared before the AsyncQLiteStatement.step method is called by calling e.g. getInt(0) and ignoring the returned value.
- Parameters:
sql- The SQL Statement.onSuccess- Called after the SQL has been executed in the Job Queue.
-
-
-
-