fix sql query
This commit is contained in:
parent
b634fa2665
commit
5a2f3692cf
@ -1365,7 +1365,7 @@ func (self *nntpConnection) scrapeServer(daemon *NNTPDaemon, conn *textproto.Con
|
|||||||
err = conn.PrintfLine("LIST NEWSGROUPS")
|
err = conn.PrintfLine("LIST NEWSGROUPS")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
// read response line
|
// read response line
|
||||||
code, _, err := conn.ReadCodeLine(0)
|
code, line, err := conn.ReadCodeLine(0)
|
||||||
if code == 231 || code == 215 {
|
if code == 231 || code == 215 {
|
||||||
var groups []string
|
var groups []string
|
||||||
// valid response, we expect a multiline
|
// valid response, we expect a multiline
|
||||||
@ -1413,7 +1413,7 @@ func (self *nntpConnection) scrapeServer(daemon *NNTPDaemon, conn *textproto.Con
|
|||||||
}
|
}
|
||||||
} else if err == nil {
|
} else if err == nil {
|
||||||
// invalid response no error
|
// invalid response no error
|
||||||
log.Println(self.name, "gave us invalid response to newsgroups command", code)
|
log.Println(self.name, "gave us invalid response to newsgroups command", line)
|
||||||
} else {
|
} else {
|
||||||
// invalid response with error
|
// invalid response with error
|
||||||
log.Println(self.name, "error while reading response from newsgroups command", err)
|
log.Println(self.name, "error while reading response from newsgroups command", err)
|
||||||
|
@ -192,7 +192,7 @@ func (self *PostgresDatabase) prepareStatements() {
|
|||||||
GetMessageIDByHash: "SELECT message_id, message_newsgroup FROM Articles WHERE message_id_hash = $1 LIMIT 1",
|
GetMessageIDByHash: "SELECT message_id, message_newsgroup FROM Articles WHERE message_id_hash = $1 LIMIT 1",
|
||||||
CheckEncIPBanned: "SELECT 1 FROM EncIPBans WHERE encaddr = $1",
|
CheckEncIPBanned: "SELECT 1 FROM EncIPBans WHERE encaddr = $1",
|
||||||
GetFirstAndLastForGroup: "WITH x(min_no, max_no) AS ( SELECT MIN(message_no) AS min_no, MAX(message_no) AS max_no FROM ArticleNumbers WHERE newsgroup = $1) SELECT CASE WHEN min_no IS NULL THEN 0 ELSE min_no END AS min_no FROM x UNION SELECT CASE WHEN max_no IS NULL THEN 1 ELSE max_no END AS max_no FROM x",
|
GetFirstAndLastForGroup: "WITH x(min_no, max_no) AS ( SELECT MIN(message_no) AS min_no, MAX(message_no) AS max_no FROM ArticleNumbers WHERE newsgroup = $1) SELECT CASE WHEN min_no IS NULL THEN 0 ELSE min_no END AS min_no FROM x UNION SELECT CASE WHEN max_no IS NULL THEN 1 ELSE max_no END AS max_no FROM x",
|
||||||
GetNewsgroupList: "SELECT newsgroup, min(message_no), max(message_no) FROM ArticlePosts GROUP BY newsgroup",
|
GetNewsgroupList: "SELECT newsgroup, min(message_no), max(message_no) FROM ArticleNumbers GROUP BY newsgroup",
|
||||||
GetMessageIDForNNTPID: "SELECT message_id FROM ArticleNumbers WHERE newsgroup = $1 AND message_no = $2 LIMIT 1",
|
GetMessageIDForNNTPID: "SELECT message_id FROM ArticleNumbers WHERE newsgroup = $1 AND message_no = $2 LIMIT 1",
|
||||||
GetNNTPIDForMessageID: "SELECT message_no FROM ArticleNumbers WHERE newsgroup = $1 AND message_id = $2 LIMIT 1",
|
GetNNTPIDForMessageID: "SELECT message_no FROM ArticleNumbers WHERE newsgroup = $1 AND message_id = $2 LIMIT 1",
|
||||||
IsExpired: "WITH x(msgid) AS ( SELECT message_id FROM Articles WHERE message_id = $1 INTERSECT ( SELECT message_id FROM ArticlePosts WHERE message_id = $1 ) ) SELECT COUNT(*) FROM x",
|
IsExpired: "WITH x(msgid) AS ( SELECT message_id FROM Articles WHERE message_id = $1 INTERSECT ( SELECT message_id FROM ArticlePosts WHERE message_id = $1 ) ) SELECT COUNT(*) FROM x",
|
||||||
|
Reference in New Issue
Block a user