Fix up array error

This commit is contained in:
Eliot Whalan 2016-06-24 17:11:49 +10:00
parent 630ed5403d
commit 79eceb27d4
No known key found for this signature in database
GPG Key ID: C0A42175139840D6
1 changed files with 6 additions and 4 deletions

10
main.go
View File

@ -88,14 +88,16 @@ func save(raw string, lang string, title string) []string {
check(err)
sha := hash(raw)
query, err := db.Query("select id, hash, data, delkey from pastebin")
query, err := db.Query("select id, title hash, data, delkey from pastebin")
for query.Next() {
var id, hash, paste, delkey string
err := query.Scan(&id, &hash, &paste, &delkey)
var id, title, hash, paste, delkey string
err := query.Scan(&id, &title, &hash, &paste, &delkey)
check(err)
if hash == sha {
url := ADDRESS + "/p/" + id
return []string{id, hash, url, paste, delkey}
if title == "" {
return []string{id, title, hash, url, paste, delkey}
}
}
}
id := generateName()