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
|
* Handle function logic
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (duplicateColumnName && typeof duplicateColumnName === "string") {
|
if (duplicateColumnName && typeof duplicateColumnName === "string") {
|
||||||
|
console.log("duplicateColumnName", duplicateColumnName);
|
||||||
|
|
||||||
const duplicateValue = await handler({
|
const duplicateValue = await handler({
|
||||||
queryString: `SELECT * FROM \`${tableName}\` WHERE \`${duplicateColumnName}\`=?`,
|
queryString: `SELECT * FROM \`${tableName}\` WHERE \`${duplicateColumnName}\`=?`,
|
||||||
queryValuesArray: [duplicateColumnValue],
|
queryValuesArray: [duplicateColumnValue],
|
||||||
@ -69,19 +72,6 @@ module.exports = async function add({ dbFullName, tableName, data, tableSchema,
|
|||||||
encryptionSalt,
|
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",
|
"name": "datasquirel",
|
||||||
"version": "1.1.68",
|
"version": "1.1.69",
|
||||||
"description": "Cloud-based SQL data management tool",
|
"description": "Cloud-based SQL data management tool",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Loading…
Reference in New Issue
Block a user