diff options
-rw-r--r-- | sql/item.cc | 6 | ||||
-rw-r--r-- | sql/mysqld.h | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/sql/item.cc b/sql/item.cc index 6cd8407e4dd..b164b945abf 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -3193,6 +3193,12 @@ void Item_ident::print(String *str, enum_query_type query_type) 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]) { append_identifier(thd, str, STRING_WITH_LEN("tmp_field")); diff --git a/sql/mysqld.h b/sql/mysqld.h index db8d9b4b1aa..e8dd5706e80 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -871,6 +871,12 @@ enum enum_query_type QT_ITEM_SUBSELECT_ID_ONLY, 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 /// Be more detailed than QT_EXPLAIN. /// Perhaps we should eventually include QT_ITEM_IDENT_SKIP_CURRENT_DATABASE |