openDatabase method

  1. @override
Future<WorkerDatabase> openDatabase(
  1. WasmSqlite3 sqlite3,
  2. String path,
  3. String vfs
)
override

Opens a database in the pre-configured sqlite3 instance under the specified path in the given vfs.

This should virtually always call sqlite3.open(path, vfs: vfs) and wrap the result in a WorkerDatabase subclass.

Implementation

@override
Future<WorkerDatabase> openDatabase(
    WasmSqlite3 sqlite3, String path, String vfs) async {
  final db = sqlite3.open(path, vfs: vfs);

  // Register any custom functions here if needed

  final throttled = ThrottledCommonDatabase(db);

  return AsyncSqliteDatabase(database: throttled);
}