mod_storage_sql: Log an error on query failure.
authorWaqas Hussain <waqas20@gmail.com>
Mon, 27 Dec 2010 01:10:35 +0000 (06:10 +0500)
committerWaqas Hussain <waqas20@gmail.com>
Mon, 27 Dec 2010 01:10:35 +0000 (06:10 +0500)
plugins/mod_storage_sql.lua

index 85c9fbdfb414e38788317582b492b4786907ab8c..7508072621e55a7079f2576ce2bb839748767334 100644 (file)
@@ -91,7 +91,7 @@ local function getsql(sql, ...)
        end
        -- do prepared statement stuff
        local stmt, err = connection:prepare(sql);
-       if not stmt then return nil, err; end
+       if not stmt then module:log("error", "QUERY FAILED: %s %s", err, debug.traceback()); return nil, err; end
        -- run query
        local ok, err = stmt:execute(host or "", user or "", store or "", ...);
        if not ok then return nil, err; end