diff options
| author | JP Appel <jeanpierre.appel01@gmail.com> | 2025-08-10 20:39:00 -0400 |
|---|---|---|
| committer | JP Appel <jeanpierre.appel01@gmail.com> | 2025-08-10 20:39:00 -0400 |
| commit | 49a2d76d2be793f9aeddd9997ae8abba4a7f03f2 (patch) | |
| tree | 1e831080aed8ba488706ba3484c01dcd5489cbb6 /pkg/data/update.go | |
| parent | 92de2b63b6bd0642b92e7ca1c6110bab7f3a2e6b (diff) | |
Fix approximate queries on nullable categories
Diffstat (limited to 'pkg/data/update.go')
| -rw-r--r-- | pkg/data/update.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/pkg/data/update.go b/pkg/data/update.go index 52d9d53..7f74236 100644 --- a/pkg/data/update.go +++ b/pkg/data/update.go @@ -263,7 +263,7 @@ func (u Update) tags() error { } query, args := BatchQuery( - "INSERT OR IGNORE INTO Tags (name) VALUES", + "INSERT OR IGNORE INTO Tags (tag) VALUES", "", "(?)", ",", "", len(u.Doc.Tags), u.Doc.Tags, ) @@ -275,7 +275,7 @@ func (u Update) tags() error { INSERT INTO DocumentTags SELECT %d, Tags.id FROM Tags - WHERE name in + WHERE tag in `, u.Id) query, args = BatchQuery( preqQuery, "(", "?", ",", ")", @@ -308,7 +308,7 @@ func (u UpdateMany) tags() error { continue } insertTag, args := BatchQuery( - "INSERT OR IGNORE INTO Tags (name) VALUES", + "INSERT OR IGNORE INTO Tags (tag) VALUES", "", "(?)", ",", "", len(doc.Tags), doc.Tags, ) @@ -321,7 +321,7 @@ func (u UpdateMany) tags() error { INSERT INTO DocumentTags SELECT %d, Tags.id FROM Tags - WHERE name in + WHERE tag in `, id) setDocTags, _ := BatchQuery( preqQuery, "(", "?", ",", ")", @@ -390,13 +390,13 @@ func (u Update) authors() error { return err } - authStmt, err := u.tx.Prepare("INSERT OR IGNORE INTO Authors(name) VALUES(?)") + authStmt, err := u.tx.Prepare("INSERT OR IGNORE INTO Authors(author) VALUES(?)") if err != nil { return err } defer authStmt.Close() - idStmt, err := u.tx.Prepare("SELECT id FROM Authors WHERE name = ?") + idStmt, err := u.tx.Prepare("SELECT id FROM Authors WHERE author = ?") if err != nil { return err } @@ -433,13 +433,13 @@ func (u UpdateMany) authors() error { } defer deleteStmt.Close() - authStmt, err := u.tx.Prepare("INSERT OR IGNORE INTO Authors(name) VALUES(?)") + authStmt, err := u.tx.Prepare("INSERT OR IGNORE INTO Authors(author) VALUES(?)") if err != nil { return err } defer authStmt.Close() - idStmt, err := u.tx.Prepare("SELECT id FROM Authors WHERE name = ?") + idStmt, err := u.tx.Prepare("SELECT id FROM Authors WHERE author = ?") if err != nil { return err } |
