From 8ab318ef12772fc2e9d407dd326a5297d17e5f35 Mon Sep 17 00:00:00 2001 From: Holly Date: Wed, 4 Oct 2023 15:12:35 +0100 Subject: [PATCH] Correct some mistakes in the DB class --- server/objects/Database.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/server/objects/Database.ts b/server/objects/Database.ts index 4cb77aa..5fe5b2b 100644 --- a/server/objects/Database.ts +++ b/server/objects/Database.ts @@ -29,7 +29,7 @@ export default class Database { } if (data == null) { - connection.execute(query, data, (err, result) => { + connection.execute(query, (err, result) => { if (err) { connection.release(); return reject(err); @@ -38,7 +38,14 @@ export default class Database { resolve(result !== undefined); }); } else { - + connection.execute(query, data, (err, result) => { + if (err) { + connection.release(); + return reject(err); + } + + resolve(result !== undefined); + }); } }); });