Skip to content

Commit 5101599

Browse files
Fix SQL query in TargetUnit service to handle single quotes correctly
- Updated the mapping function in `queries.ts` to escape single quotes in group names, ensuring proper SQL syntax and preventing potential query errors. - This change enhances the robustness of the SQL query generation process within the TargetUnit service, contributing to better data integrity and reliability.
1 parent c7181f0 commit 5101599

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

workers/main/src/services/TargetUnit/queries.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
} from '../../configs/weeklyFinancialReport';
66

77
const groupNamesList = Object.values(GroupNameEnum)
8-
.map((name) => `'${name}'`)
8+
.map((name) => `'${name.replace(/'/g, "''")}'`)
99
.join(', ');
1010

1111
const COMMON_SELECT = `

0 commit comments

Comments
 (0)