summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <igor@rurik.mysql.com>2003-12-11 14:55:48 -0800
committerunknown <igor@rurik.mysql.com>2003-12-11 14:55:48 -0800
commit9570d010d571d62a9cbdc9674606b1f154b4dead (patch)
tree27bbc53533e288c5402000d6358fe6b91ed1eb32 /sql
parent28b1f63aa7f6ed40d68c932cfe33420c12c7347d (diff)
downloadmariadb-git-9570d010d571d62a9cbdc9674606b1f154b4dead.tar.gz
Many files:
Fixed a bug causing a crash for multi-update/multi-delete with impossible where (bug #1860). sql/sql_class.h: Fixed a bug causing a crash for multi-update/multi-delete with impossible where (bug #1860). sql/sql_delete.cc: Fixed a bug causing a crash for multi-update/multi-delete with impossible where (bug #1860). sql/sql_update.cc: Fixed a bug causing a crash for multi-update/multi-delete with impossible where (bug #1860). mysql-test/t/multi_update.test: Fixed a bug causing a crash for multi-update/multi-delete with impossible where (bug #1860). mysql-test/r/multi_update.result: Fixed a bug causing a crash for multi-update/multi-delete with impossible where (bug #1860). BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_class.h3
-rw-r--r--sql/sql_delete.cc6
-rw-r--r--sql/sql_update.cc8
3 files changed, 14 insertions, 3 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 9287a0c8c79..c487e212e24 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -848,6 +848,8 @@ class multi_delete : public select_result
uint num_of_tables;
int error;
bool do_delete, transactional_tables, log_delayed, normal_tables;
+ bool tempfiles_inited;
+
public:
multi_delete(THD *thd, TABLE_LIST *dt, uint num_of_tables);
~multi_delete();
@@ -874,6 +876,7 @@ class multi_update : public select_result
Copy_field *copy_field;
enum enum_duplicates handle_duplicates;
bool do_update, trans_safe, transactional_tables, log_delayed;
+ bool tmp_tables_inited;
public:
multi_update(THD *thd_arg, TABLE_LIST *ut, List<Item> *fields,
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index ee2b720907d..399f237bf2f 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -236,7 +236,8 @@ multi_delete::multi_delete(THD *thd_arg, TABLE_LIST *dt,
uint num_of_tables_arg)
: delete_tables(dt), thd(thd_arg), deleted(0),
num_of_tables(num_of_tables_arg), error(0),
- do_delete(0), transactional_tables(0), log_delayed(0), normal_tables(0)
+ do_delete(0), transactional_tables(0), log_delayed(0), normal_tables(0),
+ tempfiles_inited(0)
{
tempfiles = (Unique **) sql_calloc(sizeof(Unique *) * (num_of_tables-1));
}
@@ -297,6 +298,7 @@ multi_delete::initialize_tables(JOIN *join)
table->file->ref_length,
MEM_STRIP_BUF_SIZE);
}
+ tempfiles_inited= 1;
init_ftfuncs(thd,1);
DBUG_RETURN(thd->fatal_error != 0);
}
@@ -422,6 +424,8 @@ int multi_delete::do_deletes(bool from_send_error)
table_being_deleted = delete_tables;
do_delete= 0;
+ if (!tempfiles_inited)
+ DBUG_RETURN(0);
for (table_being_deleted=table_being_deleted->next;
table_being_deleted ;
table_being_deleted=table_being_deleted->next, counter++)
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index d5034644830..19df0661db3 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -440,7 +440,7 @@ multi_update::multi_update(THD *thd_arg, TABLE_LIST *table_list,
:all_tables(table_list), update_tables(0), thd(thd_arg), tmp_tables(0),
updated(0), found(0), fields(field_list), values(value_list),
table_count(0), copy_field(0), handle_duplicates(handle_duplicates_arg),
- do_update(1), trans_safe(0)
+ do_update(1), trans_safe(0), tmp_tables_inited(0)
{}
@@ -622,6 +622,7 @@ multi_update::initialize_tables(JOIN *join)
DBUG_RETURN(1);
tmp_tables[cnt]->file->extra(HA_EXTRA_WRITE_CACHE);
}
+ tmp_tables_inited= 1;
DBUG_RETURN(0);
}
@@ -819,8 +820,11 @@ int multi_update::do_updates(bool from_send_error)
ha_rows org_updated;
TABLE *table;
DBUG_ENTER("do_updates");
+
- do_update= 0; // Don't retry this function
+ do_update= 0; // Don't retry this function
+ if (!tmp_tables_inited)
+ DBUG_RETURN(0);
for (cur_table= update_tables; cur_table ; cur_table= cur_table->next)
{
table = cur_table->table;