Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Make compatible with the latest version of Sqflite. #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib/src/sqflite_web_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -455,36 +455,36 @@ class SqfliteWebDatabase extends SqfliteDatabase {
}

@override
Future<void> endTransaction(SqfliteTransaction txn) async {
Future<void> endTransaction(SqfliteTransaction? txn) async {
// never commit transaction in read-only mode
if (readOnly != true) {
await txnExecute<dynamic>(txn, (txn.successful == true) ? 'COMMIT' : 'ROLLBACK');
await txnExecute<dynamic>(txn, (txn!.successful == true) ? 'COMMIT' : 'ROLLBACK');
}
}

@override
SqfliteTransaction? get txn => null; //???

@override
Future<List> txnApplyBatch(SqfliteTransaction txn, SqfliteBatch batch, {bool? noResult, bool? continueOnError}) {
Future<List> txnApplyBatch(SqfliteTransaction? txn, SqfliteBatch batch, {bool? noResult, bool? continueOnError}) {
return txnWriteSynchronized(txn, (_) async {
final results = <dynamic>[];

for (final op in batch.operations) {
switch (op['method'] as String) {
case 'execute':
await txn.execute(op['sql'] as String, op['arguments'] as List<dynamic>);
await txn!.execute(op['sql'] as String, op['arguments'] as List<dynamic>);
break;
case 'insert':
final row = await txn.rawInsert(op['sql'] as String, op['arguments'] as List<dynamic>);
final row = await txn!.rawInsert(op['sql'] as String, op['arguments'] as List<dynamic>);
if (noResult != true) results.add(row);
break;
case 'query':
final result = await txn.rawQuery(op['sql'] as String, op['arguments'] as List<dynamic>);
final result = await txn!.rawQuery(op['sql'] as String, op['arguments'] as List<dynamic>);
if (noResult != true) results.add(result);
break;
case 'update':
final row = await txn.rawUpdate(op['sql'] as String, op['arguments'] as List<dynamic>);
final row = await txn!.rawUpdate(op['sql'] as String, op['arguments'] as List<dynamic>);
if (noResult != true) results.add(row);
break;
default:
Expand Down