mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-01 22:21:51 +00:00
fix(execute): handle nil values in nested arrays
Lua tables are msgpacked with the "without_hole" setting. Nested tables being sent with "prepare" failed to account for nil values in tables unpacking into objects.
This commit is contained in:
1 parent
b5190f98e9
commit
25f8feb793
2 files changed
+25
-7
No files matched your search
@@ -14,11 +14,10 @@ export const rawExecute = async (
|
||||
throwError?: boolean
|
||||
) => {
|
||||
const type = executeType(query);
|
||||
parameters = parseExecute(parameters);
|
||||
const placeholders = query.split('?').length - 1;
|
||||
parameters = parseExecute(placeholders, parameters);
|
||||
let response = [] as any;
|
||||
|
||||
if (!parameters.every(Array.isArray)) parameters = [[...parameters]];
|
||||
|
||||
await scheduleTick();
|
||||
|
||||
return await new Promise((resolve, reject) => {
|
||||
@@ -26,11 +25,8 @@ export const rawExecute = async (
|
||||
if (err) return reject(err.message);
|
||||
if (parameters.length === 0) return reject(`Query received no parameters.`);
|
||||
|
||||
const placeholders = query.split('?').length - 1;
|
||||
|
||||
parameters.forEach((values, index) => {
|
||||
const executionTime = process.hrtime();
|
||||
values = parseValues(placeholders, values);
|
||||
|
||||
connection.execute(query, values, (err, results: RowDataPacket[][]) => {
|
||||
if (err) {
|
||||
|
||||
Reference in new issue
Block a user