diff options
author | Sergei Golubchik <serg@mariadb.org> | 2017-06-27 20:44:32 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2017-07-05 17:15:58 +0200 |
commit | 03c52e964f6ed16b02d01f37428cdd987bba0e92 (patch) | |
tree | d891c69ebc4cf7c597dfa2c9784fc1090e74b2af /sql | |
parent | 2bf017c210d00e3cea281aee9f241a01a3f85b7f (diff) | |
download | mariadb-git-03c52e964f6ed16b02d01f37428cdd987bba0e92.tar.gz |
cleanup: move Virtual_column_info::print out of Virtual_column_info
Diffstat (limited to 'sql')
-rw-r--r-- | sql/field.h | 2 | ||||
-rw-r--r-- | sql/item.cc | 11 | ||||
-rw-r--r-- | sql/item.h | 22 |
3 files changed, 23 insertions, 12 deletions
diff --git a/sql/field.h b/sql/field.h index 14f14afdaf7..18d66ed8891 100644 --- a/sql/field.h +++ b/sql/field.h @@ -681,7 +681,7 @@ public: in_partitioning_expr= TRUE; } inline bool is_equal(const Virtual_column_info* vcol) const; - void print(String*); + inline void print(String*); }; class Field: public Value_source diff --git a/sql/item.cc b/sql/item.cc index df1f66fde28..12935a43bea 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -10715,14 +10715,3 @@ void Item::register_in(THD *thd) next= thd->free_list; thd->free_list= this; } - -void Virtual_column_info::print(String *str) -{ - expr->print_parenthesised(str, - (enum_query_type)(QT_ITEM_ORIGINAL_FUNC_NULLIF | - QT_ITEM_IDENT_SKIP_DB_NAMES | - QT_ITEM_IDENT_SKIP_TABLE_NAMES | - QT_NO_DATA_EXPANSION | - QT_TO_SYSTEM_CHARSET), - LOWEST_PRECEDENCE); -} diff --git a/sql/item.h b/sql/item.h index 02e4b2e3468..fc606e766f1 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1292,6 +1292,23 @@ public: virtual enum precedence precedence() const { return DEFAULT_PRECEDENCE; } void print_parenthesised(String *str, enum_query_type query_type, enum precedence parent_prec); + /** + This helper is used to print expressions as a part of a table definition, + in particular for + - generated columns + - check constraints + - default value expressions + */ + void print_for_table_def(String *str) + { + print_parenthesised(str, + (enum_query_type)(QT_ITEM_ORIGINAL_FUNC_NULLIF | + QT_ITEM_IDENT_SKIP_DB_NAMES | + QT_ITEM_IDENT_SKIP_TABLE_NAMES | + QT_NO_DATA_EXPANSION | + QT_TO_SYSTEM_CHARSET), + LOWEST_PRECEDENCE); + } virtual void print(String *str, enum_query_type query_type); void print_item_w_name(String *str, enum_query_type query_type); void print_value(String *str); @@ -5977,4 +5994,9 @@ inline bool Virtual_column_info::is_equal(const Virtual_column_info* vcol) const && expr->eq(vcol->expr, true); } +inline void Virtual_column_info::print(String* str) +{ + expr->print_for_table_def(str); +} + #endif /* SQL_ITEM_INCLUDED */ |