summaryrefslogtreecommitdiff
path: root/sql/sql_update.cc
diff options
context:
space:
mode:
authorunknown <serg@serg.mysql.com>2002-10-25 22:07:04 +0000
committerunknown <serg@serg.mysql.com>2002-10-25 22:07:04 +0000
commit7962de4cf303e71600f7ff2beebcb5900ef41f71 (patch)
treea265b1027bdd9f187cbc41ed6c5c709d6793109e /sql/sql_update.cc
parentd51b72cac30e5d02fde6e9c98c3e91716b19ed04 (diff)
parentf5563ddad40e8ab84d457b0e9960ddfdc7faec99 (diff)
downloadmariadb-git-7962de4cf303e71600f7ff2beebcb5900ef41f71.tar.gz
merged
BitKeeper/etc/gone: auto-union BitKeeper/etc/logging_ok: auto-union BitKeeper/deleted/.del-skipkeys~888e38cf95239a33: 'Auto converge rename' Docs/manual.texi: Auto merged libmysqld/lib_sql.cc: Auto merged myisam/ft_boolean_search.c: Auto merged myisam/ft_nlq_search.c: Auto merged myisam/ft_parser.c: Auto merged myisam/ftdefs.h: Auto merged myisam/mi_create.c: Auto merged mysys/my_init.c: Auto merged sql/log.cc: Auto merged sql/log_event.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_update.cc: Auto merged
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r--sql/sql_update.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 83fb6804fe1..e8d4af94640 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -445,7 +445,7 @@ multi_update::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
else
*int_ptr++=counter;
}
- if (!num_updated)
+ if (!num_updated--)
{
net_printf(thd, ER_NOT_SUPPORTED_YET, "SET CLAUSE MUST CONTAIN TABLE.FIELD REFERENCE");
DBUG_RETURN(1);
@@ -455,11 +455,11 @@ multi_update::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
Here, I have to allocate the array of temporary tables
I have to treat a case of num_updated=1 differently in send_data() method.
*/
- if (num_updated > 1)
+ if (num_updated)
{
- tmp_tables = (TABLE **) sql_calloc(sizeof(TABLE *) * (num_updated - 1));
- infos = (COPY_INFO *) sql_calloc(sizeof(COPY_INFO) * (num_updated - 1));
- fields_by_tables = (List_item **)sql_calloc(sizeof(List_item *) * num_updated);
+ tmp_tables = (TABLE **) sql_calloc(sizeof(TABLE *) * num_updated);
+ infos = (COPY_INFO *) sql_calloc(sizeof(COPY_INFO) * num_updated);
+ fields_by_tables = (List_item **)sql_calloc(sizeof(List_item *) * (num_updated + 1));
unsigned int counter;
List<Item> *temp_fields;
for (table_ref=update_tables, counter = 0; table_ref; table_ref=table_ref->next)
@@ -555,7 +555,7 @@ multi_update::~multi_update()
table->time_stamp=save_time_stamps[counter];
}
if (tmp_tables)
- for (uint counter = 0; counter < num_updated-1; counter++)
+ for (uint counter = 0; counter < num_updated; counter++)
if (tmp_tables[counter])
free_tmp_table(thd,tmp_tables[counter]);
}
@@ -567,7 +567,7 @@ bool multi_update::send_data(List<Item> &values)
for (uint counter = 0; counter < fields.elements; counter++)
real_values.pop();
// We have skipped fields ....
- if (num_updated == 1)
+ if (!num_updated)
{
for (table_being_updated=update_tables ;
table_being_updated ;
@@ -688,7 +688,7 @@ void multi_update::send_error(uint errcode,const char *err)
if ((table_being_updated->table->file->has_transactions() &&
table_being_updated == update_tables) || !not_trans_safe)
ha_rollback_stmt(thd);
- else if (do_update && num_updated > 1)
+ else if (do_update && num_updated)
VOID(do_updates(true));
}
@@ -775,7 +775,7 @@ bool multi_update::send_eof()
thd->proc_info="updating the reference tables";
/* Does updates for the last n - 1 tables, returns 0 if ok */
- int error = (num_updated > 1) ? do_updates(false) : 0; /* do_updates returns 0 if success */
+ int error = (num_updated) ? do_updates(false) : 0; /* do_updates returns 0 if success */
/* reset used flags */
#ifndef NOT_USED