Skip to content

Commit

Permalink
Apply missing part of patch from issue #30. Allow loading dbdodbc, as…
Browse files Browse the repository at this point in the history
… per issue #33.
  • Loading branch information
sparked435 committed Aug 7, 2017
1 parent 01fcfc0 commit 7e11373
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions DBI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ local name_to_module = {
SQLite3 = 'dbdsqlite3',
DB2 = 'dbddb2',
Oracle = 'dbdoracle',
ODBC = 'dbdodbc'
}

local string = require('string')
Expand Down Expand Up @@ -52,16 +53,7 @@ function _M.Connect(driver, ...)
error(string.format('Cannot load driver %s. Available drivers are: %s', driver, available))
end

local class_str = modulefile
if tonumber(string.sub(_VERSION, -3)) < 5.2 then
class_str = string.format('DBD.%s.Connection', driver)
end

-- load class from name in globals table
local connection_class = package.loaded[class_str]

-- Calls DBD.{Driver}.New(...)
return connection_class.New(...)
return package.loaded[modulefile].New(...)
end

-- Help function to do prepare and execute in
Expand Down

0 comments on commit 7e11373

Please sign in to comment.