diff --git a/packages_web/sqflite_common_ffi_web/CHANGELOG.md b/packages_web/sqflite_common_ffi_web/CHANGELOG.md index 989ba79b..ffb95aaf 100644 --- a/packages_web/sqflite_common_ffi_web/CHANGELOG.md +++ b/packages_web/sqflite_common_ffi_web/CHANGELOG.md @@ -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 diff --git a/packages_web/sqflite_common_ffi_web/lib/src/setup/sqlite3_wasm_version.dart b/packages_web/sqflite_common_ffi_web/lib/src/setup/sqlite3_wasm_version.dart index ea0766c7..944d0557 100644 --- a/packages_web/sqflite_common_ffi_web/lib/src/setup/sqlite3_wasm_version.dart +++ b/packages_web/sqflite_common_ffi_web/lib/src/setup/sqlite3_wasm_version.dart @@ -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'; diff --git a/packages_web/sqflite_common_ffi_web/pubspec.yaml b/packages_web/sqflite_common_ffi_web/pubspec.yaml index 8174fe0e..b5640319 100644 --- a/packages_web/sqflite_common_ffi_web/pubspec.yaml +++ b/packages_web/sqflite_common_ffi_web/pubspec.yaml @@ -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 @@ -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: diff --git a/sqflite/example/lib/type_test_page.dart b/sqflite/example/lib/type_test_page.dart index 6d1355a6..b5a02a04 100644 --- a/sqflite/example/lib/type_test_page.dart +++ b/sqflite/example/lib/type_test_page.dart @@ -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)}'); @@ -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(); }); @@ -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 { @@ -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'); diff --git a/sqflite_common_ffi/CHANGELOG.md b/sqflite_common_ffi/CHANGELOG.md index 85a540d4..afa28f58 100644 --- a/sqflite_common_ffi/CHANGELOG.md +++ b/sqflite_common_ffi/CHANGELOG.md @@ -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` diff --git a/sqflite_common_ffi/lib/src/sqflite_ffi_impl.dart b/sqflite_common_ffi/lib/src/sqflite_ffi_impl.dart index 138e89c2..abed64c4 100644 --- a/sqflite_common_ffi/lib/src/sqflite_ffi_impl.dart +++ b/sqflite_common_ffi/lib/src/sqflite_ffi_impl.dart @@ -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'); } diff --git a/sqflite_common_ffi/pubspec.yaml b/sqflite_common_ffi/pubspec.yaml index 84f31ce9..8ab55bd4 100644 --- a/sqflite_common_ffi/pubspec.yaml +++ b/sqflite_common_ffi/pubspec.yaml @@ -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 @@ -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' diff --git a/sqflite_test_app/tool/setup_web.dart b/sqflite_test_app/tool/setup_web.dart new file mode 100644 index 00000000..4220c004 --- /dev/null +++ b/sqflite_test_app/tool/setup_web.dart @@ -0,0 +1,5 @@ +import 'package:sqflite_common_ffi_web/src/setup/setup.dart'; + +Future main() async { + await setupBinaries(options: SetupOptions(verbose: true)); +}