# HG changeset patch # User Kim Alvefur # Date 1436112005 -7200 # Node ID 9dc05d3efdc9183f1d7a7d87e44ff81fc74104e8 # Parent 6728ad0417617ecdfa01f83a8e037cfa92ea1cc9# Parent ccf4fcfc202415d4437bd77de2387425efca6952 Merge 0.10->trunk diff -r 6728ad041761 -r 9dc05d3efdc9 plugins/mod_storage_sql2.lua --- a/plugins/mod_storage_sql2.lua Thu Jun 25 18:57:43 2015 +0200 +++ b/plugins/mod_storage_sql2.lua Sun Jul 05 18:00:05 2015 +0200 @@ -413,10 +413,10 @@ end local function normalize_params(params) - assert(params.driver and params.database, "Configuration error: Both the SQL driver and the database need to be specified"); if params.driver == "SQLite3" then params.database = resolve_relative_path(prosody.paths.data or ".", params.database or "prosody.sqlite"); end + assert(params.driver and params.database, "Configuration error: Both the SQL driver and the database need to be specified"); return params; end diff -r 6728ad041761 -r 9dc05d3efdc9 plugins/sql.lib.lua --- a/plugins/sql.lib.lua Thu Jun 25 18:57:43 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -local cache = module:shared("/*/sql.lib/util.sql"); - -if not cache._M then - prosody.unlock_globals(); - cache._M = require "util.sql"; - prosody.lock_globals(); -end - -return cache._M; diff -r 6728ad041761 -r 9dc05d3efdc9 util/sql.lua --- a/util/sql.lua Thu Jun 25 18:57:43 2015 +0200 +++ b/util/sql.lua Sun Jul 05 18:00:05 2015 +0200 @@ -111,8 +111,12 @@ self.conn = dbh; self.prepared = {}; self:set_encoding(); + self:onconnect(); return true; end +function engine:onconnect() + -- Override from create_engine() +end function engine:execute(sql, ...) local success, err = self:connect(); if not success then return success, err; end