Comparison

plugins/mod_storage_sql.lua @ 5209:f5d121846d53

mod_storage_sql: Return actual error string on commit failure.
author Waqas Hussain <waqas20@gmail.com>
date Fri, 30 Nov 2012 08:50:03 +0500
parent 5154:429c8eeea035
child 5776:bd0ff8ae98a8
comparison
equal deleted inserted replaced
5207:c5edb08fc7cb 5209:f5d121846d53
226 local function rollback(...) 226 local function rollback(...)
227 if connection then connection:rollback(); end -- FIXME check for rollback error? 227 if connection then connection:rollback(); end -- FIXME check for rollback error?
228 return ...; 228 return ...;
229 end 229 end
230 local function commit(...) 230 local function commit(...)
231 if not connection:commit() then return nil, "SQL commit failed"; end 231 local success,err = connection:commit();
232 if not success then return nil, "SQL commit failed: "..tostring(err); end
232 return ...; 233 return ...;
233 end 234 end
234 235
235 local function keyval_store_get() 236 local function keyval_store_get()
236 local stmt, err = getsql("SELECT * FROM `prosody` WHERE `host`=? AND `user`=? AND `store`=?"); 237 local stmt, err = getsql("SELECT * FROM `prosody` WHERE `host`=? AND `user`=? AND `store`=?");