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