1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

CHECK OPTIONs added (WL#1983)

include/mysqld_error.h:
  new error messages
mysql-test/r/view.result:
  test of CHECK OPTION in a views
mysql-test/t/view.test:
  test of CHECK OPTION in a views
sql/share/czech/errmsg.txt:
  new error messages
sql/share/danish/errmsg.txt:
  new error messages
sql/share/dutch/errmsg.txt:
  new error messages
sql/share/english/errmsg.txt:
  new error messages
sql/share/estonian/errmsg.txt:
  new error messages
sql/share/french/errmsg.txt:
  new error messages
sql/share/german/errmsg.txt:
  new error messages
sql/share/greek/errmsg.txt:
  new error messages
sql/share/hungarian/errmsg.txt:
  new error messages
sql/share/italian/errmsg.txt:
  new error messages
sql/share/japanese/errmsg.txt:
  new error messages
sql/share/korean/errmsg.txt:
  new error messages
sql/share/norwegian-ny/errmsg.txt:
  new error messages
sql/share/norwegian/errmsg.txt:
  new error messages
sql/share/polish/errmsg.txt:
  new error messages
sql/share/portuguese/errmsg.txt:
  new error messages
sql/share/romanian/errmsg.txt:
  new error messages
sql/share/russian/errmsg.txt:
  new error messages
sql/share/serbian/errmsg.txt:
  new error messages
sql/share/slovak/errmsg.txt:
  new error messages
sql/share/spanish/errmsg.txt:
  new error messages
sql/share/swedish/errmsg.txt:
  new error messages
sql/share/ukrainian/errmsg.txt:
  new error messages
sql/sql_insert.cc:
  CHECK OPTIONs added
sql/sql_lex.h:
  CHECK OPTIONs added
sql/sql_update.cc:
  CHECK OPTIONs added
sql/sql_view.cc:
  new parameter added
  returnrd values fixed
sql/sql_yacc.yy:
  CHECK OPTIONs added
sql/table.cc:
  CHECK OPTIONs added
sql/table.h:
  CHECK OPTIONs added
This commit is contained in:
unknown
2004-09-03 15:18:40 +03:00
parent 2c3f49a64d
commit 704fb6daf7
33 changed files with 336 additions and 33 deletions

View File

@ -97,6 +97,7 @@ int mysql_update(THD *thd,
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;
int error=0;
uint used_index;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
@ -344,6 +345,7 @@ 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)
@ -353,6 +355,22 @@ 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))
{
@ -984,6 +1002,22 @@ bool multi_update::send_data(List<Item> &not_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))
{