Skip to content

Commit

Permalink
fix(lib): ensure safeArgs when using __call method
Browse files Browse the repository at this point in the history
This asserts types and checks stored queries when sending a number.
  • Loading branch information
thelindat committed Dec 23, 2021
1 parent fc06cab commit e86bf26
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/MySQL.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ setmetatable(MySQL, {
local state = GetResourceState('oxmysql')
if state == 'started' or state == 'starting' then
self[method] = setmetatable({}, {
__call = oxmysql[method],
__call = function(_, query, parameters, cb)
return oxmysql[method](nil, safeArgs(query, parameters, cb))
end,
__index = function(_, await)
assert(await == 'await', ('unable to index MySQL.%s.%s, expected .await'):format(method, await))
self[method].await = function(query, parameters)
Expand Down

0 comments on commit e86bf26

Please sign in to comment.