Skip to content

Commit

Permalink
Merging from dart3a
Browse files Browse the repository at this point in the history
  • Loading branch information
alextekartik committed Dec 10, 2023
2 parents 04fe04f + 9b90885 commit 061e190
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 31 deletions.
5 changes: 4 additions & 1 deletion packages_web/sqflite_common_ffi_web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
## 0.4.2
## 0.4.2+2

* Use local webdev dependency during setup.
* Setup for sqlite3 2.2.0
* Remove `io` dependency
* requires sdk 3.2.0

## 0.4.1

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
/// Downloaded wasm version.
var sqlite3WasmRelease = 'sqlite3_flutter_libs-0.5.18/sqlite3.wasm';
var sqlite3WasmRelease = 'sqlite3-2.2.0/sqlite3.wasm';

// Previous version
// var sqlite3WasmRelease = 'sqlite3_flutter_libs-0.5.18/sqlite3.wasm';
11 changes: 5 additions & 6 deletions packages_web/sqflite_common_ffi_web/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: sqflite_common_ffi_web
repository: https://github.com/tekartik/sqflite/tree/master/packages_web/sqflite_common_ffi_web
description: Sqflite web implementation using sqlite3 ffi and sqlite3 wasm.
version: 0.4.2
version: 0.4.2+2
funding:
- https://github.com/sponsors/alextekartik

Expand All @@ -14,20 +14,19 @@ topics:
- database

environment:
sdk: '>=3.0.0 <4.0.0'
sdk: '>=3.2.0 <4.0.0'

dependencies:
path: '>=1.7.0 <3.0.0'
sqflite_common_ffi: '>=2.3.0-1 <4.0.0'
sqflite_common: '>=2.5.0-1 <4.0.0'
sqlite3: '^2.0.0'
sqflite_common_ffi: '>=2.3.0+4 <4.0.0'
sqflite_common: '>=2.5.0+2 <4.0.0'
sqlite3: '>=2.2.0 <4.0.0'
http: '>=0.13.4 <2.0.0'
js: '>=0.6.4 <2.0.0'
synchronized: '>=3.0.0+3 <5.0.0'
process_run: '>=0.12.3+2 <2.0.0'
dev_build: '>=0.16.3+1 <2.0.0'
pub_semver: '>=2.1.2 <4.0.0'
io: '>=1.0.3 <3.0.0'
args: '>=2.3.1 <4.0.0'
meta: '>=1.8.0 <3.0.0'
dev_dependencies:
Expand Down
62 changes: 43 additions & 19 deletions sqflite/example/lib/type_test_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,32 @@ class TypeTestPage extends TestPage {
//devPrint('2^33: ${await getValue(id)}');
expect(await getValue(id), pow(2, 33));

id = await insertValue(pow(2, 62));
//devPrint('2^62: ${pow(2, 62)} ${await getValue(id)}');
expect(await getValue(id), pow(2, 62),
reason: '2^62: ${pow(2, 62)} ${await getValue(id)}');

var value = pow(2, 63).round() - 1;
id = await insertValue(value);
//devPrint('${value} ${await getValue(id)}');
expect(await getValue(id), value, reason: '$value ${await getValue(id)}');

value = -(pow(2, 63)).round();
id = await insertValue(value);
//devPrint('${value} ${await getValue(id)}');
expect(await getValue(id), value, reason: '$value ${await getValue(id)}');
// about web limits
id = await insertValue(pow(2, 53));
expect(await getValue(id), pow(2, 53));

if (!kIsWeb) {
// Not for web
id = await insertValue(pow(2, 62));
//devPrint('2^62: ${pow(2, 62)} ${await getValue(id)}');
expect(await getValue(id), pow(2, 62),
reason: '2^62: ${pow(2, 62)} ${await getValue(id)}');

var value = pow(2, 63).round() - 1;
id = await insertValue(value);
//devPrint('${value} ${await getValue(id)}');
expect(await getValue(id), value,
reason: '$value ${await getValue(id)}');

value = -(pow(2, 63)).round();
id = await insertValue(value);
//devPrint('${value} ${await getValue(id)}');
expect(await getValue(id), value,
reason: '$value ${await getValue(id)}');
}
var bigValue = 1234567890123456;
id = await insertValue(bigValue);
expect(await getValue(id), bigValue);
/*
id = await insertValue(pow(2, 63));
devPrint('2^63: ${pow(2, 63)} ${await getValue(id)}');
Expand Down Expand Up @@ -80,12 +92,18 @@ class TypeTestPage extends TestPage {
// big float
id = await insertValue(1 / 3);
expect(await getValue(id), 1 / 3);
id = await insertValue(pow(2, 63) + .1);
expect(await getValue(id), pow(2, 63) + 0.1);
if (!kIsWeb) {
id = await insertValue(pow(2, 63) + .1);
expect(await getValue(id), pow(2, 63) + 0.1);

// integer?
id = await insertValue(pow(2, 62));
expect(await getValue(id), pow(2, 62));
}
var bigValue = 1234567890123456789.0;
id = await insertValue(bigValue);
expect(await getValue(id), bigValue);

// integer?
id = await insertValue(pow(2, 62));
expect(await getValue(id), pow(2, 62));
await data.db.close();
});

Expand Down Expand Up @@ -217,6 +235,9 @@ class TypeTestPage extends TestPage {
await insertValue(DateTime.fromMillisecondsSinceEpoch(1234567890));
} on ArgumentError catch (_) {
failed = true;
} on UnsupportedError catch (_) {
// this happens on the web
failed = true;
}
expect(failed, true);
} finally {
Expand All @@ -237,6 +258,9 @@ class TypeTestPage extends TestPage {
await insertValue(true);
} on ArgumentError catch (_) {
failed = true;
} on DatabaseException catch (_) {
// this happens on the web
failed = true;
}
if (supportsCompatMode) {
print('for now bool are accepted but inconsistent on iOS/Android');
Expand Down
5 changes: 5 additions & 0 deletions sqflite_common_ffi/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.3.1

* `sqflite3: >= 2.2.0`
* `sdk: >= 3.2.0`

## 2.3.0+4

* Support `PRAGMA sqflite -- db_config_defensive_off`
Expand Down
2 changes: 1 addition & 1 deletion sqflite_common_ffi/lib/src/sqflite_ffi_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ class SqfliteFfiDatabase {

/// Return the count of updated row.
int _getUpdatedRows() {
var rowCount = _ffiDb.getUpdatedRows();
var rowCount = _ffiDb.updatedRows;
if (logLevel >= sqfliteLogLevelSql) {
print('$_prefix Modified $rowCount rows');
}
Expand Down
6 changes: 3 additions & 3 deletions sqflite_common_ffi/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: sqflite_common_ffi
homepage: https://github.com/tekartik/sqflite/tree/master/sqflite_common_ffi
description: sqflite ffi based implementation, for desktop and units tests.
version: 2.3.0+4
version: 2.3.1
funding:
- https://github.com/sponsors/alextekartik

Expand All @@ -16,10 +16,10 @@ topics:
- database

environment:
sdk: '>=3.0.0 <4.0.0'
sdk: '>=3.2.0 <4.0.0'

dependencies:
sqlite3: '>=2.1.0 <4.0.0'
sqlite3: '>=2.2.0 <4.0.0'
sqflite_common: '>=2.5.0+2 <4.0.0'
synchronized: '>=3.0.0 <5.0.0'
path: '>=1.8.0 <3.0.0'
Expand Down
5 changes: 5 additions & 0 deletions sqflite_test_app/tool/setup_web.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import 'package:sqflite_common_ffi_web/src/setup/setup.dart';

Future<void> main() async {
await setupBinaries(options: SetupOptions(verbose: true));
}

0 comments on commit 061e190

Please sign in to comment.