login

<     >

2023-07-17 13:23:59 (UTC-03:00)

Marcel Rodrigues <marcelgmr@gmail.com>

db: on error return status instead of the given SQL

diff --git a/lib/ludweb/sqlite.lua b/lib/ludweb/sqlite.lua
index 8daa160..c0dc721 100644
--- a/lib/ludweb/sqlite.lua
+++ b/lib/ludweb/sqlite.lua
@@ -42,7 +42,7 @@ DB.__index = DB
 function DB:execute(sql, ...)
     local pstmt = ffi.new("sqlite3_stmt *[1]")
     local res = CODE[C.sqlite3_prepare_v2(self.db, sql, #sql, pstmt, nil)]
-    if res ~= "OK" then error(sql) end
+    if res ~= "OK" then error(res) end
     local stmt = pstmt[0]
     local arg = {...}
     for i, v in ipairs(arg) do