This commit is contained in:
Tben 2023-08-12 17:18:34 +01:00
parent cc65ea23b8
commit 32785f9caa
2 changed files with 9 additions and 3 deletions

View File

@ -72,10 +72,13 @@ module.exports = async function dbHandler({ query, values, database }) {
*/ */
try { try {
results = await new Promise((resolve, reject) => { results = await new Promise((resolve, reject) => {
if (values) { if (values?.[0]) {
connection.query(query, values, (error, results, fields) => { connection.query(query, values, (error, results, fields) => {
if (error) { if (error) {
console.log("DB handler error:", error.message); console.log("DB handler error with values array:", error.message);
console.log("SQL:", error.sql);
console.log("State:", error.sqlState, error.sqlMessage);
resolve({ resolve({
error: error.message, error: error.message,
}); });
@ -91,6 +94,9 @@ module.exports = async function dbHandler({ query, values, database }) {
connection.query(query, (error, results, fields) => { connection.query(query, (error, results, fields) => {
if (error) { if (error) {
console.log("DB handler error:", error.message); console.log("DB handler error:", error.message);
console.log("SQL:", error.sql);
console.log("State:", error.sqlState, error.sqlMessage);
resolve({ resolve({
error: error.message, error: error.message,
}); });

View File

@ -1,6 +1,6 @@
{ {
"name": "datasquirel", "name": "datasquirel",
"version": "1.5.9", "version": "1.6.0",
"description": "Cloud-based SQL data management tool", "description": "Cloud-based SQL data management tool",
"main": "index.js", "main": "index.js",
"bin": { "bin": {