1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

after review PS fixes

sql/item_cmpfunc.cc:
  merged in one if
sql/mysql_priv.h:
  removed unused paremeter of check_one_table_access
  declaration of new function for SP share code
sql/set_var.cc:
  function descriotion added
  unneeded parantses removed
sql/sql_acl.cc:
  new parameter to limit number of checked tables for check_grant
sql/sql_acl.h:
  new parameter to limit number of checked tables for check_grant
sql/sql_delete.cc:
  preparation moved in separate function
sql/sql_insert.cc:
  preparation moved in separate function
sql/sql_lex.cc:
  comment style fixed
  unneeded assignment removed
sql/sql_parse.cc:
  new parameter to limit number of checked tables for check_grant
  table list manipulation removed (because of above)
  new precheck function
sql/sql_prepare.cc:
  function rewrited to shere code with sql_prepare.cc
  flow control fixed
sql/sql_show.cc:
  new parameter to limit number of checked tables for check_grant
sql/sql_update.cc:
  preparation moved in separate function
sql/table.h:
  flag renamed
This commit is contained in:
unknown
2004-04-10 01:14:32 +03:00
parent 2384ed8c01
commit 8ab58393c5
13 changed files with 528 additions and 318 deletions

View File

@ -37,8 +37,6 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
bool using_limit=limit != HA_POS_ERROR;
bool transactional_table, log_delayed, safe_update, const_cond;
ha_rows deleted;
TABLE_LIST *delete_table_list= (TABLE_LIST*)
thd->lex->select_lex.table_list.first;
DBUG_ENTER("mysql_delete");
if ((open_and_lock_tables(thd, table_list)))
@ -47,15 +45,9 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
thd->proc_info="init";
table->map=1;
if (setup_conds(thd, delete_table_list, &conds) ||
setup_ftfuncs(&thd->lex->select_lex))
DBUG_RETURN(-1);
if (find_real_table_in_list(table_list->next,
table_list->db, table_list->real_name))
{
my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->real_name);
DBUG_RETURN(-1);
}
if ((error= mysql_prepare_delete(thd, table_list, &conds)))
DBUG_RETURN(error);
const_cond= (!conds || conds->const_item());
safe_update=test(thd->options & OPTION_SAFE_UPDATES);
@ -242,7 +234,39 @@ cleanup:
send_ok(thd,deleted);
DBUG_PRINT("info",("%d records deleted",deleted));
}
DBUG_RETURN(0);
DBUG_RETURN(0);
}
/*
Prepare items in DELETE statement
SYNOPSIS
mysql_prepare_delete()
thd - thread handler
table_list - global table list
conds - conditions
RETURN VALUE
0 - OK
1 - error (message is sent to user)
-1 - error (message is not sent to user)
*/
int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds)
{
TABLE_LIST *delete_table_list=
(TABLE_LIST*)thd->lex->select_lex.table_list.first;
DBUG_ENTER(" mysql_prepare_delete");
if (setup_conds(thd, delete_table_list, conds) ||
setup_ftfuncs(&thd->lex->select_lex))
DBUG_RETURN(-1);
if (find_real_table_in_list(table_list->next,
table_list->db, table_list->real_name))
{
my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->real_name);
DBUG_RETURN(-1);
}
}