(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';")
(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:start-sql-recording)
(clsql:file-enable-sql-reader-syntax)
(defmacrodbfun(name&restbody)
(defmacrodbfun(name&restbody)
`(defun,name,(carbody)
`(defun,name,(carbody)
@ -19,26 +18,22 @@
(dbfuninsert-post(post_nrboardflags)
(dbfuninsert-post(post_nrboardflags)
(clsql:query(formatnil"insert ignore into posts (post_nr, board) values (~a, '~a');"post_nrboard))
(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)))))
(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
(clsql:execute-command
(with-output-to-string(s)
(with-output-to-string(s)
(formats"insert into postflags (post_nr, flag) values")
(formats"insert into postflags (post_nr, flag) values")