Merge branch 'dont-use-double-quoted-strings' into develop

This commit is contained in:
Simon Binder 2020-02-25 14:17:38 +01:00
commit d7bb4f51e6
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
11 changed files with 82 additions and 18 deletions

View File

@ -31,4 +31,16 @@ void crudTests(TestExecutor executor) {
await db.close();
});
test('runCustom with args', () async {
// https://github.com/simolus3/moor/issues/406
final db = Database(executor.createExecutor());
// ignore: invalid_use_of_visible_for_testing_member, invalid_use_of_protected_member
await db.customStatement(
'INSERT INTO friendships (first_user, second_user) VALUES (?, ?)',
<int>[1, 2]);
expect(await db.friendsOf(1), isNotEmpty);
});
}

View File

@ -18,6 +18,10 @@
- Moor will no longer wait for query stream listeners to receive a done event when closing a database
or transaction.
## 2.4.1
- Don't generate double quoted string literals in date time functions
## 2.4.0
- Support aggregate expressions and `group by` in the Dart api

View File

@ -56,9 +56,9 @@ class _StrftimeSingleFieldExpression extends Expression<int> {
@override
void writeInto(GenerationContext context) {
context.buffer.write('CAST(strftime("$format", ');
context.buffer.write("CAST(strftime('$format', ");
date.writeInto(context);
context.buffer.write(', "unixepoch") AS INTEGER)');
context.buffer.write(", 'unixepoch') AS INTEGER)");
}
@override

View File

@ -1,6 +1,6 @@
name: moor
description: Moor is a safe and reactive persistence library for Dart applications
version: 2.4.0
version: 2.4.1
repository: https://github.com/simolus3/moor
homepage: https://moor.simonbinder.eu/
issue_tracker: https://github.com/simolus3/moor/issues

View File

@ -19,6 +19,6 @@ void main() {
final ctx = GenerationContext(null, null);
nonNull.isSmallerThan(currentDateAndTime).writeInto(ctx);
expect(ctx.sql, 'name < strftime(\'%s\', CURRENT_TIMESTAMP)');
expect(ctx.sql, "name < strftime('%s', CURRENT_TIMESTAMP)");
});
}

View File

@ -49,4 +49,6 @@ void main() {
await db.close();
await isolate.shutdownAll();
});
tearDown(_file.delete);
}

View File

@ -10,12 +10,12 @@ void main() {
group('extracting information via top-level method', () {
final expectedResults = <_Extractor, String>{
(d) => d.year: 'CAST(strftime("%Y", val, "unixepoch") AS INTEGER)',
(d) => d.month: 'CAST(strftime("%m", val, "unixepoch") AS INTEGER)',
(d) => d.day: 'CAST(strftime("%d", val, "unixepoch") AS INTEGER)',
(d) => d.hour: 'CAST(strftime("%H", val, "unixepoch") AS INTEGER)',
(d) => d.minute: 'CAST(strftime("%M", val, "unixepoch") AS INTEGER)',
(d) => d.second: 'CAST(strftime("%S", val, "unixepoch") AS INTEGER)',
(d) => d.year: "CAST(strftime('%Y', val, 'unixepoch') AS INTEGER)",
(d) => d.month: "CAST(strftime('%m', val, 'unixepoch') AS INTEGER)",
(d) => d.day: "CAST(strftime('%d', val, 'unixepoch') AS INTEGER)",
(d) => d.hour: "CAST(strftime('%H', val, 'unixepoch') AS INTEGER)",
(d) => d.minute: "CAST(strftime('%M', val, 'unixepoch') AS INTEGER)",
(d) => d.second: "CAST(strftime('%S', val, 'unixepoch') AS INTEGER)",
};
expectedResults.forEach((key, value) {

View File

@ -1,3 +1,7 @@
## 2.1.1
- Fix `runCustom` not using the provided variables ([#406](https://github.com/simolus3/moor/issues/406))
## 2.1.0
- Expose the underlying database from sqflite in `FlutterQueryExecutor`.

View File

@ -126,7 +126,7 @@ mixin _SqfliteExecutor on QueryDelegate {
@override
Future<void> runCustom(String statement, List args) {
return db.execute(statement);
return db.execute(statement, args);
}
@override

View File

@ -1,13 +1,27 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
archive:
dependency: transitive
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.11"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.2"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.0"
version: "2.4.0"
boolean_selector:
dependency: transitive
description:
@ -36,6 +50,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
flutter:
dependency: "direct main"
description: flutter
@ -46,27 +67,34 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.5"
version: "0.12.6"
meta:
dependency: "direct main"
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.7"
version: "1.1.8"
moor:
dependency: "direct main"
description:
path: "../moor"
relative: true
source: path
version: "2.0.1"
version: "2.4.0"
path:
dependency: "direct main"
description:
@ -81,6 +109,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0+1"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
quiver:
dependency: transitive
description:
@ -148,7 +183,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.5"
version: "0.2.11"
typed_data:
dependency: transitive
description:
@ -163,6 +198,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.5.0"
sdks:
dart: ">=2.2.2 <3.0.0"
dart: ">=2.4.0 <3.0.0"
flutter: ">=1.2.1 <2.0.0"

View File

@ -1,6 +1,6 @@
name: moor_flutter
description: Flutter implementation of moor, a safe and reactive persistence library for Dart applications
version: 2.1.0
version: 2.1.1
repository: https://github.com/simolus3/moor
homepage: https://moor.simonbinder.eu/
issue_tracker: https://github.com/simolus3/moor/issues