Skip to content

Commit f4efdb3

Browse files
GHMattiGHMatti
authored andcommitted
fix: store
1 parent b7f2e64 commit f4efdb3

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

lib/MySQL.lua

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ local function safeParameters(params)
99
end
1010

1111
assert(type(params) == "table", "A table is expected")
12-
assert(params[1] == nil, "Parameters should not be an array, but a map (key / value pair) instead")
1312

1413
if next(params) == nil then
1514
return {[''] = ''}
@@ -27,7 +26,7 @@ end
2726
-- @return int Number of rows updated
2827
--
2928
function MySQL.Sync.execute(query, params)
30-
assert(type(query) == "string", "The SQL Query must be a string")
29+
assert(type(query) == "string" or type(query) == "number", "The SQL Query must be a string")
3130

3231
local res = 0
3332
local finishedQuery = false
@@ -47,7 +46,7 @@ end
4746
-- @return table Query results
4847
--
4948
function MySQL.Sync.fetchAll(query, params)
50-
assert(type(query) == "string", "The SQL Query must be a string")
49+
assert(type(query) == "string" or type(query) == "number", "The SQL Query must be a string")
5150

5251
local res = {}
5352
local finishedQuery = false
@@ -69,7 +68,7 @@ end
6968
-- @return mixed Value of the first column in the first row
7069
--
7170
function MySQL.Sync.fetchScalar(query, params)
72-
assert(type(query) == "string", "The SQL Query must be a string")
71+
assert(type(query) == "string" or type(query) == "number", "The SQL Query must be a string")
7372

7473
local res = ''
7574
local finishedQuery = false
@@ -90,7 +89,7 @@ end
9089
-- @return mixed Value of the last insert id
9190
--
9291
function MySQL.Sync.insert(query, params)
93-
assert(type(query) == "string", "The SQL Query must be a string")
92+
assert(type(query) == "string" or type(query) == "number", "The SQL Query must be a string")
9493

9594
local res = 0
9695
local finishedQuery = false
@@ -147,7 +146,7 @@ end
147146
-- @param func(int)
148147
--
149148
function MySQL.Async.execute(query, params, func)
150-
assert(type(query) == "string", "The SQL Query must be a string")
149+
assert(type(query) == "string" or type(query) == "number", "The SQL Query must be a string")
151150

152151
exports['mysql-async']:mysql_execute(query, safeParameters(params), func)
153152
end
@@ -160,7 +159,7 @@ end
160159
-- @param func(table)
161160
--
162161
function MySQL.Async.fetchAll(query, params, func)
163-
assert(type(query) == "string", "The SQL Query must be a string")
162+
assert(type(query) == "string" or type(query) == "number", "The SQL Query must be a string")
164163

165164
exports['mysql-async']:mysql_fetch_all(query, safeParameters(params), func)
166165
end
@@ -174,7 +173,7 @@ end
174173
-- @param func(mixed)
175174
--
176175
function MySQL.Async.fetchScalar(query, params, func)
177-
assert(type(query) == "string", "The SQL Query must be a string")
176+
assert(type(query) == "string" or type(query) == "number", "The SQL Query must be a string")
178177

179178
exports['mysql-async']:mysql_fetch_scalar(query, safeParameters(params), func)
180179
end
@@ -187,7 +186,7 @@ end
187186
-- @param func(string)
188187
--
189188
function MySQL.Async.insert(query, params, func)
190-
assert(type(query) == "string", "The SQL Query must be a string")
189+
assert(type(query) == "string" or type(query) == "number", "The SQL Query must be a string")
191190

192191
exports['mysql-async']:mysql_insert(query, safeParameters(params), func)
193192
end

0 commit comments

Comments
 (0)