(value: string)
| 10 | * Handles: single quotes, backslashes, NUL bytes, and control characters. |
| 11 | */ |
| 12 | export function sqlStr(value: string): string { |
| 13 | return value |
| 14 | .replace(/\\/g, "\\\\") |
| 15 | .replace(/'/g, "''") |
| 16 | .replace(/\0/g, "") |
| 17 | .replace(/[\x01-\x08\x0b\x0c\x0e-\x1f\x7f]/g, ""); |
| 18 | } |
| 19 | |
| 20 | /** |
| 21 | * Escape a string for use inside a SQL LIKE/ILIKE pattern. |
no outgoing calls
no test coverage detected