summaryrefslogtreecommitdiff
path: root/sql/sql_view.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-11-01 15:54:30 +0200
committerunknown <monty@mysql.com>2005-11-01 15:54:30 +0200
commitee380a077782f87d80aae7a8c9c9ead51dfd8e7b (patch)
treea19fa82d4c5fc0f845231b5d75a45a0c36e0494d /sql/sql_view.cc
parentf9dbcd558a52652692c4593c93656431e4cbf043 (diff)
downloadmariadb-git-ee380a077782f87d80aae7a8c9c9ead51dfd8e7b.tar.gz
Reverting patch for BUG #14009 (use of abs() on null value causes problems with filesort
Fix for bug #14536: SELECT @a,@a:=... fails with prepared statements mysql-test/r/func_sapdb.result: Correct tests after reverting patch for BUG #14009 (use of abs() on null value causes problems with filesort) mysql-test/r/type_newdecimal.result: Correct tests after reverting patch for BUG #14009 (use of abs() on null value causes problems with filesort) mysql-test/r/user_var.result: More test with SELECT @a:= mysql-test/t/disabled.def: Enable user_var.test for mysql-test/t/user_var.test: More test with SELECT @a:= sql/item.cc: Simple optimization during review of new code sql/item_func.cc: Reverting patch for BUG #14009 (use of abs() on null value causes problems with filesort) sql/item_timefunc.h: timediff() can return NULL for not NULL arguments sql/sql_base.cc: Remove usage of current_thd() in mysql_make_view() sql/sql_lex.h: Remove usage of current_thd() in mysql_make_view() sql/sql_select.cc: Fix for bug #14536: SELECT @a,@a:=... fails with prepared statements sql/sql_view.cc: Remove usage of current_thd() in mysql_make_view() Simple optimization of new code sql/sql_view.h: Remove usage of current_thd() in mysql_make_view() sql/table.cc: Simple optimization of new code
Diffstat (limited to 'sql/sql_view.cc')
-rw-r--r--sql/sql_view.cc42
1 files changed, 20 insertions, 22 deletions
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index b30f8cb156c..846130c53fc 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -728,20 +728,24 @@ loop_out:
SYNOPSIS
mysql_make_view()
- parser - parser object;
- table - TABLE_LIST structure for filling
+ thd Thread handler
+ parser parser object
+ table TABLE_LIST structure for filling
RETURN
0 ok
1 error
*/
-my_bool
-mysql_make_view(File_parser *parser, TABLE_LIST *table)
+bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table)
{
- THD *thd= current_thd;
+ SELECT_LEX *end, *view_select;
+ LEX *old_lex, *lex;
+ Query_arena *arena, backup;
+ int res;
+ bool result;
DBUG_ENTER("mysql_make_view");
- DBUG_PRINT("info", ("table=%p (%s)", table, table->table_name));
+ DBUG_PRINT("info", ("table: 0x%lx (%s)", (ulong) table, table->table_name));
if (table->view)
{
@@ -765,16 +769,12 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table)
DBUG_RETURN(0);
}
- SELECT_LEX *end;
- LEX *old_lex= thd->lex, *lex;
- SELECT_LEX *view_select;
- int res= 0;
-
/*
For now we assume that tables will not be changed during PS life (it
will be TRUE as far as we make new table cache).
*/
- Query_arena *arena= thd->stmt_arena, backup;
+ old_lex= thd->lex;
+ arena= thd->stmt_arena;
if (arena->is_conventional())
arena= 0;
else
@@ -1133,23 +1133,21 @@ ok:
(st_select_lex_node**)&old_lex->all_selects_list;
ok2:
- if (arena)
- thd->restore_active_arena(arena, &backup);
if (!old_lex->time_zone_tables_used && thd->lex->time_zone_tables_used)
old_lex->time_zone_tables_used= thd->lex->time_zone_tables_used;
- thd->lex= old_lex;
- if (!table->prelocking_placeholder && table->prepare_security(thd))
- DBUG_RETURN(1);
-
- DBUG_RETURN(0);
+ result= !table->prelocking_placeholder && table->prepare_security(thd);
-err:
+end:
if (arena)
thd->restore_active_arena(arena, &backup);
+ thd->lex= old_lex;
+ DBUG_RETURN(result);
+
+err:
delete table->view;
table->view= 0; // now it is not VIEW placeholder
- thd->lex= old_lex;
- DBUG_RETURN(1);
+ result= 1;
+ goto end;
}