mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-11-21 20:00:49 +01:00
album_completeness.dart and library_search.dart need only the shadow table name and the shadow predicate, but imported all of sqlite_helpers.dart (dart:io, path_provider, the sqflite FFI factory) for them. Both now live in library_shadow_sql.dart, which sqlite_helpers.dart re-exports, so the sqlite.libraryShadowTable and sqlite.libraryNotShadowedSql names stay the same. No behavior change.
21 lines
833 B
Dart
21 lines
833 B
Dart
/// TEMP pairs of a Library row and the History row whose path keys match it:
|
|
/// the scanned files a download already holds. `LibraryShadowSnapshot` in
|
|
/// sqlite_helpers.dart keeps it on the Library connection.
|
|
const libraryShadowTable = 'temp.library_shadowed';
|
|
|
|
/// The Library row [alias] is not shadowed by a downloaded History file.
|
|
/// [snapshot] reads [libraryShadowTable] instead of probing every path key
|
|
/// of the row; both select the same rows.
|
|
String libraryNotShadowedSql(String alias, {bool snapshot = false}) => snapshot
|
|
? '''
|
|
NOT EXISTS (
|
|
SELECT 1 FROM $libraryShadowTable shadow WHERE shadow.item_id = $alias.id
|
|
)'''
|
|
: '''
|
|
NOT EXISTS (
|
|
SELECT 1
|
|
FROM library_path_keys lpk
|
|
JOIN history_db.history_path_keys hpk ON hpk.path_key = lpk.path_key
|
|
WHERE lpk.item_id = $alias.id
|
|
)''';
|