Diff

plugins/storage/mod_storage.lua @ 3277:da0f55661e2b

mod_storage: Make DBI a soft dependency, not a hard one.
author Waqas Hussain <waqas20@gmail.com>
date Fri, 18 Jun 2010 14:22:17 +0500
parent 2678:c5882e2e12b5
line wrap: on
line diff
--- a/plugins/storage/mod_storage.lua	Fri Jun 18 14:20:00 2010 +0500
+++ b/plugins/storage/mod_storage.lua	Fri Jun 18 14:22:17 2010 +0500
@@ -5,7 +5,7 @@
 function cache:get(key) return self.data[key]; end
 function cache:set(key, val) self.data[key] = val; return val; end
 
-local DBI = require "DBI";
+local _,DBI = pcall(require, "DBI");
 function get_database(driver, db, ...)
 	local uri = "dbi:"..driver..":"..db;
 	return cache:get(uri) or cache:set(uri, (function(...)