Skip to content

Commit 73b74af

Browse files
committed
Fix write detection when using UPDATE/INSERT/DELETE with RETURNING in raw queries.
1 parent 016e341 commit 73b74af

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

packages/drift_sqlite_async/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.2.2
2+
3+
- Fix write detection when using UPDATE/INSERT/DELETE with RETURNING in raw queries.
4+
15
## 0.2.1
26

37
- Fix lints.

packages/drift_sqlite_async/lib/src/executor.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import 'package:sqlite_async/sqlite_async.dart';
88
// Ends with " RETURNING *", or starts with insert/update/delete.
99
// Drift-generated queries will always have the RETURNING *.
1010
// The INSERT/UPDATE/DELETE check is for custom queries, and is not exhaustive.
11-
final _returningCheck = RegExp(r'( RETURNING \*;?$)|(^(INSERT|UPDATE|DELETE))',
11+
final _returningCheck = RegExp(
12+
r'( RETURNING \*;?\s*$)|(^\s*(INSERT|UPDATE|DELETE))',
1213
caseSensitive: false);
1314

1415
class _SqliteAsyncDelegate extends _SqliteAsyncQueryDelegate

packages/drift_sqlite_async/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: drift_sqlite_async
2-
version: 0.2.1
2+
version: 0.2.2
33
homepage: https://github.com/powersync-ja/sqlite_async.dart
44
repository: https://github.com/powersync-ja/sqlite_async.dart
55
description: Use Drift with a sqlite_async database, allowing both to be used in the same application.

0 commit comments

Comments
 (0)