can use a prepared statement here

This commit is contained in:
Ted Unangst 2019-04-28 22:52:40 -04:00
parent 370268399d
commit 16d05c5eea
1 changed files with 8 additions and 3 deletions

11
fun.go
View File

@ -307,8 +307,10 @@ func zaggy(keyname string) (key *rsa.PublicKey) {
log.Printf("error decoding %s pubkey: %s", keyname, err)
return
}
db.Exec("insert into xonkers (xid, ibox, obox, sbox, pubkey) values (?, ?, ?, ?, ?)",
keyname, "", "", "", data)
_, err = stmtSaveBoxes.Exec(keyname, "", "", "", data)
if err != nil {
log.Printf("error saving key: %s", err)
}
} else {
_, key, err = pez(data)
if err != nil {
@ -324,7 +326,10 @@ func zaggy(keyname string) (key *rsa.PublicKey) {
func makeitworksomehowwithoutregardforkeycontinuity(keyname string, r *http.Request, payload []byte) (string, error) {
db := opendatabase()
db.Exec("delete from xonkers where xid = ?", keyname)
_, err := db.Exec("delete from xonkers where xid = ?", keyname)
if err != nil {
log.Printf("error deleting key: %s", err)
}
ziggylock.Lock()
delete(zaggies, keyname)
ziggylock.Unlock()