summaryrefslogtreecommitdiff
path: root/sql/sql_update.cc
diff options
context:
space:
mode:
authorunknown <tomas@poseidon.ndb.mysql.com>2005-07-12 20:01:22 +0200
committerunknown <tomas@poseidon.ndb.mysql.com>2005-07-12 20:01:22 +0200
commite4be45da93b3b64ede35053a7fa3989a40a2766e (patch)
tree8fd7b30e9e4cce3fdfc60e700fdb2d668f2f6449 /sql/sql_update.cc
parentf9027b7a050186c504b9a5ab7e164c0cbaacb8f3 (diff)
parentff7db9bfd9f0c50d75f3085c6554ea8ecb9b906f (diff)
downloadmariadb-git-e4be45da93b3b64ede35053a7fa3989a40a2766e.tar.gz
Merge
BitKeeper/etc/logging_ok: auto-union BUILD/autorun.sh: Auto merged BitKeeper/etc/config: Auto merged Makefile.am: Auto merged include/my_bitmap.h: Auto merged libmysqld/Makefile.am: Auto merged mysql-test/mysql-test-run.pl: Auto merged mysql-test/mysql-test-run.sh: Auto merged mysql-test/r/grant.result: Auto merged mysql-test/r/ps_6bdb.result: Auto merged mysql-test/r/ps_7ndb.result: Auto merged mysys/Makefile.am: Auto merged mysys/default.c: Auto merged scripts/mysql_create_system_tables.sh: Auto merged scripts/mysql_fix_privilege_tables.sql: Auto merged sql/Makefile.am: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/ha_ndbcluster.h: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/item.cc: Auto merged sql/log_event.cc: Auto merged sql/mysql_priv.h: Auto merged sql/opt_range.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_acl.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_cache.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_delete.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_udf.cc: Auto merged sql/sql_yacc.yy: Auto merged storage/heap/Makefile.am: Auto merged storage/heap/hp_hash.c: Auto merged storage/innobase/btr/btr0btr.c: Auto merged storage/innobase/btr/btr0cur.c: Auto merged storage/innobase/configure.in: Auto merged storage/innobase/fil/fil0fil.c: Auto merged storage/innobase/ibuf/ibuf0ibuf.c: Auto merged storage/innobase/include/os0file.h: Auto merged storage/innobase/include/page0cur.h: Auto merged storage/innobase/include/row0mysql.h: Auto merged storage/innobase/include/srv0srv.h: Auto merged storage/innobase/include/trx0trx.h: Auto merged storage/innobase/include/trx0trx.ic: Auto merged storage/innobase/lock/lock0lock.c: Auto merged storage/innobase/log/log0recv.c: Auto merged storage/innobase/os/os0file.c: Auto merged storage/innobase/page/page0cur.c: Auto merged storage/innobase/page/page0page.c: Auto merged storage/innobase/rem/rem0rec.c: Auto merged storage/innobase/row/row0mysql.c: Auto merged storage/innobase/row/row0sel.c: Auto merged storage/innobase/row/row0upd.c: Auto merged storage/innobase/srv/srv0srv.c: Auto merged storage/innobase/trx/trx0trx.c: Auto merged storage/innobase/trx/trx0undo.c: Auto merged storage/myisam/Makefile.am: Auto merged storage/myisam/mi_create.c: Auto merged storage/myisam/mi_open.c: Auto merged storage/myisam/mi_packrec.c: Auto merged storage/myisam/mi_unique.c: Auto merged storage/myisam/myisampack.c: Auto merged storage/myisammrg/Makefile.am: Auto merged storage/ndb/include/mgmcommon/ConfigRetriever.hpp: Auto merged storage/ndb/include/transporter/TransporterDefinitions.hpp: Auto merged storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp: Auto merged storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp: Auto merged storage/ndb/src/mgmsrv/main.cpp: Auto merged storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp: Auto merged storage/ndb/test/ndbapi/create_tab.cpp: Auto merged storage/ndb/test/ndbapi/testBlobs.cpp: Auto merged strings/ctype-big5.c: Auto merged strings/ctype-ucs2.c: Auto merged support-files/mysql.spec.sh: Auto merged configure.in: merge mysql-test/t/disabled.def: merge mysys/my_bitmap.c: SCCS merged sql/ha_federated.cc: merge sql/ha_innodb.cc: merge sql/ha_ndbcluster.cc: merge sql/mysqld.cc: e merge sql/sql_insert.cc: merge sql/sql_lex.h: merge sql/sql_load.cc: merge sql/sql_select.cc: merge e C sql/sql_update.cc: merge sql/table.cc: merge
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r--sql/sql_update.cc47
1 files changed, 20 insertions, 27 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 1c81b1b5a92..c5d8e0d98e2 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -67,6 +67,8 @@ static bool check_fields(THD *thd, List<Item> &items)
List_iterator<Item> it(items);
Item *item;
Item_field *field;
+ Name_resolution_context *context= &thd->lex->select_lex.context;
+
while ((item= it++))
{
if (!(field= item->filed_for_view_update()))
@@ -185,18 +187,12 @@ int mysql_update(THD *thd,
#ifndef NO_EMBEDDED_ACCESS_CHECKS
table_list->grant.want_privilege= table->grant.want_privilege= want_privilege;
#endif
- {
- bool res;
- select_lex->no_wrap_view_item= 1;
- /*
- Indicate that the set of fields is to be updated by passing 2 for
- set_query_id.
- */
- res= setup_fields(thd, 0, table_list, fields, 2, 0, 0);
- select_lex->no_wrap_view_item= 0;
- if (res)
- DBUG_RETURN(1); /* purecov: inspected */
- }
+ /*
+ Indicate that the set of fields is to be updated by passing 2 for
+ set_query_id.
+ */
+ if (setup_fields_with_no_wrap(thd, 0, fields, 2, 0, 0))
+ DBUG_RETURN(1); /* purecov: inspected */
if (table_list->view && check_fields(thd, fields))
{
DBUG_RETURN(1);
@@ -223,7 +219,7 @@ int mysql_update(THD *thd,
table_list->grant.want_privilege= table->grant.want_privilege=
(SELECT_ACL & ~table->grant.privilege);
#endif
- if (setup_fields(thd, 0, table_list, values, 1, 0, 0))
+ if (setup_fields(thd, 0, values, 1, 0, 0))
{
free_underlaid_joins(thd, select_lex);
DBUG_RETURN(1); /* purecov: inspected */
@@ -657,7 +653,9 @@ bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
tables.table= table;
tables.alias= table_list->alias;
- if (setup_tables(thd, table_list, conds, &select_lex->leaf_tables, FALSE) ||
+ if (setup_tables(thd, &select_lex->context,
+ table_list, conds, &select_lex->leaf_tables,
+ FALSE) ||
setup_conds(thd, table_list, select_lex->leaf_tables, conds) ||
select_lex->setup_ref_array(thd, order_num) ||
setup_order(thd, select_lex->ref_pointer_array,
@@ -717,7 +715,6 @@ bool mysql_multi_update_prepare(THD *thd)
TABLE_LIST *tl, *leaves;
List<Item> *fields= &lex->select_lex.item_list;
table_map tables_for_update;
- int res;
bool update_view= 0;
/*
if this multi-update was converted from usual update, here is table
@@ -742,15 +739,12 @@ bool mysql_multi_update_prepare(THD *thd)
call in setup_tables()).
*/
- if (setup_tables(thd, table_list, &lex->select_lex.where,
+ if (setup_tables(thd, &lex->select_lex.context,
+ table_list, &lex->select_lex.where,
&lex->select_lex.leaf_tables, FALSE))
DBUG_RETURN(TRUE);
- leaves= lex->select_lex.leaf_tables;
- if ((lex->select_lex.no_wrap_view_item= 1,
- res= setup_fields(thd, 0, table_list, *fields, 2, 0, 0),
- lex->select_lex.no_wrap_view_item= 0,
- res))
+ if (setup_fields_with_no_wrap(thd, 0, *fields, 2, 0, 0))
DBUG_RETURN(TRUE);
for (tl= table_list; tl ; tl= tl->next_local)
@@ -772,6 +766,7 @@ bool mysql_multi_update_prepare(THD *thd)
/*
Setup timestamp handling and locking mode
*/
+ leaves= lex->select_lex.leaf_tables;
for (tl= leaves; tl; tl= tl->next_leaf)
{
TABLE *table= tl->table;
@@ -862,12 +857,10 @@ bool mysql_multi_update_prepare(THD *thd)
for (TABLE_LIST *tbl= table_list; tbl; tbl= tbl->next_global)
tbl->cleanup_items();
- if (setup_tables(thd, table_list, &lex->select_lex.where,
+ if (setup_tables(thd, &lex->select_lex.context,
+ table_list, &lex->select_lex.where,
&lex->select_lex.leaf_tables, FALSE) ||
- (lex->select_lex.no_wrap_view_item= 1,
- res= setup_fields(thd, 0, table_list, *fields, 2, 0, 0),
- lex->select_lex.no_wrap_view_item= 0,
- res))
+ setup_fields_with_no_wrap(thd, 0, *fields, 2, 0, 0))
DBUG_RETURN(TRUE);
}
@@ -997,7 +990,7 @@ int multi_update::prepare(List<Item> &not_used_values,
reference tables
*/
- if (setup_fields(thd, 0, all_tables, *values, 1, 0, 0))
+ if (setup_fields(thd, 0, *values, 1, 0, 0))
DBUG_RETURN(1);
/*