summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2004-04-03 11:28:20 +0300
committerunknown <bell@sanja.is.com.ua>2004-04-03 11:28:20 +0300
commitd7c25fe28ec29154e136cac651fffe8b7338ca84 (patch)
tree8318a7b6b64d0bf809d7c8e79b23a1a52afff7c6 /sql/sql_base.cc
parent8abda715d4d6bf75bb4470c7acc86b9dd224012e (diff)
parent8c8dffb60d23bf3a5666dcc251d2f15cb913d541 (diff)
downloadmariadb-git-d7c25fe28ec29154e136cac651fffe8b7338ca84.tar.gz
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-on-4.1 sql/mysql_priv.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_parse.cc: Auto merged sql/table.h: Auto merged
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc44
1 files changed, 27 insertions, 17 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index f3bf0a15745..bea77c72bc0 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -2405,15 +2405,13 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
{
if (table->on_expr)
{
- if (stmt)
- thd->set_n_backup_item_arena(stmt, &backup);
/* Make a join an a expression */
thd->where="on clause";
if (!table->on_expr->fixed &&
table->on_expr->fix_fields(thd, tables, &table->on_expr) ||
table->on_expr->check_cols(1))
- goto err;
+ DBUG_RETURN(1);
thd->lex->current_select->cond_count++;
/*
@@ -2425,12 +2423,16 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
!(specialflag & SPECIAL_NO_NEW_FUNC)))
{
table->outer_join= 0;
- if (!(*conds= and_conds(thd, *conds, table->on_expr, tables)))
- goto err;
+ if (stmt)
+ thd->set_n_backup_item_arena(stmt, &backup);
+ *conds= and_conds(*conds, table->on_expr);
table->on_expr=0;
+ if (stmt)
+ thd->restore_backup_item_arena(stmt, &backup);
+ if ((*conds) && !(*conds)->fixed &&
+ (*conds)->fix_fields(thd, tables, conds))
+ DBUG_RETURN(1);
}
- if (stmt)
- thd->restore_backup_item_arena(stmt, &backup);
}
if (table->natural_join)
{
@@ -2469,20 +2471,28 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
if (!table->outer_join) // Not left join
{
- if (!(*conds= and_conds(thd, *conds, cond_and, tables)) ||
- (*conds && !(*conds)->fixed &&
- (*conds)->fix_fields(thd, tables, conds)))
- goto err;
+ *conds= and_conds(*conds, cond_and);
+ // fix_fields() should be made with temporary memory pool
+ if (stmt)
+ thd->restore_backup_item_arena(stmt, &backup);
+ if (*conds && !(*conds)->fixed)
+ {
+ if ((*conds)->fix_fields(thd, tables, conds))
+ DBUG_RETURN(1);
+ }
}
else
{
- table->on_expr= and_conds(thd, table->on_expr, cond_and, tables);
- if (table->on_expr && !table->on_expr->fixed &&
- table->on_expr->fix_fields(thd, tables, &table->on_expr))
- goto err;
+ table->on_expr= and_conds(table->on_expr, cond_and);
+ // fix_fields() should be made with temporary memory pool
+ if (stmt)
+ thd->restore_backup_item_arena(stmt, &backup);
+ if (table->on_expr && !table->on_expr->fixed)
+ {
+ if (table->on_expr->fix_fields(thd, tables, &table->on_expr))
+ DBUG_RETURN(1);
+ }
}
- if (stmt)
- thd->restore_backup_item_arena(stmt, &backup);
}
}