File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -190,6 +190,13 @@ abstract class Context
190
190
// https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_strict_trans_tables
191
191
const STRICT_TRANS_TABLES = 1048576 ;
192
192
193
+ // Custom modes.
194
+
195
+ // The table and column names and any other field that must be escaped will
196
+ // not be.
197
+ // Reserved keywords are being escaped regardless this mode is used or not.
198
+ const NO_ENCLOSING_QUOTES = 1073741824 ;
199
+
193
200
/*
194
201
* Combination SQL Modes
195
202
* https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sql-mode-combo
@@ -520,9 +527,16 @@ public static function escape($str, $quote = '`')
520
527
return $ str ;
521
528
}
522
529
530
+ if ((static ::$ MODE & Context::NO_ENCLOSING_QUOTES )
531
+ && (!static ::isKeyword ($ str , true ))
532
+ ) {
533
+ return $ str ;
534
+ }
535
+
523
536
if (static ::$ MODE & Context::ANSI_QUOTES ) {
524
537
$ quote = '" ' ;
525
538
}
539
+
526
540
return $ quote . str_replace ($ quote , $ quote . $ quote , $ str ) . $ quote ;
527
541
}
528
542
}
You can’t perform that action at this time.
0 commit comments