Skip to content
Permalink
Browse files
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.
  • Loading branch information
spetrunia committed Aug 14, 2020
1 parent 16d8d18 commit 68cba09
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
@@ -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"));
@@ -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

0 comments on commit 68cba09

Please sign in to comment.