Commit 68cba091 authored by Sergei Petrunia's avatar Sergei Petrunia

Add QT_ITEM_IDENT_DISABLE_DB_TABLE_NAMES flag for Item::print

It allows to skip db and table name when printing table column references.
parent 16d8d189
...@@ -3193,6 +3193,12 @@ void Item_ident::print(String *str, enum_query_type query_type) ...@@ -3193,6 +3193,12 @@ void Item_ident::print(String *str, enum_query_type query_type)
use_db_name= use_table_name= false; use_db_name= use_table_name= false;
} }
if ((query_type & QT_ITEM_IDENT_DISABLE_DB_TABLE_NAMES))
{
// Don't print db or table name irrespective of any other settings.
use_db_name= use_table_name= false;
}
if (!field_name.str || !field_name.str[0]) if (!field_name.str || !field_name.str[0])
{ {
append_identifier(thd, str, STRING_WITH_LEN("tmp_field")); append_identifier(thd, str, STRING_WITH_LEN("tmp_field"));
......
...@@ -871,6 +871,12 @@ enum enum_query_type ...@@ -871,6 +871,12 @@ enum enum_query_type
QT_ITEM_SUBSELECT_ID_ONLY, QT_ITEM_SUBSELECT_ID_ONLY,
QT_SHOW_SELECT_NUMBER= (1<<10), QT_SHOW_SELECT_NUMBER= (1<<10),
/// Do not print database name or table name in the identifiers (even if
/// this means the printout will be ambigous). It is assumed that the caller
/// passing this flag knows what they are doing.
QT_ITEM_IDENT_DISABLE_DB_TABLE_NAMES= (1 <<11),
/// This is used for EXPLAIN EXTENDED extra warnings / Be more detailed /// This is used for EXPLAIN EXTENDED extra warnings / Be more detailed
/// Be more detailed than QT_EXPLAIN. /// Be more detailed than QT_EXPLAIN.
/// Perhaps we should eventually include QT_ITEM_IDENT_SKIP_CURRENT_DATABASE /// Perhaps we should eventually include QT_ITEM_IDENT_SKIP_CURRENT_DATABASE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment