h0tb0x/h0tb0x — pull request #37 by Javantea (2013-11-09 21:54:35+00:00)
Title: Fix Delete SQL Syntax error.

curl -i -X DELETE 'http://localhost:8000/api/friends/H-Z_nmyyR9k3gSbp5Gm0t2KY5BRZ6zeRy4BBmQ=='
curl: (52) Empty reply from server

2013/11/09 13:17:31 http: panic serving [::1]:47677: sqlite3: near "INTO": syntax error [1]
goroutine 109 [running]:
net/http.func·007()
/usr/lib/go/src/pkg/net/http/server.go:1022 +0xac
h0tb0x/db.(*Database).Exec(0xc2000a9990, 0x7db370, 0x2b, 0x7fa906f40c60, 0x1, ...)
/home/h/h0tb0x/src/h0tb0x/db/db.go:110 +0xb2
h0tb0x/sync.(*SyncMgr).onFriendChange(0xc201938b70, 0x1, 0xc2019a9240, 0x2)
/home/h/h0tb0x/src/h0tb0x/sync/sync.go:294 +0x18b
h0tb0x/sync.*SyncMgr.(h0tb0x/sync.onFriendChange)·fm(0x1, 0xc2019a9240, 0x2)
/home/h/h0tb0x/src/h0tb0x/sync/sync.go:186 +0x42
h0tb0x/link.(*LinkMgr).RemoveFriend(0xc2019a4000, 0xc2019a9240)
/home/h/h0tb0x/src/h0tb0x/link/link.go:420 +0x12c
h0tb0x/api.(*ApiMgr).deleteFriend(0xc20191d8c0, 0xc2020a8380, 0xc2019d2850, 0xc201c20000)
/home/h/h0tb0x/src/h0tb0x/api/api.go:379 +0x9a
h0tb0x/api.*ApiMgr.(h0tb0x/api.deleteFriend)·fm(0xc2020a8380, 0xc2019d2850, 0xc201c20000)
/home/h/h0tb0x/src/h0tb0x/api/api.go:103 +0x42
net/http.HandlerFunc.ServeHTTP(0xc2019a1910, 0xc2020a8380, 0xc2019d2850, 0xc201c20000)
/usr/lib/go/src/pkg/net/http/server.go:1149 +0x3e
github.com/gorilla/mux.(*Router).ServeHTTP(0xc2019a6000, 0xc2020a8380, 0xc2019d2850, 0xc201c20000)
/home/h/h0tb0x/src/github.com/gorilla/mux/mux.go:90 +0x1e1
net/http.serverHandler.ServeHTTP(0xc2019a6050, 0xc2020a8380, 0xc2019d2850, 0xc201c20000)
/usr/lib/go/src/pkg/net/http/server.go:1517 +0x16c
net/http.(*conn).serve(0xc201e5d750)
/usr/lib/go/src/pkg/net/http/server.go:1096 +0x765
created by net/http.(*Server).Serve
/usr/lib/go/src/pkg/net/http/server.go:1564 +0x266

After the patch:

curl -i -X DELETE 'http://localhost:8000/api/friends/H-Z_nmyyR9k3gSbp5Gm0t2KY5BRZ6zeRy4BBmQ=='
HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Content-Length: 0
Date: Sat, 09 Nov 2013 21:23:35 GMT

Friend is deleted in web UI. Friend is deleted from Friend table and TopicFriend table.