Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/sqflite/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## NEXT
## 0.1.4

* Update minimum Flutter and Dart version to 3.13 and 3.1.
* Update sqflite to 2.4.2.
* Update minimum Flutter and Dart version to 3.13 and 3.7.
* Update the example app and integration_test.
* Update code format.

## 0.1.3
Expand Down
4 changes: 2 additions & 2 deletions packages/sqflite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ This package is not an _endorsed_ implementation of `sqflite`. Therefore, you ha

```yaml
dependencies:
sqflite: ^2.3.0
sqflite_tizen: ^0.1.3
sqflite: ^2.4.2
sqflite_tizen: ^0.1.4
```

Then you can import `sqflite` in your Dart code:
Expand Down
23 changes: 16 additions & 7 deletions packages/sqflite/example/integration_test/sqflite_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:async';
import 'dart:io';

import 'package:flutter_test/flutter_test.dart';
// ignore: import_of_legacy_library_into_null_safe
import 'package:integration_test/integration_test.dart';
import 'package:path/path.dart';
import 'package:pedantic/pedantic.dart';
import 'package:sqflite/sqflite.dart';

// ignore_for_file: avoid_print
Expand Down Expand Up @@ -184,10 +183,9 @@ void main() {
for (var i = 0; i < count; i++) {
final db = dbs[i]!;
try {
final name = (await db.query('Test', columns: ['name']))
.first
.values
.first as String?;
final name =
(await db.query('Test', columns: ['name'])).first.values.first
as String?;
expect(name, 'test_$i');
} finally {
await db.close();
Expand Down Expand Up @@ -256,10 +254,21 @@ void main() {

test('deleteDatabase', () async {
// await devVerbose();
const path = 'test_delete_database.db';
await deleteDatabase(path);
expect(await databaseExists(path), isFalse);

late Database db;
try {
const path = 'test_delete_database.db';
db = await openDatabase(path);
expect(await db.getVersion(), 0);
await db.setVersion(1);
await db.close();
expect(await databaseExists(path), isTrue);

await deleteDatabase(path);
expect(await databaseExists(path), isFalse);

db = await openDatabase(path);
expect(await db.getVersion(), 0);
await db.setVersion(1);
Expand Down
2 changes: 1 addition & 1 deletion packages/sqflite/example/lib/database/database.dart
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export 'database_impl.dart';
export 'database_io.dart' if (dart.library.html) 'database_web.dart';
export 'database_io.dart' if (dart.library.js_interop) 'database_web.dart';
8 changes: 3 additions & 5 deletions packages/sqflite/example/lib/database/database_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ abstract class PlatformHandler {
// Compat, to keep the example page as is
// ---

/// delete the db, create the folder and returnes its path
/// delete the db, create the folder and returns its path
Future<String> initDeleteDb(String dbName) =>
platformHandler.initDeleteDb(dbName);

Expand All @@ -61,8 +61,7 @@ Future<void> writeFileAsBytes(
String path,
List<int> bytes, {
bool flush = false,
}) =>
platformHandler.writeFileAsBytes(path, bytes, flush: flush);
}) => platformHandler.writeFileAsBytes(path, bytes, flush: flush);

/// Read a file as bytes
Future<Uint8List> readFileAsBytes(String path) =>
Expand All @@ -73,8 +72,7 @@ Future<void> writeFileAsString(
String path,
String text, {
bool flush = false,
}) =>
platformHandler.writeFileAsString(path, text, flush: flush);
}) => platformHandler.writeFileAsString(path, text, flush: flush);

/// Read a file as a string
Future<String> readFileAsString(String path) =>
Expand Down
15 changes: 8 additions & 7 deletions packages/sqflite/example/lib/exception_test_page.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/foundation.dart';
import 'package:sqflite/sqflite.dart';
import 'package:sqflite/sql.dart';
import 'package:sqflite/utils/utils.dart';
import 'package:sqflite_common/sql.dart';

import 'src/common_import.dart';
import 'test_page.dart';
Expand All @@ -24,7 +25,7 @@ class ExceptionTestPage extends TestPage {
await txn.rawInsert('INSERT INTO Test (name) VALUES (?)', <Object>[
'item',
]);
final afterCount = Sqflite.firstIntValue(
final afterCount = firstIntValue(
await txn.rawQuery('SELECT COUNT(*) FROM Test'),
);
expect(afterCount, 1);
Expand All @@ -40,7 +41,7 @@ class ExceptionTestPage extends TestPage {
}
verify(hasFailed);

final afterCount = Sqflite.firstIntValue(
final afterCount = firstIntValue(
await db.rawQuery('SELECT COUNT(*) FROM Test'),
);
expect(afterCount, 0);
Expand Down Expand Up @@ -69,7 +70,7 @@ class ExceptionTestPage extends TestPage {

verify(hasFailed);

final afterCount = Sqflite.firstIntValue(
final afterCount = firstIntValue(
await db.rawQuery('SELECT COUNT(*) FROM Test'),
);
expect(afterCount, 0);
Expand Down Expand Up @@ -384,8 +385,8 @@ class ExceptionTestPage extends TestPage {
await db.close();
});

test('Bind no argument (no iOS)', () async {
if (!platform.isIOS) {
test('Bind no argument (no iOS/MacOS)', () async {
if (!platform.isIOS && !platform.isMacOS) {
// await Sqflite.devSetDebugModeOn(true);
final path = await initDeleteDb('bind_no_arg_failed.db');
final db = await openDatabase(path);
Expand Down Expand Up @@ -499,7 +500,7 @@ class ExceptionTestPage extends TestPage {
try {
var hasTimedOut = false;
var callbackCount = 0;
Sqflite.setLockWarningInfo(
setLockWarningInfo(
duration: const Duration(milliseconds: 200),
callback: () {
callbackCount++;
Expand Down
Loading
Loading