File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -700,9 +700,16 @@ It also supports adding qualified identifiers. It will escape both parts.
700
700
``` js
701
701
var sorter = ' date' ;
702
702
var sql = ' SELECT * FROM posts ORDER BY ' + connection .escapeId (' posts.' + sorter);
703
- connection .query (sql, function (err , results ) {
704
- // ...
705
- });
703
+ // -> SELECT * FROM posts ORDER BY `posts`.`date`
704
+ ```
705
+
706
+ If you do not want to treat ` . ` as qualified identifiers, you can set the second
707
+ argument to ` true ` in order to keep the string as a literal identifier:
708
+
709
+ ``` js
710
+ var sorter = ' date.2' ;
711
+ var sql = ' SELECT * FROM posts ORDER BY ' + connection .escapeId (sorter, true );
712
+ // -> SELECT * FROM posts ORDER BY `date.2`
706
713
```
707
714
708
715
Alternatively, you can use ` ?? ` characters as placeholders for identifiers you would
You can’t perform that action at this time.
0 commit comments