summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-04-23 21:52:16 +0300
committerunknown <monty@narttu.mysql.fi>2003-04-23 21:52:16 +0300
commit7032486889f42b3f18b4a0a5be6cb97b74790ea8 (patch)
treeacef6d0c7b21d3c5a8a9cdc9c5f1eb4f1774857b /sql/sql_select.cc
parent35459cb7f38e2f9b56a8d00cbc05c631c7e235f0 (diff)
downloadmariadb-git-7032486889f42b3f18b4a0a5be6cb97b74790ea8.tar.gz
Fixes for valgrind
Added optimzation for clustered index Fixed bug in UPDATE ... ORDER BY Fixed handling of UPDATE ... LIMIT BitKeeper/deleted/.del-.cvsignore~7e29af89a3559f4c: Delete: Images/.cvsignore BitKeeper/deleted/.del-README~d5a4e7ca3a2e87a9: Delete: repl-tests/README BitKeeper/deleted/.del-run-all-tests~4deb6479a13e4568: Delete: repl-tests/run-all-tests BitKeeper/deleted/.del-run.test~3dc5b9bd1e9feea5: Delete: repl-tests/test-repl-alter/run.test BitKeeper/deleted/.del-run.test~4020771cff278f14: Delete: repl-tests/test-bad-query/run.test BitKeeper/deleted/.del-run.test~452f2b66537404a8: Delete: repl-tests/test-dump/run.test BitKeeper/deleted/.del-run.test~b1f0c1f96554df8: Delete: repl-tests/test-auto-inc/run.test BitKeeper/deleted/.del-table-dump-check.master~e13afeb8c79264b5: Delete: repl-tests/test-dump/table-dump-check.master BitKeeper/deleted/.del-table-dump-select.master~744acb955e33f3db: Delete: repl-tests/test-dump/table-dump-select.master BitKeeper/deleted/.del-x.master~29a93ed7956c8693: Delete: repl-tests/test-auto-inc/x.master BitKeeper/deleted/.del-x.master~3b248cbac9abda2b: Delete: repl-tests/test-bad-query/x.master BitKeeper/deleted/.del-foo-dump-master.master~b49ae6bec1e918ee: Delete: repl-tests/test-repl/foo-dump-master.master BitKeeper/deleted/.del-foo-dump-slave.master~f16ed20457d59be9: Delete: repl-tests/test-repl/foo-dump-slave.master BitKeeper/deleted/.del-repl-timestamp.master.reject~3492d2b74b413771: Delete: repl-tests/test-repl-ts/repl-timestamp.master.reject BitKeeper/deleted/.del-repl-timestamp.master~4b7782da5cc13161: Delete: repl-tests/test-repl-ts/repl-timestamp.master BitKeeper/deleted/.del-run.test~a1e32ea1e4253af4: Delete: repl-tests/test-repl/run.test BitKeeper/deleted/.del-run.test~ce5e626c91b760ec: Delete: repl-tests/test-repl-ts/run.test BitKeeper/deleted/.del-sum-wlen-master.master~1a5ea625c79e978: Delete: repl-tests/test-repl/sum-wlen-master.master BitKeeper/deleted/.del-sum-wlen-slave.master~f016d98833433084: Delete: repl-tests/test-repl/sum-wlen-slave.master BitKeeper/deleted/.del-test.master~5829e7b3770179db: Delete: repl-tests/test-repl-alter/test.master BitKeeper/deleted/.del-master-slave.inc~6775f6ae10137c39: Delete: repl-tests/include/master-slave.inc include/my_global.h: Fix for purify/valgrind myisam/mi_info.c: Updated comment mysql-test/r/group_by.result: New test results mysql-test/r/innodb.result: New test results mysql-test/r/join_outer.result: New test results mysql-test/r/multi_update.result: New test results mysql-test/r/null_key.result: New test results mysql-test/r/update.result: New test results mysql-test/t/group_by.test: Added extra explain to 'suspicious' test. mysql-test/t/innodb.test: Added test for UPDATE ... ORDER BY mysql-test/t/join_outer.test: Changed test to be repeatable mysql-test/t/multi_update.test: Slight change of test to catch more bugs mysql-test/t/update.test: Better test for UPDATE ... ORDER BY sql/field.cc: Simple optimization sql/ha_heap.h: Added optimzation for clustered index sql/ha_innodb.cc: Added optimzation for clustered index sql/ha_innodb.h: Added optimzation for clustered index sql/handler.h: Added optimzation for clustered index sql/item_sum.cc: Removed some usage of current_thd sql/mysqld.cc: Fix bug when compiling for purify/valgrind sql/opt_range.cc: Added optimzation for clustered index sql/records.cc: Fixed comment sql/sql_list.h: Fixed comment sql/sql_select.cc: Removed some usage of current_thd sql/sql_select.h: Removed some usage of current_thd sql/sql_union.cc: Removed some usage of current_thd sql/sql_update.cc: Fixed bug in UPDATE ... ORDER BY Fixed handling of UPDATE ... LIMIT support-files/my-huge.cnf.sh: Added default size for query cache support-files/my-large.cnf.sh: Added default size for query cache
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc24
1 files changed, 14 insertions, 10 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 96de43ae55c..14b567b86c5 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1829,7 +1829,7 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
{
ha_rows rec;
double tmp;
- THD *thd= current_thd;
+ THD *thd= join->thd;
if (!rest_tables)
{
@@ -1960,7 +1960,10 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
if (table->quick_keys & ((key_map) 1 << key))
records= (double) table->quick_rows[key];
else
- records= (double) s->records/rec; // quick_range couldn't use key!
+ {
+ /* quick_range couldn't use key! */
+ records= (double) s->records/rec;
+ }
}
else
{
@@ -4306,12 +4309,11 @@ free_tmp_table(THD *thd, TABLE *entry)
* If a HEAP table gets full, create a MyISAM table and copy all rows to this
*/
-bool create_myisam_from_heap(TABLE *table, TMP_TABLE_PARAM *param, int error,
- bool ignore_last_dupp_key_error)
+bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param,
+ int error, bool ignore_last_dupp_key_error)
{
TABLE new_table;
const char *save_proc_info;
- THD *thd=current_thd;
int write_err;
DBUG_ENTER("create_myisam_from_heap");
@@ -5318,7 +5320,8 @@ end_write(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
if (error == HA_ERR_FOUND_DUPP_KEY ||
error == HA_ERR_FOUND_DUPP_UNIQUE)
goto end;
- if (create_myisam_from_heap(table, &join->tmp_table_param, error,1))
+ if (create_myisam_from_heap(join->thd, table, &join->tmp_table_param,
+ error,1))
DBUG_RETURN(-1); // Not a table_is_full error
table->uniques=0; // To ensure rows are the same
}
@@ -5395,7 +5398,8 @@ end_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
copy_funcs(join->tmp_table_param.items_to_copy);
if ((error=table->file->write_row(table->record[0])))
{
- if (create_myisam_from_heap(table, &join->tmp_table_param, error, 0))
+ if (create_myisam_from_heap(join->thd, table, &join->tmp_table_param,
+ error, 0))
DBUG_RETURN(-1); // Not a table_is_full error
/* Change method to update rows */
table->file->index_init(0);
@@ -5489,8 +5493,8 @@ end_write_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
{
if ((error=table->file->write_row(table->record[0])))
{
- if (create_myisam_from_heap(table, &join->tmp_table_param,
- error, 0))
+ if (create_myisam_from_heap(join->thd, table,
+ &join->tmp_table_param, error, 0))
DBUG_RETURN(-1); // Not a table_is_full error
}
else
@@ -6019,7 +6023,7 @@ remove_duplicates(JOIN *join, TABLE *entry,List<Item> &fields, Item *having)
int error;
ulong reclength,offset;
uint field_count;
- THD *thd= current_thd;
+ THD *thd= join->thd;
DBUG_ENTER("remove_duplicates");
entry->reginfo.lock_type=TL_WRITE;