diff --git a/assets/style.css b/assets/style.css index 8a0c988..bb86eb2 100644 --- a/assets/style.css +++ b/assets/style.css @@ -7,6 +7,7 @@ body{ padding:0 10px } h1,h2,h3{line-height:1.2} +p{margin-bottom:0px} .spoiler,.spoiler2{background:#444} .spoiler:hover,.spoiler2:hover{color:#FFF} .greentext{color:#282} diff --git a/src/lua/init.lua b/src/lua/init.lua index ae1e1f5..e27d414 100644 --- a/src/lua/init.lua +++ b/src/lua/init.lua @@ -83,6 +83,15 @@ local function sqlassert(...) return r end +local function sqlbind(stmnt,call,position,data) + assert(call == "bind" or call == "bind_blob","Bad bind call, call was:" .. call) + local f = stmnt[call](stmnt,position,data) + if f ~= sql.OK then + error(string.format("Failed to %s at %d with %q: %s", call, position, data, db:errmsg()),2) + end +end + + print("Hello from init.lua") function configure() db = sqlassert(sql.open("data/posts.db")) @@ -563,11 +572,17 @@ function paste(req) --local iphash = sha3(ip) --Don't store this information for now, until I come up --with a more elegent solution. - assert(stmnt_paste:bind_blob(1,text) == sql.OK) - assert(stmnt_paste:bind(2,esctitle) == sql.OK) - assert(stmnt_paste:bind(3,-1) == sql.OK) - assert(stmnt_paste:bind(4,true) == sql.OK) - assert(stmnt_paste:bind_blob(5,"") == sql.OK) + + sqlbind(stmnt_paste,"bind_blob",1,text) + --assert(stmnt_paste:bind_blob(1,text) == sql.OK) + sqlbind(stmnt_paste,"bind",2,esctitle) + --assert(stmnt_paste:bind(2,esctitle) == sql.OK) + sqlbind(stmnt_paste,"bind",3,-1) + --assert(stmnt_paste:bind(3,-1) == sql.OK) + sqlbind(stmnt_paste,"bind",4,true) + --assert(stmnt_paste:bind(4,true) == sql.OK) + sqlbind(stmnt_paste,"bind_blob",5,"") + --assert(stmnt_paste:bind_blob(5,"") == sql.OK) err = do_sql(stmnt_paste) if err == sql.DONE then local rowid = stmnt_paste:last_insert_rowid()