MCPcopy Create free account
hub / github.com/outerbase/studio / escapeSqlValue

Function escapeSqlValue

src/drivers/sqlite/sql-helper.ts:24–35  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

22}
23
24export function escapeSqlValue(value: unknown) {
25 if (value === undefined) return "DEFAULT";
26 if (value === null) return "NULL";
27 if (typeof value === "string") return escapeSqlString(value);
28 if (typeof value === "number") return value.toString();
29 if (typeof value === "bigint") return value.toString();
30 if (value instanceof ArrayBuffer) return escapeSqlBinary(value);
31 if (Array.isArray(value))
32 return escapeSqlBinary(Uint8Array.from(value).buffer);
33 // eslint-disable-next-line @typescript-eslint/no-base-to-string
34 throw new Error(value.toString() + " is unrecongize type of value");
35}
36
37export function extractInputValue(input: string): string | number {
38 const trimmedInput = input.trim();

Callers 14

onRunClickedFunction · 0.90
findFirstFunction · 0.90
selectTableFunction · 0.90
escapeValueMethod · 0.90
legacyTableSchemaMethod · 0.90
triggerMethod · 0.90
tableSchemaMethod · 0.90
findFirstMethod · 0.90
selectTableMethod · 0.90
escapeValueMethod · 0.90
escapeValueMethod · 0.90
tableSchemaMethod · 0.90

Calls 3

escapeSqlStringFunction · 0.85
escapeSqlBinaryFunction · 0.85
toStringMethod · 0.45

Tested by

no test coverage detected