all repos — honk @ 9a60ad332e2aff7536da92a2740262b81ffe7dcd

my fork of honk

only join strings once
Ted Unangst tedu@tedunangst.com
Wed, 30 Oct 2019 03:36:28 -0400
commit

9a60ad332e2aff7536da92a2740262b81ffe7dcd

parent

8c5bb0936be92dfd05ae43a5430ee40e7e556f27

1 files changed, 5 insertions(+), 3 deletions(-)

jump to
M database.godatabase.go

@@ -372,8 +372,9 @@ for _, h := range honks {

ids = append(ids, fmt.Sprintf("%d", h.ID)) hmap[h.ID] = h } + idset := strings.Join(ids, ",") // grab donks - q := fmt.Sprintf("select honkid, donks.fileid, xid, name, description, url, media, local from donks join filemeta on donks.fileid = filemeta.fileid where honkid in (%s)", strings.Join(ids, ",")) + q := fmt.Sprintf("select honkid, donks.fileid, xid, name, description, url, media, local from donks join filemeta on donks.fileid = filemeta.fileid where honkid in (%s)", idset) rows, err := db.Query(q) if err != nil { log.Printf("error querying donks: %s", err)

@@ -394,7 +395,7 @@ }

rows.Close() // grab onts - q = fmt.Sprintf("select honkid, ontology from onts where honkid in (%s)", strings.Join(ids, ",")) + q = fmt.Sprintf("select honkid, ontology from onts where honkid in (%s)", idset) rows, err = db.Query(q) if err != nil { log.Printf("error querying onts: %s", err)

@@ -413,8 +414,9 @@ h := hmap[hid]

h.Onts = append(h.Onts, o) } rows.Close() + // grab meta - q = fmt.Sprintf("select honkid, genus, json from honkmeta where honkid in (%s)", strings.Join(ids, ",")) + q = fmt.Sprintf("select honkid, genus, json from honkmeta where honkid in (%s)", idset) rows, err = db.Query(q) if err != nil { log.Printf("error querying honkmeta: %s", err)