aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_storage_sql.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2011-03-01 06:14:03 +0000
committerMatthew Wild <mwild1@gmail.com>2011-03-01 06:14:03 +0000
commit2c29bb6f6ac3db2cf94aca7cd827a586db2ad497 (patch)
tree5efe93da0996685cbafa67d38a9bedad79b7f7d4 /plugins/mod_storage_sql.lua
parent65f5ac4f58a596f9a6813572171625095b685cee (diff)
parent9cf13e5dcd6844be8be5260caa855743c4d94227 (diff)
downloadprosody-2c29bb6f6ac3db2cf94aca7cd827a586db2ad497.tar.gz
prosody-2c29bb6f6ac3db2cf94aca7cd827a586db2ad497.zip
Merge 0.8->trunk
Diffstat (limited to 'plugins/mod_storage_sql.lua')
-rw-r--r--plugins/mod_storage_sql.lua13
1 files changed, 12 insertions, 1 deletions
diff --git a/plugins/mod_storage_sql.lua b/plugins/mod_storage_sql.lua
index 7917958d..b88efb64 100644
--- a/plugins/mod_storage_sql.lua
+++ b/plugins/mod_storage_sql.lua
@@ -96,7 +96,18 @@ local function create_table()
end
do -- process options to get a db connection
- DBI = require "DBI";
+ local ok;
+ prosody.unlock_globals();
+ ok, DBI = pcall(require, "DBI");
+ if not ok then
+ package.loaded["DBI"] = {};
+ module:log("error", "Failed to load the LuaDBI library for accessing SQL databases: %s", DBI);
+ module:log("error", "More information on installing LuaDBI can be found at http://prosody.im/doc/depends#luadbi");
+ end
+ prosody.lock_globals();
+ if not ok or not DBI.Connect then
+ return; -- Halt loading of this module
+ end
params = params or { driver = "SQLite3" };