mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-03 14:38:50 +00:00
fix(db/rawExecute): Parse multiple returned rows
This commit is contained in:
1 parent
e29ca87c98
commit
2d28c447ec
3 files changed
+9
-3
No files matched your search
+1
-1
@@ -3,7 +3,7 @@ game 'common'
|
|||||||
|
|
||||||
name 'oxmysql'
|
name 'oxmysql'
|
||||||
description 'Database wrapper for FiveM utilising node-mysql2 offering improved performance and security.'
|
description 'Database wrapper for FiveM utilising node-mysql2 offering improved performance and security.'
|
||||||
version '2.0.1'
|
version '2.0.2'
|
||||||
url 'https://github.com/overextended/oxmysql'
|
url 'https://github.com/overextended/oxmysql'
|
||||||
author 'overextended'
|
author 'overextended'
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "oxmysql",
|
"name": "oxmysql",
|
||||||
"version": "2.0.1",
|
"version": "2.0.2",
|
||||||
"description": "FXServer to MySQL communication via node-mysql2",
|
"description": "FXServer to MySQL communication via node-mysql2",
|
||||||
"repository": "[email protected]:overextended/oxmysql.git",
|
"repository": "[email protected]:overextended/oxmysql.git",
|
||||||
"author": "dunak-debug <[email protected]>",
|
"author": "dunak-debug <[email protected]>",
|
||||||
|
|||||||
@@ -31,7 +31,13 @@ export const rawExecute = async (
|
|||||||
const executionTime = process.hrtime();
|
const executionTime = process.hrtime();
|
||||||
|
|
||||||
for (const params of parameters) {
|
for (const params of parameters) {
|
||||||
results.push(parseResponse(type, (await connection.execute(query, params))[0]));
|
const [rows] = (await connection.execute(query, params)) as RowDataPacket[][];
|
||||||
|
if (rows.length > 1) {
|
||||||
|
for (const row of rows) {
|
||||||
|
results.push(parseResponse(type, row));
|
||||||
|
}
|
||||||
|
} else results.push(parseResponse(type, rows));
|
||||||
|
|
||||||
logQuery(invokingResource, query, process.hrtime(executionTime)[1] / 1e6, params as typeof parameters);
|
logQuery(invokingResource, query, process.hrtime(executionTime)[1] / 1e6, params as typeof parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user