fix(lib): ensure safeArgs when using __call method

This asserts types and checks stored queries when sending a number.
This commit is contained in:
Linden committed 2021-12-24 03:59:39 +11:00
1 parent fc06cab6eb
commit e86bf26221
1 file changed
+3 -1
+3 -1
View File
@@ -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)