(defvarget-posts-sql"SELECT posts.post_nr, flags.flag from flags left join postflags on (postflags.flag = flags.id) left join posts on (postflags.post_nr = posts.id) where posts.post_nr in (~{'~a'~^,~}) and posts.board = '~a';")
(clsql:file-enable-sql-reader-syntax)
;; (clsql:start-sql-recording)
(defmacrodbfun(name&restbody)
`(defun,name,(carbody)
@ -19,26 +18,22 @@
(dbfuninsert-post(post_nrboardflags)
(clsql:query(formatnil"insert ignore into posts (post_nr, board) values (~a, '~a');"post_nrboard))
(let((post-id(caar(clsql:query(formatnil"select id from posts where post_nr = ~a and board = '~a';"post_nrboard)))))
(clsql:with-transaction()
(clsql:execute-command
(with-output-to-string(s)
(formats"insert into postflags (post_nr, flag) values")