mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
🐛 Fix issue escaping single quotes and mapping empty fields (#1929)
Fixes #1915 and #1916
This commit is contained in:
@@ -95,7 +95,16 @@ export function executeQueryQueue(
|
||||
*/
|
||||
export function extractValues(item: IDataObject): string {
|
||||
return `(${Object.values(item as any) // tslint:disable-line:no-any
|
||||
.map(val => (typeof val === 'string' ? `'${val}'` : val)) // maybe other types such as dates have to be handled as well
|
||||
.map(val => {
|
||||
//the column cannot be found in the input
|
||||
//so, set it to null in the sql query
|
||||
if (val === null) {
|
||||
return 'NULL';
|
||||
} else if (typeof val === 'string') {
|
||||
return `'${val.replace(/'/g, '\'\'')}'`;
|
||||
}
|
||||
return val;
|
||||
}) // maybe other types such as dates have to be handled as well
|
||||
.join(',')})`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user