Software /
code /
prosody
Comparison
plugins/mod_storage_sql.lua @ 3978:13ee740b1f89
mod_storage_sql: Log an error on query failure.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Mon, 27 Dec 2010 06:10:35 +0500 |
parent | 3977:6724853adb80 |
child | 3980:6b2fac6602b3 |
comparison
equal
deleted
inserted
replaced
3977:6724853adb80 | 3978:13ee740b1f89 |
---|---|
89 if params.driver == "PostgreSQL" then | 89 if params.driver == "PostgreSQL" then |
90 sql = sql:gsub("`", "\""); | 90 sql = sql:gsub("`", "\""); |
91 end | 91 end |
92 -- do prepared statement stuff | 92 -- do prepared statement stuff |
93 local stmt, err = connection:prepare(sql); | 93 local stmt, err = connection:prepare(sql); |
94 if not stmt then return nil, err; end | 94 if not stmt then module:log("error", "QUERY FAILED: %s %s", err, debug.traceback()); return nil, err; end |
95 -- run query | 95 -- run query |
96 local ok, err = stmt:execute(host or "", user or "", store or "", ...); | 96 local ok, err = stmt:execute(host or "", user or "", store or "", ...); |
97 if not ok then return nil, err; end | 97 if not ok then return nil, err; end |
98 | 98 |
99 return stmt; | 99 return stmt; |