summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2013-05-12 04:12:17 +0200
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2013-05-12 04:12:17 +0200
commit67697f6125466cc76ae07f2757afc7fef5db5e23 (patch)
treeba55c9caf29d5b5423255674823fad398af55319
parent7d9d62685fa141bacc34e795386ef567aa574ecb (diff)
Properly recycling connections.
-rw-r--r--lib/dblib.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/dblib.lua b/lib/dblib.lua
index 64ce880..3840657 100644
--- a/lib/dblib.lua
+++ b/lib/dblib.lua
@@ -1078,7 +1078,9 @@ luadb = {
-- get into a registry to fetch "id"
-- else
-- end
+ local olddb
if type(id) == "table" and type(id._) == "table" then
+ olddb = id
user = id._.user
password = id._.password
base = id._.base
@@ -1086,6 +1088,7 @@ luadb = {
id = id._.id
end
db = SQLConnection(id, user, password, base)
+ if olddb then olddb._.conn = db end
return {
opentable = _luadb.opentable,
SafeQuery = _luadb.mysql.SafeQuery,
@@ -1119,7 +1122,9 @@ luadb = {
l_env:setExceptions(false)
end
+ local olddb
if type(id) == "table" and type(id._) == "table" then
+ olddb = id
user = id._.user
password = id._.password
base = id._.base
@@ -1130,6 +1135,7 @@ luadb = {
if not conn then
return nil, l_env:getErrorCode(), l_env:getErrorMsg()
end
+ if olddb then olddb._.conn = conn end
return {
opentable = _luadb.opentable,
SafeQuery = _luadb.oracle.SafeQuery,