summaryrefslogtreecommitdiff
path: root/sql/mysqld.h
diff options
context:
space:
mode:
authorAlexander Barkov <alexander.barkov@oracle.com>2011-03-04 18:43:28 +0300
committerAlexander Barkov <alexander.barkov@oracle.com>2011-03-04 18:43:28 +0300
commitb326b9a3a00767cdab2d842dc7c318a8de8462a5 (patch)
tree6e0419e7447f81399c5eb024d02bc7b806079e5d /sql/mysqld.h
parent7e6d938f575af3bf31bf6477a6c6585e24522103 (diff)
downloadmariadb-git-b326b9a3a00767cdab2d842dc7c318a8de8462a5.tar.gz
Bug#11764503 (Bug#57341) Query in EXPLAIN EXTENDED shows wrong characters
@ mysql-test/r/ctype_latin1.result @ mysql-test/r/ctype_utf8.result @ mysql-test/t/ctype_latin1.test @ mysql-test/t/ctype_utf8.test Adding tests @ sql/mysqld.h @ sql/item.cc @ sql/sql_parse.cc @ sql/sql_view.cc Refactoring (thanks to Guilhem for the idea): Item_string::print() was hard to understand because of the different QT_ constants: in "query_type==QT_x", QT_x is explicitely included but the other two QT_ are implicitely excluded. The combinations with '||' and '&&' make this even harder. - logic is now more "explicit" by changing QT_ constants to a bitmap of flags: QT_ORDINARY: no change, QT_IS -> QT_TO_SYSTEM_CHARSET | QT_WITHOUT_INTRODUCERS, QT_EXPLAIN -> QT_TO_SYSTEM_CHARSET (QT_EXPLAIN was introduced in the first version of the Bug#57341 patch) - Item_string::print() is rewritten using those flags Bugfix itself: When QT_TO_SYSTEM_CHARSET is used alone (with no QT_WITHOUT_INTRODUCERS), we print string literals as follows: - display introducers if they were in the original query - print ASCII characters as is - print non-ASCII characters using hex-escape Note: as "EXPLAIN" output is only for human readability purposes and does not need to be a pasrable SQL, so using hex-escape is Ok. ErrConvString class perfectly suites for hex escaping purposes.
Diffstat (limited to 'sql/mysqld.h')
-rw-r--r--sql/mysqld.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/sql/mysqld.h b/sql/mysqld.h
index 2099e57e96d..5af1260ecbc 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -399,16 +399,16 @@ enum options_mysqld
/**
- Query type constants.
-
- QT_ORDINARY -- ordinary SQL query.
- QT_IS -- SQL query to be shown in INFORMATION_SCHEMA (in utf8 and without
- character set introducers).
+ Query type constants (usable as bitmap flags).
*/
enum enum_query_type
{
- QT_ORDINARY,
- QT_IS
+ /// Nothing specific, ordinary SQL query.
+ QT_ORDINARY= 0,
+ /// In utf8.
+ QT_TO_SYSTEM_CHARSET= (1 << 0),
+ /// Without character set introducers.
+ QT_WITHOUT_INTRODUCERS= (1 << 1)
};
/* query_id */