auth fix 4

This commit is contained in:
Kallesh B S 2025-09-27 17:44:51 +05:30
parent df5fc86821
commit 59c51fb817

View File

@ -208,7 +208,7 @@ export class CarnetApplicationService {
function escapePostgresString(str: string): string {
if (str == null) return '';
return `"${str.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
return `"${str.replace(/\\/g, '\\\\').replace(/"/g, '""')}"`;
}
function escapePostgresValue(val: any): string {
@ -219,16 +219,16 @@ export class CarnetApplicationService {
const contactLiterals = body.P_GLTABLE.map(c => {
const fields = [
escapePostgresValue(c.ITEMNO), // integer
escapePostgresValue(c.ITEMDESCRIPTION), // varchar
escapePostgresValue(c.ITEMVALUE), // numeric
escapePostgresValue(c.NOOFPIECES), // integer
escapePostgresValue(c.ITEMWEIGHT), // numeric
escapePostgresValue(c.ITEMWEIGHTUOM), // varchar
escapePostgresValue(c.GOODSORIGINCOUNTRY), // varchar
escapePostgresValue(c.ITEMNO),
escapePostgresValue(c.ITEMDESCRIPTION),
escapePostgresValue(c.ITEMVALUE),
escapePostgresValue(c.NOOFPIECES),
escapePostgresValue(c.ITEMWEIGHT),
escapePostgresValue(c.ITEMWEIGHTUOM),
escapePostgresValue(c.GOODSORIGINCOUNTRY),
];
return `(${fields.join(',')})`; // composite literal without outer double quotes
return `"(${fields.join(',')})"`; // ✅ double quotes for composite
});
const pgArrayLiteral = `{${contactLiterals.join(',')}}`;