Permalink
Browse files

cleaned up the code to reduce duplication.

  • Loading branch information...
agentzh committed Jul 31, 2012
1 parent 25ea9ae commit 1cc71043ea22b9821352c7851b99c13fea1822ae
Showing with 4 additions and 3 deletions.
  1. +3 −2 lib/resty/mysql.lua
  2. +1 −1 t/sanity.t
View
@@ -16,10 +16,11 @@ local COM_QUERY = 0x03
local SERVER_MORE_RESULTS_EXISTS = 8
+local class = resty.mysql
-- global variables
-local mt = { __index = resty.mysql }
+local mt = { __index = class }
local sub = string.sub
local tcp = ngx.socket.tcp
@@ -827,7 +828,7 @@ end
-- to prevent use of casual module global variables
-getmetatable(resty.mysql).__newindex = function (table, key, val)
+getmetatable(class).__newindex = function (table, key, val)
error('attempt to write to undeclared variable "' .. key .. '": '
.. debug.traceback())
end
View
@@ -94,7 +94,7 @@ GET /t
^failed to connect: failed to connect: host-not-found.org could not be resolved(?: \(3: Host not found\))?: nil nil$
--- no_error_log
[error]
---- timeout: 5
+--- timeout: 7

0 comments on commit 1cc7104

Please sign in to comment.