mirror of https://github.com/AMT-Cheif/drift.git
moor_ffi: Build with latest sqlite3 and rtree
This commit is contained in:
parent
d5c6467e37
commit
e6a51b5ac4
|
@ -1,6 +1,7 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/widgets.dart' show WidgetsFlutterBinding;
|
||||
import 'package:moor_ffi/database.dart' as raw;
|
||||
import 'package:moor_ffi/moor_ffi.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:tests/tests.dart';
|
||||
|
@ -36,6 +37,40 @@ Future<void> main() async {
|
|||
Directory(dbPath).createSync(recursive: true);
|
||||
runAllTests(FfiExecutor(dbPath));
|
||||
|
||||
test('supports the rtree module', () {
|
||||
final db = raw.Database.memory();
|
||||
|
||||
db.execute('''
|
||||
CREATE VIRTUAL TABLE demo_index USING rtree(
|
||||
id, -- Integer primary key
|
||||
minX, maxX, -- Minimum and maximum X coordinate
|
||||
minY, maxY -- Minimum and maximum Y coordinate
|
||||
);
|
||||
|
||||
INSERT INTO demo_index VALUES(
|
||||
1, -- Primary key -- SQLite.org headquarters
|
||||
-80.7749, -80.7747, -- Longitude range
|
||||
35.3776, 35.3778 -- Latitude range
|
||||
);
|
||||
|
||||
INSERT INTO demo_index VALUES(
|
||||
2, -- NC 12th Congressional District in 2010
|
||||
-81.0, -79.6,
|
||||
35.0, 36.2
|
||||
);
|
||||
''');
|
||||
|
||||
final stmt = db.prepare('''
|
||||
SELECT id FROM demo_index
|
||||
WHERE minX>=-81.08 AND maxX<=-80.58
|
||||
AND minY>=35.00 AND maxY<=35.44;
|
||||
''');
|
||||
|
||||
expect(stmt.select().single['id'], 1);
|
||||
|
||||
db.close();
|
||||
});
|
||||
|
||||
test('isolates integration test', () async {
|
||||
// This test exists to verify that our communication protocol works when we
|
||||
// can only send primitive objects over isolates.
|
||||
|
|
|
@ -187,7 +187,7 @@ packages:
|
|||
path: "../../../moor_ffi"
|
||||
relative: true
|
||||
source: path
|
||||
version: "0.6.0"
|
||||
version: "0.7.0-dev"
|
||||
moor_flutter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
|
@ -38,5 +38,5 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'eu.simonbinder:sqlite3-native-library:3.31.1'
|
||||
implementation 'eu.simonbinder:sqlite3-native-library:3.32.3'
|
||||
}
|
Loading…
Reference in New Issue