MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / quoteIdentifier

Function quoteIdentifier

packages/core/src/platforms/Platform.ts:732–741  ·  view source on GitHub ↗

Wraps a table or column identifier with the platform-specific quote character.

(id: string | { toString: () => string }, quote = '`')

Source from the content-addressed store, hash-verified

730
731 /** Wraps a table or column identifier with the platform-specific quote character. */
732 quoteIdentifier(id: string | { toString: () => string }, quote = '`'): string {
733 const raw = Raw.getKnownFragment(id);
734
735 if (raw) {
736 return this.formatQuery(raw.sql, raw.params);
737 }
738
739 const escaped = id.toString().replaceAll(quote, quote + quote);
740 return `${quote}${escaped.replace('.', `${quote}.${quote}`)}${quote}`;
741 }
742
743 /** Quotes a literal value for safe embedding in SQL. */
744 quoteValue(value: any): string {

Callers 1

resolvePartitionKeyFunction · 0.85

Calls 3

getKnownFragmentMethod · 0.80
formatQueryMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected