Skip to content
This repository was archived by the owner on Apr 29, 2025. It is now read-only.

Commit 2d28c44

Browse files
committed
fix(db/rawExecute): Parse multiple returned rows
1 parent e29ca87 commit 2d28c44

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

fxmanifest.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ game 'common'
33

44
name 'oxmysql'
55
description 'Database wrapper for FiveM utilising node-mysql2 offering improved performance and security.'
6-
version '2.0.1'
6+
version '2.0.2'
77
url 'https://github.com/overextended/oxmysql'
88
author 'overextended'
99

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "oxmysql",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"description": "FXServer to MySQL communication via node-mysql2",
55
"repository": "git@github.com:overextended/oxmysql.git",
66
"author": "dunak-debug <19434539+dunak-debug@users.noreply.github.com>",

src/database/rawExecute.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@ export const rawExecute = async (
3131
const executionTime = process.hrtime();
3232

3333
for (const params of parameters) {
34-
results.push(parseResponse(type, (await connection.execute(query, params))[0]));
34+
const [rows] = (await connection.execute(query, params)) as RowDataPacket[][];
35+
if (rows.length > 1) {
36+
for (const row of rows) {
37+
results.push(parseResponse(type, row));
38+
}
39+
} else results.push(parseResponse(type, rows));
40+
3541
logQuery(invokingResource, query, process.hrtime(executionTime)[1] / 1e6, params as typeof parameters);
3642
}
3743

0 commit comments

Comments
 (0)