mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
post review changes:
CHECK OPTION moved to one function view name added to error messages mysql-test/r/view.result: error messages changed sql/share/czech/errmsg.txt: view name added sql/share/danish/errmsg.txt: view name added sql/share/dutch/errmsg.txt: view name added sql/share/english/errmsg.txt: view name added sql/share/estonian/errmsg.txt: view name added sql/share/french/errmsg.txt: view name added sql/share/german/errmsg.txt: view name added sql/share/greek/errmsg.txt: view name added sql/share/hungarian/errmsg.txt: view name added sql/share/italian/errmsg.txt: view name added sql/share/japanese/errmsg.txt: view name added sql/share/korean/errmsg.txt: view name added sql/share/norwegian-ny/errmsg.txt: view name added sql/share/norwegian/errmsg.txt: view name added sql/share/polish/errmsg.txt: view name added sql/share/portuguese/errmsg.txt: view name added sql/share/romanian/errmsg.txt: view name added sql/share/russian/errmsg.txt: view name added sql/share/serbian/errmsg.txt: view name added sql/share/slovak/errmsg.txt: view name added sql/share/spanish/errmsg.txt: view name added sql/share/swedish/errmsg.txt: view name added sql/share/ukrainian/errmsg.txt: view name added sql/sql_class.h: view reference saved sql/sql_insert.cc: CHECK OPTION moved to one function sql/sql_update.cc: CHECK OPTION moved to one function sql/sql_view.cc: view name added to error message sql/table.cc: CHECK OPTION moved to one function sql/table.h: CHECK OPTION moved to one function
This commit is contained in:
@ -94,11 +94,12 @@ int mysql_update(THD *thd,
|
||||
ha_rows limit,
|
||||
enum enum_duplicates handle_duplicates)
|
||||
{
|
||||
bool using_limit=limit != HA_POS_ERROR;
|
||||
bool using_limit= limit != HA_POS_ERROR;
|
||||
bool safe_update= thd->options & OPTION_SAFE_UPDATES;
|
||||
bool used_key_is_modified, transactional_table, log_delayed;
|
||||
bool check;
|
||||
bool ignore_err= (thd->lex->duplicates == DUP_IGNORE);
|
||||
int error=0;
|
||||
int res;
|
||||
uint used_index;
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
uint want_privilege;
|
||||
@ -150,7 +151,7 @@ int mysql_update(THD *thd,
|
||||
#endif
|
||||
{
|
||||
thd->lex->select_lex.no_wrap_view_item= 1;
|
||||
int res= setup_fields(thd, 0, table_list, fields, 1, 0, 0);
|
||||
res= setup_fields(thd, 0, table_list, fields, 1, 0, 0);
|
||||
thd->lex->select_lex.no_wrap_view_item= 0;
|
||||
if (res)
|
||||
DBUG_RETURN(-1); /* purecov: inspected */
|
||||
@ -345,7 +346,6 @@ int mysql_update(THD *thd,
|
||||
thd->count_cuted_fields= CHECK_FIELD_WARN; /* calc cuted fields */
|
||||
thd->cuted_fields=0L;
|
||||
thd->proc_info="Updating";
|
||||
check= (table_list->check_option != 0);
|
||||
query_id=thd->query_id;
|
||||
|
||||
while (!(error=info.read_record(&info)) && !thd->killed)
|
||||
@ -355,25 +355,21 @@ int mysql_update(THD *thd,
|
||||
store_record(table,record[1]);
|
||||
if (fill_record(fields,values, 0) || thd->net.report_error)
|
||||
break; /* purecov: inspected */
|
||||
if (check && table_list->check_option->val_int() == 0)
|
||||
{
|
||||
if (thd->lex->duplicates == DUP_IGNORE)
|
||||
{
|
||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
|
||||
ER_VIEW_CHECK_FAILED, ER(ER_VIEW_CHECK_FAILED));
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
my_error(ER_VIEW_CHECK_FAILED, MYF(0));
|
||||
error=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
found++;
|
||||
if (compare_record(table, query_id))
|
||||
{
|
||||
if ((res= table_list->view_check_option(thd, ignore_err)) !=
|
||||
VIEW_CHECK_OK)
|
||||
{
|
||||
found--;
|
||||
if (res == VIEW_CHECK_SKIP)
|
||||
continue;
|
||||
else if (res == VIEW_CHECK_ERROR)
|
||||
{
|
||||
error= 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!(error=table->file->update_row((byte*) table->record[1],
|
||||
(byte*) table->record[0])))
|
||||
{
|
||||
@ -974,6 +970,7 @@ multi_update::~multi_update()
|
||||
bool multi_update::send_data(List<Item> ¬_used_values)
|
||||
{
|
||||
TABLE_LIST *cur_table;
|
||||
bool ignore_err= (thd->lex->duplicates == DUP_IGNORE);
|
||||
DBUG_ENTER("multi_update::send_data");
|
||||
|
||||
for (cur_table= update_tables; cur_table; cur_table= cur_table->next_local)
|
||||
@ -1002,26 +999,19 @@ bool multi_update::send_data(List<Item> ¬_used_values)
|
||||
store_record(table,record[1]);
|
||||
if (fill_record(*fields_for_table[offset], *values_for_table[offset], 0))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
if (cur_table->check_option && cur_table->check_option->val_int() == 0)
|
||||
{
|
||||
if (thd->lex->duplicates == DUP_IGNORE)
|
||||
{
|
||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
|
||||
ER_VIEW_CHECK_FAILED, ER(ER_VIEW_CHECK_FAILED));
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
my_error(ER_VIEW_CHECK_FAILED, MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
}
|
||||
|
||||
found++;
|
||||
if (compare_record(table, thd->query_id))
|
||||
{
|
||||
int error;
|
||||
if ((error= cur_table->view_check_option(thd, ignore_err)) !=
|
||||
VIEW_CHECK_OK)
|
||||
{
|
||||
found--;
|
||||
if (error == VIEW_CHECK_SKIP)
|
||||
continue;
|
||||
else if (error == VIEW_CHECK_ERROR)
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
if (!updated++)
|
||||
{
|
||||
/*
|
||||
|
Reference in New Issue
Block a user