summaryrefslogtreecommitdiff
path: root/sql/sql_delete.cc
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2004-04-10 01:14:32 +0300
committerunknown <bell@sanja.is.com.ua>2004-04-10 01:14:32 +0300
commit77330300b0a205173f0c3f2048739dac4fd5efd9 (patch)
tree9b43a6ee50851ff9a0c1df227464a4eb032802e2 /sql/sql_delete.cc
parenta810fcad2ce9a42646e0d6ec3cc201d459b1f9e1 (diff)
downloadmariadb-git-77330300b0a205173f0c3f2048739dac4fd5efd9.tar.gz
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
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r--sql/sql_delete.cc48
1 files changed, 36 insertions, 12 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index a2f2c4abae4..269633aa709 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -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);
+ }
}