summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/item.cc2
-rw-r--r--sql/item_cmpfunc.cc13
-rw-r--r--sql/item_cmpfunc.h1
-rw-r--r--sql/sql_lex.cc2
-rw-r--r--sql/sql_show.cc2
5 files changed, 17 insertions, 3 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 33c35f8c3e0..0cf4864326f 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -6845,7 +6845,7 @@ Item *Item_field::update_value_transformer(uchar *select_arg)
void Item_field::print(String *str, enum_query_type query_type)
{
if (field && field->table->const_table &&
- !(query_type & QT_NO_DATA_EXPANSION))
+ !(query_type & (QT_NO_DATA_EXPANSION | QT_VIEW_INTERNAL)))
{
print_value(str);
return;
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 6fb650b975b..d4a2c767b15 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -4850,6 +4850,19 @@ Item *and_expressions(Item *a, Item *b, Item **org_item)
}
+void Item_func_isnull::print(String *str, enum_query_type query_type)
+{
+ str->append(func_name());
+ str->append('(');
+ if (const_item() && !args[0]->maybe_null &&
+ !(query_type & (QT_NO_DATA_EXPANSION | QT_VIEW_INTERNAL)))
+ str->append("/*always not null*/ 1");
+ else
+ args[0]->print(str, query_type);
+ str->append(')');
+}
+
+
longlong Item_func_isnull::val_int()
{
DBUG_ASSERT(fixed == 1);
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 3c8cc71370d..c4e6a53dd6b 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -1389,6 +1389,7 @@ public:
const_item_cache= args[0]->const_item();
}
}
+ virtual void print(String *str, enum_query_type query_type);
table_map not_null_tables() const { return 0; }
optimize_type select_optimize() const { return OPTIMIZE_NULL; }
Item *neg_transformer(THD *thd);
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 2bf1216ec34..cfbde25314b 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -2414,7 +2414,7 @@ void st_select_lex::print_order(String *str,
{
if (order->counter_used)
{
- if (query_type != QT_VIEW_INTERNAL)
+ if (!(query_type & QT_VIEW_INTERNAL))
{
char buffer[20];
size_t length= my_snprintf(buffer, 20, "%d", order->counter);
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 06d5a6f570a..db33a9de781 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -2085,7 +2085,7 @@ view_store_create_info(THD *thd, TABLE_LIST *table, String *buff)
We can't just use table->query, because our SQL_MODE may trigger
a different syntax, like when ANSI_QUOTES is defined.
*/
- table->view->unit.print(buff, QT_ORDINARY);
+ table->view->unit.print(buff, QT_VIEW_INTERNAL);
if (table->with_check != VIEW_CHECK_NONE)
{