summaryrefslogtreecommitdiff
path: root/sql/sql_prepare.cc
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2004-11-25 02:23:13 +0200
committerunknown <bell@sanja.is.com.ua>2004-11-25 02:23:13 +0200
commitf88d01932f4a81682267e21022686d3dea4edb78 (patch)
treeb6370530d805ecddad3284428883cac10256f774 /sql/sql_prepare.cc
parent5a00a868b74ffb6b220eb72c87ec38696ce9406c (diff)
downloadmariadb-git-f88d01932f4a81682267e21022686d3dea4edb78.tar.gz
post-merge fix
mysql-test/r/view.result: changes in error number, and key in view processing mysql-test/t/view.test: changes in error number, and key in view processing sql/mysql_priv.h: changes functions sql/sp.cc: now we report to setup_tables(), are we setuping SELECT...INSERT sql/sql_base.cc: fixed finding table, taking in account join view, which can have not TABLE pointer now we report to setup_tables(), are we setuping SELECT...INSERT and ennumerete insert table separately sql/sql_delete.cc: now we report to setup_tables(), are we setuping SELECT...INSERT sql/sql_help.cc: now we report to setup_tables(), are we setuping SELECT...INSERT sql/sql_insert.cc: fixed returning value of functions sql/sql_load.cc: now we report to setup_tables(), are we setuping SELECT...INSERT removed second setup_tables call (merge) sql/sql_olap.cc: now we report to setup_tables(), are we setuping SELECT...INSERT sql/sql_parse.cc: UPDATE->MULTIUPDATE switching fixed sql/sql_prepare.cc: UPDATE->MULTIUPDATE switching fixed sql/sql_select.cc: now we report to setup_tables(), are we setuping SELECT...INSERT sql/sql_update.cc: UPDATE->MULTIUPDATE switching fixed sql/sql_view.cc: returning value fixed sql/sql_view.h: returning value fixed
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r--sql/sql_prepare.cc27
1 files changed, 21 insertions, 6 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index fed240b865a..bff5a2fc999 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -944,23 +944,36 @@ static int mysql_test_update(Prepared_statement *stmt,
{
int res;
THD *thd= stmt->thd;
+ uint table_count= 0;
SELECT_LEX *select= &stmt->lex->select_lex;
DBUG_ENTER("mysql_test_update");
if (update_precheck(thd, table_list))
DBUG_RETURN(1);
- if (!(res=open_and_lock_tables(thd, table_list)))
+ if (!open_tables(thd, table_list, &table_count))
{
- if (table_list->table == 0)
+ if (table_list->ancestor && table_list->ancestor->next_local)
{
- DBUG_ASSERT(table_list->view &&
- table_list->ancestor && table_list->ancestor->next_local);
- stmt->lex->sql_command= SQLCOM_UPDATE_MULTI;
- DBUG_PRINT("info", ("Switch to multi-update (command replaced)"));
+ DBUG_ASSERT(table_list->view);
+ DBUG_PRINT("info", ("Switch to multi-update"));
+ /* pass counter value */
+ thd->lex->table_count= table_count;
+ /*
+ give correct value to multi_lock_option, because it will be used
+ in multiupdate
+ */
+ thd->lex->multi_lock_option= table_list->lock_type;
/* convert to multiupdate */
return 2;
}
+
+ if (lock_tables(thd, table_list, table_count) ||
+ mysql_handle_derived(thd->lex, &mysql_derived_prepare) ||
+ (thd->fill_derived_tables() &&
+ mysql_handle_derived(thd->lex, &mysql_derived_filling)))
+ DBUG_RETURN(1);
+
if (!(res= mysql_prepare_update(thd, table_list,
&select->where,
select->order_list.elements,
@@ -982,6 +995,8 @@ static int mysql_test_update(Prepared_statement *stmt,
}
stmt->lex->unit.cleanup();
}
+ else
+ res= 1;
/* TODO: here we should send types of placeholders to the client. */
DBUG_RETURN(res);
}