summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorunknown <monty@tik.mysql.fi>2001-05-23 02:40:46 +0300
committerunknown <monty@tik.mysql.fi>2001-05-23 02:40:46 +0300
commit4b799725034bd5f2d7cda76d8a5bcb3b42cb88f3 (patch)
tree22a09c551394dd62383433e28ef919ca86f669b7 /sql/sql_select.cc
parent8ec67661b4327060a12f9888a1179d5161e4b9c4 (diff)
downloadmariadb-git-4b799725034bd5f2d7cda76d8a5bcb3b42cb88f3.tar.gz
Don't write rows in MyISAM tables when using count(distinct)
Don't read MyISAM header when running without locking include/myisam.h: Don't read header when running without locking. myisam/mi_locking.c: Don't update changed flag for temporary files. myisam/mi_open.c: Don't read header when running without locking. myisam/mi_static.c: Don't read header when running without locking. sql/item_sum.cc: Don't write rows in MyISAM tables when using count(distinct) sql/mysqld.cc: Don't read MyISAM header when running without locking. Remove -Sg option. sql/sql_analyse.h: Remove duplicate header. sql/sql_select.cc: Cleaned up prototypes. Don't write rows to count(DISTINCT) MyISAM tables. sql/sql_select.h: Cleaned up prototypes. sql/table.h: A BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 9e6b0b40f29..fcfdd5cb547 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -69,7 +69,7 @@ static COND *remove_eq_conds(COND *cond,Item::cond_result *cond_value);
static bool const_expression_in_where(COND *conds,Item *item, Item **comp_item);
static bool open_tmp_table(TABLE *table);
static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param,
- uint options);
+ ulong options);
static int do_select(JOIN *join,List<Item> *fields,TABLE *tmp_table,
Procedure *proc);
static int sub_select_cache(JOIN *join,JOIN_TAB *join_tab,bool end_of_records);
@@ -3317,7 +3317,7 @@ Field *create_tmp_field(TABLE *table,Item *item, Item::Type type,
TABLE *
create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
ORDER *group, bool distinct, bool save_sum_fields,
- bool allow_distinct_limit, uint select_options)
+ bool allow_distinct_limit, ulong select_options)
{
TABLE *table;
uint i,field_count,reclength,null_count,null_pack_length,
@@ -3759,7 +3759,7 @@ static bool open_tmp_table(TABLE *table)
static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param,
- uint options)
+ ulong options)
{
int error;
MI_KEYDEF keydef;
@@ -3926,6 +3926,12 @@ bool create_myisam_from_heap(TABLE *table, TMP_TABLE_PARAM *param, int error,
goto err1;
table->file->index_end();
table->file->rnd_init();
+ if (table->no_rows)
+ {
+ new_table->file->extra(HA_EXTRA_NO_ROWS);
+ new_table->no_rows=1;
+ }
+
/* copy all old rows */
while (!table->file->rnd_next(new_table.record[1]))
{