summaryrefslogtreecommitdiff
path: root/sql/sql_insert.cc
diff options
context:
space:
mode:
authorSergey Glukhov <Sergey.Glukhov@sun.com>2009-07-03 13:39:22 +0500
committerSergey Glukhov <Sergey.Glukhov@sun.com>2009-07-03 13:39:22 +0500
commit59d239e1f1c670875fdb3414c28d5a6e9820951d (patch)
tree1df6681d276a543343a672b0887578f6ebda5a32 /sql/sql_insert.cc
parent45d59063cb5c835c01d4744ad3b3b4c141a639a2 (diff)
parent2dd709468194c3b5399c4dc614037c0557e17e14 (diff)
downloadmariadb-git-59d239e1f1c670875fdb3414c28d5a6e9820951d.tar.gz
5.0-bugteam->5.1-bugteam merge
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r--sql/sql_insert.cc32
1 files changed, 29 insertions, 3 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 66aea05f2ef..104c81ca984 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1116,6 +1116,33 @@ static bool mysql_prepare_insert_check_table(THD *thd, TABLE_LIST *table_list,
/*
+ Get extra info for tables we insert into
+
+ @param table table(TABLE object) we insert into,
+ might be NULL in case of view
+ @param table(TABLE_LIST object) or view we insert into
+*/
+
+static void prepare_for_positional_update(TABLE *table, TABLE_LIST *tables)
+{
+ if (table)
+ {
+ if(table->reginfo.lock_type != TL_WRITE_DELAYED)
+ table->prepare_for_position();
+ return;
+ }
+
+ DBUG_ASSERT(tables->view);
+ List_iterator<TABLE_LIST> it(*tables->view_tables);
+ TABLE_LIST *tbl;
+ while ((tbl= it++))
+ prepare_for_positional_update(tbl->table, tbl);
+
+ return;
+}
+
+
+/*
Prepare items in INSERT statement
SYNOPSIS
@@ -1264,9 +1291,8 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list,
Only call prepare_for_posistion() if we are not performing a DELAYED
operation. It will instead be executed by delayed insert thread.
*/
- if ((duplic == DUP_UPDATE || duplic == DUP_REPLACE) &&
- (table->reginfo.lock_type != TL_WRITE_DELAYED))
- table->prepare_for_position();
+ if (duplic == DUP_UPDATE || duplic == DUP_REPLACE)
+ prepare_for_positional_update(table, table_list);
DBUG_RETURN(FALSE);
}