diff options
author | unknown <bell@sanja.is.com.ua> | 2004-09-15 23:42:56 +0300 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2004-09-15 23:42:56 +0300 |
commit | cb5790916a1ce1a4fba9803a4d49139a1ea3ecfe (patch) | |
tree | 3ce3368d9a9eb09ff501cbcf82391101c7e06b40 /sql/sql_parse.cc | |
parent | 33ebdba811ed03acc45aef9557c3150101a36691 (diff) | |
download | mariadb-git-cb5790916a1ce1a4fba9803a4d49139a1ea3ecfe.tar.gz |
support of join view updateability (WL#1809)
include/mysqld_error.h:
new error mesaages
mysql-test/r/view.result:
tests of updatint/inserting join views
mysql-test/t/view.test:
tests of updatint/inserting join views
sql/mysql_priv.h:
support of "usual UPDATE" -> "multi UPDATE" conversion
sql/share/czech/errmsg.txt:
new error mesaages
sql/share/danish/errmsg.txt:
new error mesaages
sql/share/dutch/errmsg.txt:
new error mesaages
sql/share/english/errmsg.txt:
new error mesaages
sql/share/estonian/errmsg.txt:
new error mesaages
sql/share/french/errmsg.txt:
new error mesaages
sql/share/german/errmsg.txt:
new error mesaages
sql/share/greek/errmsg.txt:
new error mesaages
sql/share/hungarian/errmsg.txt:
new error mesaages
sql/share/italian/errmsg.txt:
new error mesaages
sql/share/japanese/errmsg.txt:
new error mesaages
sql/share/korean/errmsg.txt:
new error mesaages
sql/share/norwegian-ny/errmsg.txt:
new error mesaages
sql/share/norwegian/errmsg.txt:
new error mesaages
sql/share/polish/errmsg.txt:
new error mesaages
sql/share/portuguese/errmsg.txt:
new error mesaages
sql/share/romanian/errmsg.txt:
new error mesaages
sql/share/russian/errmsg.txt:
new error mesaages
sql/share/serbian/errmsg.txt:
new error mesaages
sql/share/slovak/errmsg.txt:
new error mesaages
sql/share/spanish/errmsg.txt:
new error mesaages
sql/share/swedish/errmsg.txt:
new error mesaages
sql/share/ukrainian/errmsg.txt:
new error mesaages
sql/sql_base.cc:
test to avoid join virew to be catched here
sql/sql_class.h:
support of join views add to update
sql/sql_delete.cc:
support of join views add to delete(error issue)
sql/sql_insert.cc:
support of join views add to insert
(order of some check changed, to allow find table which will be inserted in, when we will know which fields will be inserted)
mechanism of calling setup_tables() only once fixed for INSERT SELECT
sql/sql_parse.cc:
support of "usual UPDATE" -> "multi UPDATE" conversion
mysql_insert_select_prepare now called in same environment for usual queries and PS preparing
support of join views add to delete (error issue)
sql/sql_prepare.cc:
support of "usual UPDATE" -> "multi UPDATE" conversion
support of join views add to delete (error issue)
sql/sql_update.cc:
support of join views add to update
sql/sql_view.cc:
join views made updatable
sql/sql_view.h:
insert_view_fields now can check some errors
sql/table.cc:
methods to support recursive walk by tables tree
sql/table.h:
methods to support recursive walk by tables tree
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r-- | sql/sql_parse.cc | 56 |
1 files changed, 36 insertions, 20 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 115dda49666..f9a6275abeb 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2747,18 +2747,29 @@ unsent_create_error: lex->duplicates); if (thd->net.report_error) res= -1; - break; + if (res != 2) + break; case SQLCOM_UPDATE_MULTI: { + bool converted= 0; DBUG_ASSERT(first_table == all_tables && first_table != 0); - if ((res= multi_update_precheck(thd, all_tables))) - break; + if (res != 2) + { + if ((res= multi_update_precheck(thd, all_tables))) + break; + } + else + { + res= 0; + converted= 1; + } res= mysql_multi_update(thd, all_tables, &select_lex->item_list, &lex->value_list, select_lex->where, select_lex->options, - lex->duplicates, unit, select_lex); + lex->duplicates, unit, select_lex, + converted); break; } case SQLCOM_REPLACE: @@ -2796,31 +2807,26 @@ unsent_create_error: if (!(res= open_and_lock_tables(thd, all_tables))) { - /* - Is table which we are changing used somewhere in other parts of - query - */ - if (unique_table(first_table, all_tables->next_independent())) + /* Skip first table, which is the table we are inserting in */ + lex->select_lex.table_list.first= (byte*)first_table->next_local; + + res= mysql_insert_select_prepare(thd); + if (!res && (result= new select_insert(first_table, first_table->table, + &lex->field_list, + lex->duplicates))) { - /* Using same table for INSERT and SELECT */ - select_lex->options |= OPTION_BUFFER_RESULT; - } + TABLE_LIST *first_select_table; - if ((res= mysql_insert_select_prepare(thd))) - break; - if ((result= new select_insert(first_table, first_table->table, - &lex->field_list, lex->duplicates))) - /* Skip first table, which is the table we are inserting in */ - lex->select_lex.table_list.first= (byte*) first_table->next_local; /* insert/replace from SELECT give its SELECT_LEX for SELECT, and item_list belong to SELECT */ lex->select_lex.resolve_mode= SELECT_LEX::SELECT_MODE; res= handle_select(thd, lex, result); - /* revert changes for SP */ - lex->select_lex.table_list.first= (byte*) first_table; lex->select_lex.resolve_mode= SELECT_LEX::INSERT_MODE; + } + /* revert changes for SP */ + lex->select_lex.table_list.first= (byte*) first_table; if (thd->net.report_error) res= -1; } @@ -2884,6 +2890,16 @@ unsent_create_error: if ((res= open_and_lock_tables(thd, all_tables))) break; + if (!first_table->table) + { + DBUG_ASSERT(first_table->view && + first_table->ancestor && first_table->ancestor->next_local); + my_error(ER_VIEW_DELETE_MERGE_VIEW, MYF(0), + first_table->view_db.str, first_table->view_name.str); + res= -1; + break; + } + if ((res= mysql_multi_delete_prepare(thd))) break; |