From 4f6da4e8d1e294a95d1b71061f513b6dec66f122 Mon Sep 17 00:00:00 2001 From: GHMatti <33543464+GHMatti@users.noreply.github.com> Date: Sat, 23 May 2020 12:27:03 +0200 Subject: [PATCH] chore: update to 3.2.3 --- fxmanifest.lua | 2 +- mysql-async.js | 9 +++++++++ src/package.json | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/fxmanifest.lua b/fxmanifest.lua index 92f3c68..6cb1f03 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -4,7 +4,7 @@ game 'common' name 'mysql-async' description 'MySQL Middleware for lua.' author 'Joel Wurtz & Matthias Mandelartz' -version '3.2.2' +version '3.2.3' url 'https://github.com/brouznouf/fivem-mysql-async' server_script 'mysql-async.js' diff --git a/mysql-async.js b/mysql-async.js index 2b1ec85..2f13bec 100644 --- a/mysql-async.js +++ b/mysql-async.js @@ -5198,6 +5198,10 @@ global.on('onResourceStart', (resourcename) => { } }); +global.RegisterCommand('mysql:debug', () => { + profiler.config.trace = !profiler.config.trace; +}, true); + global.onNet('mysql-async:request-data', () => { if (isReady) { const src = global.source; @@ -5274,6 +5278,8 @@ class MySQL { }); }).catch((error) => { this.logger.error(`[ERROR] [MySQL] [${invokingResource}] An error happens on MySQL for query "${sql.sql}": ${error.message}`); + // We should not catch this error when doing a transaction, throw new error instead. + if (connection) throw new Error('This error might result from a transaction and be deliberate.'); }); return queryPromise; @@ -5309,6 +5315,9 @@ class MySQL { // Otherwise catch the error from the execution }).catch((executeError) => { this.onTransactionError(executeError, connection, callback); + }).then(() => { + // terminate connection + connection.release(); }); } } diff --git a/src/package.json b/src/package.json index 4c1cfbb..0208d7a 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "name": "mysql-async", - "version": "3.2.2", + "version": "3.2.3", "description": "fivem-mysql-async", "private": true, "scripts": {