MCPcopy Create free account
hub / github.com/bytebase/bytebase / escapeSQLStringLiteral

Function escapeSQLStringLiteral

frontend/src/utils/v1/sql.ts:252–260  ·  view source on GitHub ↗
(value: string, engine: Engine)

Source from the content-addressed store, hash-verified

250 MYSQL_FAMILY_ENGINES.has(engine);
251
252const escapeSQLStringLiteral = (value: string, engine: Engine): string => {
253 let escaped = value;
254 // Escape backslashes first so the quote-doubling below isn't affected.
255 if (isMySQLFamilyEngine(engine)) {
256 escaped = escaped.replaceAll("\\", "\\\\");
257 }
258 escaped = escaped.replaceAll("'", "''");
259 return `'${escaped}'`;
260};
261
262const bytesToHex = (bytes: Uint8Array): string =>
263 Array.from(bytes)

Callers 1

rowValueToSQLLiteralFunction · 0.85

Calls 1

isMySQLFamilyEngineFunction · 0.85

Tested by

no test coverage detected