DBI.lua

changeset 36
942bfe1843bc
parent 22
fd78e9cdc6e9
--- a/DBI.lua	Fri Sep 18 12:54:32 2009 +0000
+++ b/DBI.lua	Fri May 21 23:00:13 2010 +0000
@@ -28,10 +28,10 @@
 
     -- no drivers available
     if table.maxn(available) < 1 then
-	return '(None)'
+	available = {'(None)'}
     end
 
-    return table.concat(available, ',')
+    return available
 end
 
  -- High level DB connection function
@@ -40,14 +40,16 @@
     local modulefile = name_to_module[driver]
 
     if not modulefile then
-	error(string.format("Driver '%s' not found. Available drivers are: %s", driver, available_drivers()))
+        local available = table.concat(available_drivers(), ',')
+	error(string.format("Driver '%s' not found. Available drivers are: %s", driver, available))
     end
 
     local m, err = pcall(require, modulefile)
 
     if not m then
 	-- cannot load the module, we cannot continue
-	error(string.format('Cannot load driver %s. Available drivers are: %s', driver, available_drivers()))
+        local available = table.concat(available_drivers(), ',')
+	error(string.format('Cannot load driver %s. Available drivers are: %s', driver, available))
     end
 
     local class_str = string.format('DBD.%s.Connection', driver)
@@ -75,3 +77,8 @@
 
     return sth:affected()
 end
+
+-- Lit drivers available on this system
+function Drivers()
+    return available_drivers() 
+end

mercurial