quoteSqlIdentifier()
function quoteSqlIdentifier(identifier): string;
Defined in: packages/rxdb/src/system/sql-literal.ts:43
把标识符(表名、列名)包成双引号形式。
Parameters
| Parameter | Type | Description |
|---|---|---|
identifier | string | 标识符原文,通常取自实体元数据的 tableName / columnName |
Returns
string
双引号包裹、内部双引号已按 SQL 标准加倍的标识符
Remarks
双引号是 SQL 标准的定界标识符语法,PostgreSQL 与 SQLite 家族都认。加引号不只是防注入:
不加引号时两边都会折叠大小写(PostgreSQL 折成小写),而本仓的列名是 enabledAt 这类
驼峰——不加引号的 CAS 会在 PGlite 上找不到列。
Throws
RxDBError 标识符为空或含 NUL 时