diff plugins/mod_storage_sql.lua @ 4097:2d3866aed062

Merge 0.8->trunk
author Matthew Wild <mwild1@gmail.com>
date Fri, 07 Jan 2011 11:59:05 +0000
parents 3b991ceb228e
children 06778bc27d53
line wrap: on
line diff
--- a/plugins/mod_storage_sql.lua	Fri Jan 07 05:11:17 2011 +0000
+++ b/plugins/mod_storage_sql.lua	Fri Jan 07 11:59:05 2011 +0000
@@ -32,11 +32,18 @@
 local host,user,store = module.host;
 local params = module:get_option("sql");
 
+local resolve_relative_path = require "core.configmanager".resolve_relative_path;
+
 do -- process options to get a db connection
 	local DBI = require "DBI";
 
-	params = params or { driver = "SQLite3", database = "prosody.sqlite" };
-	assert(params.driver and params.database, "invalid params");
+	params = params or { driver = "SQLite3" };
+	
+	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, "Both the SQL driver and the database need to be specified");
 	
 	prosody.unlock_globals();
 	local dbh, err = DBI.Connect(