From aa85d58daa9ba62131fb826d19c14a7cb7661e6b Mon Sep 17 00:00:00 2001 From: Tben Date: Fri, 7 Jul 2023 16:55:56 +0100 Subject: [PATCH] updates --- engine/db/add.js | 16 +++------------- package.json | 2 +- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/engine/db/add.js b/engine/db/add.js index a480908..f9d527f 100644 --- a/engine/db/add.js +++ b/engine/db/add.js @@ -42,7 +42,10 @@ module.exports = async function add({ dbFullName, tableName, data, tableSchema, /** * Handle function logic */ + if (duplicateColumnName && typeof duplicateColumnName === "string") { + console.log("duplicateColumnName", duplicateColumnName); + const duplicateValue = await handler({ queryString: `SELECT * FROM \`${tableName}\` WHERE \`${duplicateColumnName}\`=?`, queryValuesArray: [duplicateColumnValue], @@ -69,19 +72,6 @@ module.exports = async function add({ dbFullName, tableName, data, tableSchema, encryptionSalt, }); } - } else if (duplicateColumnName && typeof duplicateColumnName === "object" && duplicateColumnValue && typeof duplicateColumnValue === "object") { - const duplicateArray = duplicateColumnName.map((dupColName, index) => { - return `\`${dupColName}\`='${duplicateColumnValue[index]}'`; - }); - - const duplicateValue = await handler({ - queryString: `SELECT * FROM ${tableName} WHERE ${duplicateArray.join(" AND ")}`, - database: dbFullName, - }); - - if (duplicateValue && duplicateValue[0] && !update) { - return null; - } } /** diff --git a/package.json b/package.json index d153141..d8877ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "datasquirel", - "version": "1.1.68", + "version": "1.1.69", "description": "Cloud-based SQL data management tool", "main": "index.js", "scripts": {