summaryrefslogtreecommitdiff
path: root/sql/filesort.cc
diff options
context:
space:
mode:
authorunknown <mskold@mysql.com>2005-02-16 13:13:13 +0100
committerunknown <mskold@mysql.com>2005-02-16 13:13:13 +0100
commit88a2b72ce098c1de65b9f036b192bae348fa4ac8 (patch)
tree7bb7240f5622c5d6dd91c03371fbf9ce51d66591 /sql/filesort.cc
parentc4590730a692f14d9e26baf7cffd9d5c8a81b2e8 (diff)
parenta95183916ef6cfac73adf068030b6f7b110ea9b9 (diff)
downloadmariadb-git-88a2b72ce098c1de65b9f036b192bae348fa4ac8.tar.gz
Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb
into mysql.com:/usr/local/home/marty/MySQL/test/mysql-5.0-ndb sql/filesort.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/sql_select.cc: Auto merged
Diffstat (limited to 'sql/filesort.cc')
-rw-r--r--sql/filesort.cc67
1 files changed, 37 insertions, 30 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc
index d1e3033aab0..14cac5b01db 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -616,20 +616,21 @@ static void make_sortkey(register SORTPARAM *param,
else
{ // Item
Item *item=sort_field->item;
+ maybe_null= item->maybe_null;
switch (sort_field->result_type) {
case STRING_RESULT:
{
CHARSET_INFO *cs=item->collation.collation;
char fill_char= ((cs->state & MY_CS_BINSORT) ? (char) 0 : ' ');
- if ((maybe_null=item->maybe_null))
+ if (maybe_null)
*to++=1;
/* All item->str() to use some extra byte for end null.. */
String tmp((char*) to,sort_field->length+4,cs);
String *res=item->val_str(&tmp);
if (!res)
{
- if (item->maybe_null)
+ if (maybe_null)
bzero((char*) to-1,sort_field->length+1);
else
{
@@ -669,20 +670,22 @@ static void make_sortkey(register SORTPARAM *param,
case INT_RESULT:
{
longlong value=item->val_int();
- if ((maybe_null=item->maybe_null))
+ if (maybe_null)
+ {
*to++=1; /* purecov: inspected */
- if (item->null_value)
- {
- if (item->maybe_null)
- bzero((char*) to-1,sort_field->length+1);
- else
- {
- DBUG_PRINT("warning",
- ("Got null on something that shouldn't be null"));
- bzero((char*) to,sort_field->length);
- }
- break;
- }
+ if (item->null_value)
+ {
+ if (maybe_null)
+ bzero((char*) to-1,sort_field->length+1);
+ else
+ {
+ DBUG_PRINT("warning",
+ ("Got null on something that shouldn't be null"));
+ bzero((char*) to,sort_field->length);
+ }
+ break;
+ }
+ }
#if SIZEOF_LONG_LONG > 4
to[7]= (uchar) value;
to[6]= (uchar) (value >> 8);
@@ -703,15 +706,17 @@ static void make_sortkey(register SORTPARAM *param,
case DECIMAL_RESULT:
{
my_decimal dec_buf, *dec_val= item->val_decimal(&dec_buf);
- if ((maybe_null=item->null_value))
- {
- bzero((char*)to, sort_field->length+1);
- to++;
- break;
- }
- if ((maybe_null=item->maybe_null))
+ if (maybe_null)
+ {
+ if (item->null_value)
+ {
+ bzero((char*)to, sort_field->length+1);
+ to++;
+ break;
+ }
*to++=1;
- my_decimal2binary(E_DEC_FATAL_ERROR, dec_val, (byte*)to,
+ }
+ my_decimal2binary(E_DEC_FATAL_ERROR, dec_val, (char*)to,
item->max_length - (item->decimals ? 1:0),
item->decimals);
break;
@@ -719,14 +724,16 @@ static void make_sortkey(register SORTPARAM *param,
case REAL_RESULT:
{
double value= item->val_real();
- if ((maybe_null=item->null_value))
- {
- bzero((char*) to,sort_field->length+1);
- to++;
- break;
- }
- if ((maybe_null=item->maybe_null))
+ if (maybe_null)
+ {
+ if (item->null_value)
+ {
+ bzero((char*) to,sort_field->length+1);
+ to++;
+ break;
+ }
*to++=1;
+ }
change_double_for_sort(value,(byte*) to);
break;
}