commit 4ac3928766aa3d0587db8cd99276f3e38a663486
parent 9a96b3f519e1a4ed8b0b6cd3aba0f8346ee49d6d
Author: breadcat <breadcat@users.noreply.github.com>
Date: Tue, 24 Feb 2026 23:47:47 +0000
Replace $ placeholders with ?
Diffstat:
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/include-bulk.go b/include-bulk.go
@@ -440,14 +440,10 @@ func findFilesWithAnyTag(tags []TagPair) ([]int, error) {
var conditions []string
var args []interface{}
- argIndex := 1
for _, tag := range tags {
- conditions = append(conditions, fmt.Sprintf(
- "(c.name = $%d AND t.value = $%d)",
- argIndex, argIndex+1))
+ conditions = append(conditions, "(c.name = ? AND t.value = ?)")
args = append(args, tag.Category, tag.Value)
- argIndex += 2
}
query += strings.Join(conditions, " OR ")
@@ -485,20 +481,18 @@ func findFilesWithAllTags(tags []TagPair) ([]int, error) {
var conditions []string
var args []interface{}
- argIndex := 1
for _, tag := range tags {
- conditions = append(conditions, fmt.Sprintf(`
+ conditions = append(conditions, `
EXISTS (
SELECT 1 FROM file_tags ft
JOIN tags t ON ft.tag_id = t.id
JOIN categories c ON t.category_id = c.id
WHERE ft.file_id = f.id
- AND c.name = $%d
- AND t.value = $%d
- )`, argIndex, argIndex+1))
+ AND c.name = ?
+ AND t.value = ?
+ )`)
args = append(args, tag.Category, tag.Value)
- argIndex += 2
}
query += strings.Join(conditions, " AND ")