summaryrefslogtreecommitdiff
path: root/sql/sql_update.cc
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2006-02-08 23:53:45 +0300
committerunknown <konstantin@mysql.com>2006-02-08 23:53:45 +0300
commitea6aba52c1919d7cdb1344cc67efe5f89df2006a (patch)
tree7d495dc3bafe88ef93bc51491f32afbb3efca087 /sql/sql_update.cc
parent2dc19ba63c94e3dc4d79e30b9825b6ff03c05ac3 (diff)
parentcf4b6ee4c01ca9e002511ad221872b4182b910fa (diff)
downloadmariadb-git-ea6aba52c1919d7cdb1344cc67efe5f89df2006a.tar.gz
Merge mysql.com:/home/kostja/mysql/tmp_merge
into mysql.com:/home/kostja/mysql/mysql-5.1-merge configure.in: Auto merged include/heap.h: Auto merged libmysql/libmysql.c: Auto merged mysql-test/r/date_formats.result: Auto merged mysql-test/t/date_formats.test: Auto merged sql/ha_heap.cc: Auto merged sql/ha_heap.h: Auto merged sql/item_timefunc.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_select.h: Auto merged storage/heap/hp_create.c: Auto merged storage/ndb/include/mgmapi/mgmapi_config_parameters.h: Auto merged storage/ndb/test/ndbapi/testBlobs.cpp: Auto merged sql/sql_update.cc: Manual merge tests/mysql_client_test.c: SCCS merged
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r--sql/sql_update.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index d6bf01f5a25..b1abf2c0777 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -331,7 +331,6 @@ int mysql_update(THD *thd,
SORT_FIELD *sortorder;
ha_rows examined_rows;
- used_index= MAX_KEY; // For call to init_read_record()
table->sort.io_cache = (IO_CACHE *) my_malloc(sizeof(IO_CACHE),
MYF(MY_FAE | MY_ZEROFILL));
if (!(sortorder=make_unireg_sortorder(order, &length)) ||
@@ -362,7 +361,21 @@ int mysql_update(THD *thd,
if (open_cached_file(&tempfile, mysql_tmpdir,TEMP_PREFIX,
DISK_BUFFER_SIZE, MYF(MY_WME)))
goto err;
-
+
+ /* If quick select is used, initialize it before retrieving rows. */
+ if (select && select->quick && select->quick->reset())
+ goto err;
+
+ /*
+ When we get here, we have one of the following options:
+ A. used_index == MAX_KEY
+ This means we should use full table scan, and start it with
+ init_read_record call
+ B. used_index != MAX_KEY
+ B.1 quick select is used, start the scan with init_read_record
+ B.2 quick select is not used, this is full index scan (with LIMIT)
+ Full index scan must be started with init_read_record_idx
+ */
/* If quick select is used, initialize it before retrieving rows. */
if (select && select->quick && select->quick->reset())
goto err;