summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@donna.mysql.fi>2001-03-24 20:15:43 +0200
committerunknown <monty@donna.mysql.fi>2001-03-24 20:15:43 +0200
commita032242b883ab2697ea3a69b2b3650247dfea1b2 (patch)
treedcddbd402a683ce61a6997970ad0d1b973fb2272 /sql
parent359b812db77f6e97e8a72467af1575fef912d7b5 (diff)
parent13a57d19d11333f4fd255725f91256c155b90a12 (diff)
downloadmariadb-git-a032242b883ab2697ea3a69b2b3650247dfea1b2.tar.gz
Merge work:/home/bk/mysql into donna.mysql.fi:/home/my/bk/mysql
BitKeeper/etc/logging_ok: auto-union Docs/manual.texi: Auto merged
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_innobase.cc12
-rw-r--r--sql/sql_select.cc6
2 files changed, 14 insertions, 4 deletions
diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc
index b36d1ca1ffc..d509e696806 100644
--- a/sql/ha_innobase.cc
+++ b/sql/ha_innobase.cc
@@ -917,6 +917,7 @@ innobase_mysql_cmp(
not UNIV_SQL_NULL */
{
enum_field_types mysql_tp;
+ int ret;
dbug_assert(a_length != UNIV_SQL_NULL);
dbug_assert(b_length != UNIV_SQL_NULL);
@@ -927,8 +928,15 @@ innobase_mysql_cmp(
case FIELD_TYPE_STRING:
case FIELD_TYPE_VAR_STRING:
- return(my_sortncmp((const char*) a, a_length,
- (const char*) b, b_length));
+ ret = my_sortncmp((const char*) a, a_length,
+ (const char*) b, b_length);
+ if (ret < 0) {
+ return(-1);
+ } else if (ret > 0) {
+ return(1);
+ } else {
+ return(0);
+ }
default:
assert(0);
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 1aa6d1b8ff3..720226033e6 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -712,7 +712,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
}
if (tmp_table->distinct)
- select_distinct=0; /* Each row is uniq */
+ select_distinct=0; /* Each row is unique */
join_free(&join); /* Free quick selects */
if (select_distinct && ! group)
@@ -3635,7 +3635,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
in the first 'hidden_null_pack_length' bytes of the row.
*/
null_pack_length-=hidden_null_pack_length;
- keyinfo->key_parts=field_count+ test(null_pack_length);
+ keyinfo->key_parts= ((field_count-hidden_field_count)+
+ test(null_pack_length));
if (allow_distinct_limit)
{
set_if_smaller(table->max_rows,thd->select_limit);
@@ -3673,6 +3674,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
key_part_info->type= HA_KEYTYPE_BINARY;
key_part_info++;
}
+ /* Create a distinct key over the columns we are going to return */
for (i=param->hidden_field_count, reg_field=table->field + i ;
i < field_count;
i++, reg_field++, key_part_info++)