Skip to content

Commit c289418

Browse files
committed
Enable statement vtab
1 parent e4e1204 commit c289418

6 files changed

Lines changed: 19 additions & 45 deletions

File tree

dart/pubspec.lock

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,6 @@ packages:
1717
url: "https://pub.dev"
1818
source: hosted
1919
version: "10.0.0"
20-
archive:
21-
dependency: "direct dev"
22-
description:
23-
name: archive
24-
sha256: "2fde1607386ab523f7a36bb3e7edb43bd58e6edaf2ffb29d8a6d578b297fdbbd"
25-
url: "https://pub.dev"
26-
source: hosted
27-
version: "4.0.7"
2820
args:
2921
dependency: transitive
3022
description:
@@ -177,14 +169,6 @@ packages:
177169
url: "https://pub.dev"
178170
source: hosted
179171
version: "1.0.0"
180-
http:
181-
dependency: "direct dev"
182-
description:
183-
name: http
184-
sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412"
185-
url: "https://pub.dev"
186-
source: hosted
187-
version: "1.6.0"
188172
http_multi_server:
189173
dependency: transitive
190174
description:
@@ -297,14 +281,6 @@ packages:
297281
url: "https://pub.dev"
298282
source: hosted
299283
version: "1.5.2"
300-
posix:
301-
dependency: transitive
302-
description:
303-
name: posix
304-
sha256: "6323a5b0fa688b6a010df4905a56b00181479e6d10534cecfecede2aa55add61"
305-
url: "https://pub.dev"
306-
source: hosted
307-
version: "6.0.3"
308284
power_extensions:
309285
dependency: transitive
310286
description:

dart/pubspec.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ version: 0.0.1
44
description: Tests for powersync-sqlite-core
55
environment:
66
sdk: ^3.4.0
7+
78
dependencies:
89
sqlite3: ^3.0.0
910
bson: ^5.0.5
@@ -17,5 +18,14 @@ dev_dependencies:
1718
convert: ^3.1.2
1819
meta: ^1.16.0
1920
path: ^1.9.1
20-
http: ^1.5.0
21-
archive: ^4.0.7
21+
22+
# See https://pub.dev/documentation/sqlite3/latest/topics/hook-topic.html
23+
hooks:
24+
user_defines:
25+
sqlite3:
26+
source: source
27+
path: ../crates/sqlite/sqlite/sqlite3.c
28+
# Used in sync_test.dart to ensure the core extension dosn't leave any
29+
# busy statements behind.
30+
defines:
31+
- SQLITE_ENABLE_STMTVTAB

dart/test/error_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ void main() {
5555
'powersync_control: Sync protocol error: invalid text line. cause: expected value at line 1 column 1',
5656
)),
5757
);
58+
control.close();
5859
});
5960
});
6061
});

dart/test/js_key_encoding_test.dart

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,15 @@
11
import 'dart:convert';
22

3-
import 'package:file/local.dart';
43
import 'package:sqlite3/common.dart';
5-
import 'package:sqlite3/sqlite3.dart';
6-
import 'package:sqlite3_test/sqlite3_test.dart';
74
import 'package:test/test.dart';
85

96
import 'utils/native_test_utils.dart';
107

118
void main() {
12-
// Needs an unique name per test file to avoid concurrency issues
13-
final vfs = TestSqliteFileSystem(
14-
fs: const LocalFileSystem(), name: 'js-key-encoding-test-vfs');
159
late CommonDatabase db;
1610

17-
setUpAll(() {
18-
loadExtension();
19-
sqlite3.registerVirtualFileSystem(vfs, makeDefault: false);
20-
});
21-
tearDownAll(() => sqlite3.unregisterVirtualFileSystem(vfs));
22-
2311
setUp(() async {
24-
db = openTestDatabase(vfs: vfs)
12+
db = openTestDatabase()
2513
..select('select powersync_init();')
2614
..select('select powersync_replace_schema(?)', [json.encode(_schema)]);
2715
});

dart/test/sync_local_performance_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ void testFilesystemOperations(
3333

3434
setUp(() async {
3535
// Needs an unique name per test file to avoid concurrency issues
36-
vfs = new TrackingFileSystem(
37-
parent: new InMemoryFileSystem(), name: 'perf-test-vfs');
36+
vfs =
37+
TrackingFileSystem(parent: InMemoryFileSystem(), name: 'perf-test-vfs');
3838
sqlite3.registerVirtualFileSystem(vfs, makeDefault: false);
3939
db = openTestDatabase(vfs: vfs, fileName: 'test.db');
4040
});

dart/test/sync_test.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,9 @@ void _syncTests<T>({
5050

5151
// Make sure that powersync_control doesn't leave any busy statements
5252
// behind.
53-
// TODO: Re-enable after we can guarantee sqlite_stmt being available
54-
// const statement = 'SELECT * FROM sqlite_stmt WHERE busy AND sql != ?;';
55-
// final busy = db.select(statement, [statement]);
56-
// expect(busy, isEmpty);
53+
const statement = 'SELECT * FROM sqlite_stmt WHERE busy AND sql != ?;';
54+
final busy = db.select(statement, [statement]);
55+
expect(busy, isEmpty);
5756
} catch (e) {
5857
db.execute('rollback');
5958
rethrow;

0 commit comments

Comments
 (0)