Wraps a table or column identifier with the platform-specific quote character.
(id: string | { toString: () => string }, quote = '`')
| 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 { |
no test coverage detected