diff options
author | unknown <sergefp@mysql.com> | 2004-03-15 23:11:58 +0300 |
---|---|---|
committer | unknown <sergefp@mysql.com> | 2004-03-15 23:11:58 +0300 |
commit | 6022c31a262881fecc4cd837a41e036489aab8f5 (patch) | |
tree | d85a3505c5e26ff45f5a5c075bfd90b67ac8465c /sql | |
parent | 857b59578c61a15b842f30c1a9b1e0fad8c868a3 (diff) | |
download | mariadb-git-6022c31a262881fecc4cd837a41e036489aab8f5.tar.gz |
Fix for Bug#3183
Diffstat (limited to 'sql')
-rw-r--r-- | sql/opt_range.h | 9 | ||||
-rw-r--r-- | sql/sql_delete.cc | 7 | ||||
-rw-r--r-- | sql/sql_update.cc | 4 |
3 files changed, 20 insertions, 0 deletions
diff --git a/sql/opt_range.h b/sql/opt_range.h index 1e5f58bc1f5..3c528719b29 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -87,7 +87,16 @@ public: QUICK_SELECT_I(); virtual ~QUICK_SELECT_I(){}; + /* + Call init() immediately after creation of quick select. if init() call + fails, reset() or get_next() must not be called. + */ virtual int init() = 0; + + /* + Call reset() before first get_next call. get_next must not be called if + reset() call fails. + */ virtual int reset(void) = 0; virtual int get_next() = 0; /* get next record to retrieve */ virtual bool reverse_sorted() = 0; diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 1fa216fdb58..7ebe9cb6002 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -150,6 +150,13 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order, select= 0; } + /* If quick select is used, initialize it before retrieving rows. */ + if (select && select->quick && select->quick->reset()) + { + delete select; + free_underlaid_joins(thd, &thd->lex->select_lex); + DBUG_RETURN(-1); // This will force out message + } init_read_record(&info,thd,table,select,1,1); deleted=0L; init_ftfuncs(thd, &thd->lex->select_lex, 1); diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 03ab3d01c1a..24199df9b84 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -246,7 +246,11 @@ int mysql_update(THD *thd, 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; init_read_record(&info,thd,table,select,0,1); + thd->proc_info="Searching rows for update"; uint tmp_limit= limit; |