Changeset

6749:9dc05d3efdc9

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Sun, 05 Jul 2015 18:00:05 +0200
parents 6745:6728ad041761 (current diff) 6748:ccf4fcfc2024 (diff)
children 6767:d01c29b62b16
files plugins/mod_storage_sql2.lua plugins/sql.lib.lua
diffstat 3 files changed, 5 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- 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
 
--- 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;
--- 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