Skip to content

Commit 9502060

Browse files
committed
Fix missing query method in transactions
1 parent 502d4a9 commit 9502060

File tree

3 files changed

+30
-12
lines changed

3 files changed

+30
-12
lines changed

CHANGELOG.md

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1+
## 3.0.0+1
2+
3+
- Fix missing `query` method in transactions
4+
15
## 3.0.0
26

3-
Major performance refactor with a few breaking changes.
7+
Major performance refactor with a few breaking changes
48

5-
- Change how tables and primary keys are fetched to minimize reads.
6-
- Allow for more efficient bulk writing in underlying implementation.
7-
- Rework abstractions to allow exposing Sqlite batches.
8-
- Rename classes to better reflect their goals.
9-
- Correctly identify and forbid semicolon separated statements.
9+
- Change how tables and primary keys are fetched to minimize reads
10+
- Allow for more efficient bulk writing in underlying implementation
11+
- Rework abstractions to allow exposing Sqlite batches
12+
- Rename classes to better reflect their goals
13+
- Correctly identify and forbid semicolon separated statements
1014

1115
## 2.1.7
1216

lib/src/crdt_executor.dart

+19-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,18 @@ import 'database_api.dart';
77
final _sqlEngine = SqlEngine();
88

99
/// Intercepts CREATE TABLE queries to assist with table creation and updates.
10-
/// Does not affect any other query types.
11-
class CrdtTableExecutor {
10+
/// Does not impact any other query types.
11+
class CrdtTableExecutor extends _CrdtTableExecutor {
12+
CrdtTableExecutor(ReadWriteApi super._db);
13+
14+
Future<List<Map<String, Object?>>> query(String sql, [List<Object?>? args]) =>
15+
(_db as ReadWriteApi).query(sql, args);
16+
}
17+
18+
class _CrdtTableExecutor {
1219
final WriteApi _db;
1320

14-
CrdtTableExecutor(this._db);
21+
_CrdtTableExecutor(this._db);
1522

1623
/// Executes a SQL query with an optional [args] list.
1724
/// Use "?" placeholders for parameters to avoid injection vulnerabilities:
@@ -93,13 +100,20 @@ class CrdtTableExecutor {
93100
}
94101
}
95102

96-
class CrdtExecutor extends CrdtTableExecutor {
103+
class CrdtExecutor extends CrdtWriteExecutor {
104+
CrdtExecutor(ReadWriteApi super._db, super.hlc);
105+
106+
Future<List<Map<String, Object?>>> query(String sql, [List<Object?>? args]) =>
107+
(_db as ReadWriteApi).query(sql, args);
108+
}
109+
110+
class CrdtWriteExecutor extends _CrdtTableExecutor {
97111
final Hlc hlc;
98112
late final _hlcString = hlc.toString();
99113

100114
final affectedTables = <String>{};
101115

102-
CrdtExecutor(super._db, this.hlc);
116+
CrdtWriteExecutor(super._db, this.hlc);
103117

104118
@override
105119
Future<void> _executeStatement(

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: sql_crdt
22
description: Base package for Conflict-free Replicated Data Types (CRDTs) using SQL databases
3-
version: 3.0.0
3+
version: 3.0.0+1
44
homepage: https://github.com/cachapa/sql_crdt
55
repository: https://github.com/cachapa/sql_crdt
66
issue_tracker: https://github.com/cachapa/sql_crdt/issues

0 commit comments

Comments
 (0)