Software /
code /
prosody
Comparison
plugins/mod_storage_sql.lua @ 4046:467e73951610
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 | 4045:054e05b27611 |
child | 3980:6b2fac6602b3 |
comparison
equal
deleted
inserted
replaced
4045:054e05b27611 | 4046:467e73951610 |
---|---|
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; |