Merge branch 'QA_4_5' into QA_4_6

This commit is contained in:
Dan Ungureanu 2016-02-12 09:39:01 +02:00
commit c6b3292fe5
3 changed files with 21 additions and 0 deletions

View File

@ -61,6 +61,7 @@ phpMyAdmin - ChangeLog
- issue #11799 Backslashes in comments are being interpreted as escape characters
- issue #11909 Can't insert row into table that contains generated column
- issue #11677 sql-parser and php-gettext collide.
- issue #11920 Can't disable backquotes in export
4.5.4.1 (2016-01-29)
- issue #11892 Error with PMA 4.4.15.3

View File

@ -1548,6 +1548,12 @@ class ExportSql extends ExportPlugin
// analysis.
if (!$view) {
if (empty($sql_backquotes)) {
// Option "Enclose table and column names with backquotes"
// was checked.
Context::$MODE |= Context::NO_ENCLOSING_QUOTES;
}
// Using appropriate quotes.
if (($compat === 'MSSQL') || ($sql_backquotes === '"')) {
Context::$MODE |= Context::ANSI_QUOTES;

View File

@ -190,6 +190,13 @@ abstract class Context
// https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_strict_trans_tables
const STRICT_TRANS_TABLES = 1048576;
// Custom modes.
// The table and column names and any other field that must be escaped will
// not be.
// Reserved keywords are being escaped regardless this mode is used or not.
const NO_ENCLOSING_QUOTES = 1073741824;
/*
* Combination SQL Modes
* https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sql-mode-combo
@ -520,9 +527,16 @@ abstract class Context
return $str;
}
if ((static::$MODE & Context::NO_ENCLOSING_QUOTES)
&& (!static::isKeyword($str, true))
) {
return $str;
}
if (static::$MODE & Context::ANSI_QUOTES) {
$quote = '"';
}
return $quote . str_replace($quote, $quote . $quote, $str) . $quote;
}
}