Fix query in example app

This commit is contained in:
Simon Binder 2022-07-12 17:52:04 +02:00
parent 7d940f8fd8
commit a3109b4a6b
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
2 changed files with 5 additions and 4 deletions

View File

@ -76,8 +76,9 @@ class AppDatabase extends _$AppDatabase {
/// Returns an auto-updating stream of all todo entries in a given category
/// id.
Stream<List<TodoEntryWithCategory>> entriesInCategory(int? categoryId) {
final query = select(todoEntries).join(
[leftOuterJoin(categories, categories.id.equalsExp(todoEntries.id))]);
final query = select(todoEntries).join([
leftOuterJoin(categories, categories.id.equalsExp(todoEntries.category))
]);
if (categoryId != null) {
query.where(categories.id.equals(categoryId));

View File

@ -3,7 +3,7 @@
part of 'database.dart';
// **************************************************************************
// MoorGenerator
// DriftDatabaseGenerator
// **************************************************************************
// ignore_for_file: type=lint
@ -655,7 +655,7 @@ abstract class _$AppDatabase extends GeneratedDatabase {
Selectable<SearchResult> _search(String query) {
return customSelect(
'SELECT"todos"."id" AS "nested_0.id", "todos"."description" AS "nested_0.description", "todos"."category" AS "nested_0.category", "todos"."due_date" AS "nested_0.due_date","cat"."id" AS "nested_1.id", "cat"."name" AS "nested_1.name", "cat"."color" AS "nested_1.color" FROM text_entries INNER JOIN todo_entries AS todos ON todos.id = text_entries."rowid" LEFT OUTER JOIN categories AS cat ON cat.id = todos.category WHERE text_entries MATCH @1 ORDER BY rank',
'SELECT"todos"."id" AS "nested_0.id", "todos"."description" AS "nested_0.description", "todos"."category" AS "nested_0.category", "todos"."due_date" AS "nested_0.due_date","cat"."id" AS "nested_1.id", "cat"."name" AS "nested_1.name", "cat"."color" AS "nested_1.color" FROM text_entries INNER JOIN todo_entries AS todos ON todos.id = text_entries."rowid" LEFT OUTER JOIN categories AS cat ON cat.id = todos.category WHERE text_entries MATCH ?1 ORDER BY rank',
variables: [
Variable<String>(query)
],