From 9142f3b3e0c435d572698713f603ec58e6b9bc8c Mon Sep 17 00:00:00 2001 From: Benjamin Toby Date: Fri, 8 Nov 2024 20:53:56 +0100 Subject: [PATCH] SQL Query Generator Bugfix --- functions/sql/sql-generator.js | 7 ++++++- package.json | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/functions/sql/sql-generator.js b/functions/sql/sql-generator.js index 7dc0fa3..c21a928 100644 --- a/functions/sql/sql-generator.js +++ b/functions/sql/sql-generator.js @@ -148,7 +148,12 @@ function sqlGenerator({ tableName, genObject }) { if (sqlSearhString) { const stringOperator = genObject?.searchOperator || "AND"; - queryString += ` WHERE ${sqlSearhString.join(` ${stringOperator} `)} `; + queryString += ` WHERE ${sqlSearhString + .map((str) => { + if (genObject.join) return `${tableName}.${str}`; + return str; + }) + .join(` ${stringOperator} `)} `; } if (genObject.order) diff --git a/package.json b/package.json index d50a273..4f9cbf6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "datasquirel", - "version": "2.5.1", + "version": "2.5.2", "description": "Cloud-based SQL data management tool", "main": "index.js", "bin": {