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
190190 // https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_strict_trans_tables
191191 const STRICT_TRANS_TABLES = 1048576 ;
192192
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+
193200 /*
194201 * Combination SQL Modes
195202 * 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 = '`')
520527 return $ str ;
521528 }
522529
530+ if ((static ::$ MODE & Context::NO_ENCLOSING_QUOTES )
531+ && (!static ::isKeyword ($ str , true ))
532+ ) {
533+ return $ str ;
534+ }
535+
523536 if (static ::$ MODE & Context::ANSI_QUOTES ) {
524537 $ quote = '" ' ;
525538 }
539+
526540 return $ quote . str_replace ($ quote , $ quote . $ quote , $ str ) . $ quote ;
527541 }
528542}
You can’t perform that action at this time.
0 commit comments