updates
This commit is contained in:
parent
4e2403272a
commit
aa85d58daa
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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": {
|
||||
|
Loading…
Reference in New Issue
Block a user