Add SQL helper utilities and migrate queries

This commit is contained in:
Jordan Wages 2025-09-24 05:48:06 -05:00
commit fa68916d3e
2 changed files with 218 additions and 136 deletions

View file

@ -113,6 +113,7 @@ CREATE INDEX idx_artists_name_nocase ON artists(name COLLATE NOCASE);
- `createAsyncListState` Manages loading, error, and empty states for async lists.
- `prepareForView` Wraps `db.prepare` to attach view/label metadata for logging.
- `normalizePaginationState` / `clampPaginationToTotal` Normalizes and clamps pagination inputs while emitting DEBUG telemetry.
- `sqlValue`, `sqlLike`, `sqlIdentifier`, and the `sql` template tag central helpers for manual SQL construction; always use these when interpolating dynamic values.
## Debugging & Logging
- Runtime diagnostics are gated behind a localStorage flag. Enable with `localStorage.setItem('mp3com.debug', 'true')` (or `'false'`/`removeItem` to disable) before reloading the app.