updates
This commit is contained in:
parent
c23a4d65bd
commit
f51096bec4
@ -87,7 +87,7 @@ async function addDb({ dbFullName, tableName, data, tableSchema, duplicateColumn
|
|||||||
const dataKey = dataKeys[i];
|
const dataKey = dataKeys[i];
|
||||||
let value = data[dataKey];
|
let value = data[dataKey];
|
||||||
|
|
||||||
const targetFieldSchemaArray = tableSchema ? tableSchema?.fields.filter((field) => field.fieldName === dataKey) : null;
|
const targetFieldSchemaArray = tableSchema ? tableSchema?.fields?.filter((field) => field.fieldName === dataKey) : null;
|
||||||
const targetFieldSchema = targetFieldSchemaArray && targetFieldSchemaArray[0] ? targetFieldSchemaArray[0] : null;
|
const targetFieldSchema = targetFieldSchemaArray && targetFieldSchemaArray[0] ? targetFieldSchemaArray[0] : null;
|
||||||
|
|
||||||
if (!value) continue;
|
if (!value) continue;
|
||||||
@ -109,6 +109,7 @@ async function addDb({ dbFullName, tableName, data, tableSchema, duplicateColumn
|
|||||||
insertValuesArray.push(value);
|
insertValuesArray.push(value);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("DSQL: Error in parsing data keys =>", error.message);
|
console.log("DSQL: Error in parsing data keys =>", error.message);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,6 +146,8 @@ async function addDb({ dbFullName, tableName, data, tableSchema, duplicateColumn
|
|||||||
tableSchema,
|
tableSchema,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log(newInsert);
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
|
@ -22,6 +22,13 @@ module.exports = async function parseDbResults({ unparsedResults, tableSchema, e
|
|||||||
*/
|
*/
|
||||||
let parsedResults = [];
|
let parsedResults = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if query values array is an array
|
||||||
|
*/
|
||||||
|
if (!unparsedResults || !Array.isArray(unparsedResults) || !unparsedResults[0]) {
|
||||||
|
return unparsedResults;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
/**
|
/**
|
||||||
* Declare variables
|
* Declare variables
|
||||||
@ -34,8 +41,9 @@ module.exports = async function parseDbResults({ unparsedResults, tableSchema, e
|
|||||||
let resultFieldNames = Object.keys(result);
|
let resultFieldNames = Object.keys(result);
|
||||||
|
|
||||||
for (let i = 0; i < resultFieldNames.length; i++) {
|
for (let i = 0; i < resultFieldNames.length; i++) {
|
||||||
|
try {
|
||||||
const resultFieldName = resultFieldNames[i];
|
const resultFieldName = resultFieldNames[i];
|
||||||
let resultFieldSchema = tableSchema.fields[i];
|
let resultFieldSchema = tableSchema?.fields[i];
|
||||||
|
|
||||||
if (resultFieldName?.match(defaultFieldsRegexp)) {
|
if (resultFieldName?.match(defaultFieldsRegexp)) {
|
||||||
continue;
|
continue;
|
||||||
@ -52,6 +60,10 @@ module.exports = async function parseDbResults({ unparsedResults, tableSchema, e
|
|||||||
result[resultFieldName] = decrypt({ encryptedString: value, encryptionKey, encryptionSalt });
|
result[resultFieldName] = decrypt({ encryptedString: value, encryptionKey, encryptionSalt });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("ERROR in parseDbResults Function =>", error.message);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
parsedResults.push(result);
|
parsedResults.push(result);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "datasquirel",
|
"name": "datasquirel",
|
||||||
"version": "1.1.77",
|
"version": "1.1.78",
|
||||||
"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