aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/data/put.go
diff options
context:
space:
mode:
authorJP Appel <jeanpierre.appel01@gmail.com>2025-08-10 20:39:00 -0400
committerJP Appel <jeanpierre.appel01@gmail.com>2025-08-10 20:39:00 -0400
commit49a2d76d2be793f9aeddd9997ae8abba4a7f03f2 (patch)
tree1e831080aed8ba488706ba3484c01dcd5489cbb6 /pkg/data/put.go
parent92de2b63b6bd0642b92e7ca1c6110bab7f3a2e6b (diff)
Fix approximate queries on nullable categories
Diffstat (limited to 'pkg/data/put.go')
-rw-r--r--pkg/data/put.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/pkg/data/put.go b/pkg/data/put.go
index 4830dbe..e1c3c02 100644
--- a/pkg/data/put.go
+++ b/pkg/data/put.go
@@ -171,7 +171,7 @@ func (p Put) tags() error {
return nil
}
- query, args := BatchQuery("INSERT OR IGNORE INTO Tags (name) VALUES", "", "(?)", ",", "", len(p.Doc.Tags), p.Doc.Tags)
+ query, args := BatchQuery("INSERT OR IGNORE INTO Tags (tag) VALUES", "", "(?)", ",", "", len(p.Doc.Tags), p.Doc.Tags)
if _, err := p.tx.Exec(query, args...); err != nil {
return err
}
@@ -180,7 +180,7 @@ func (p Put) tags() error {
INSERT INTO DocumentTags
SELECT %d, Tags.id
FROM Tags
- WHERE name IN
+ WHERE tag IN
`, p.Id)
query, args = BatchQuery(preQuery, "(", "?", ",", ")", len(p.Doc.Tags), p.Doc.Tags)
@@ -197,7 +197,7 @@ func (p PutMany) tags(ctx context.Context) error {
return err
}
- txNewTagStmt, err := tx.Prepare("INSERT OR IGNORE INTO Tags (name) VALUES (?)")
+ txNewTagStmt, err := tx.Prepare("INSERT OR IGNORE INTO Tags (tag) VALUES (?)")
if err != nil {
tx.Rollback()
return err
@@ -219,7 +219,7 @@ func (p PutMany) tags(ctx context.Context) error {
INSERT INTO DocumentTags (docId, tagId)
SELECT %d, Tags.id
FROM Tags
- WHERE name IN
+ WHERE tag IN
`, id)
query, args := BatchQuery(preQuery, "(", "?", ",", ")", len(doc.Tags), doc.Tags)
if _, err := tx.Exec(query, args...); err != nil {
@@ -280,13 +280,13 @@ func (p Put) authors() error {
return nil
}
- authStmt, err := p.tx.Prepare("INSERT OR IGNORE INTO Authors(name) VALUES(?)")
+ authStmt, err := p.tx.Prepare("INSERT OR IGNORE INTO Authors(author) VALUES(?)")
if err != nil {
return err
}
defer authStmt.Close()
- idStmt, err := p.tx.Prepare("SELECT id FROM Authors WHERE name = ?")
+ idStmt, err := p.tx.Prepare("SELECT id FROM Authors WHERE author = ?")
if err != nil {
return err
}
@@ -323,13 +323,13 @@ func (p PutMany) authors(ctx context.Context) error {
return err
}
- authStmt, err := tx.Prepare("INSERT OR IGNORE INTO Authors(name) VALUES(?)")
+ authStmt, err := tx.Prepare("INSERT OR IGNORE INTO Authors(author) VALUES(?)")
if err != nil {
return err
}
defer authStmt.Close()
- idStmt, err := tx.Prepare("SELECT id FROM Authors WHERE name = ?")
+ idStmt, err := tx.Prepare("SELECT id FROM Authors WHERE author = ?")
if err != nil {
return err
}