diff options
author | monty@narttu.mysql.fi <> | 2003-05-19 16:35:49 +0300 |
---|---|---|
committer | monty@narttu.mysql.fi <> | 2003-05-19 16:35:49 +0300 |
commit | dd2b7918cdd5e0e643cff0305542ccd4aa8f1b6b (patch) | |
tree | 6025913cf3d482ba0783bf3420f7341c10cd574a /sql/filesort.cc | |
parent | 524878e9358706ffb5908677c746a9060c66ad32 (diff) | |
parent | fc0df599dc72408419e80a5f1d3e07dc5f0fec88 (diff) | |
download | mariadb-git-dd2b7918cdd5e0e643cff0305542ccd4aa8f1b6b.tar.gz |
Merge with 4.0.13
Diffstat (limited to 'sql/filesort.cc')
-rw-r--r-- | sql/filesort.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc index a3d24cd9242..68b8737bc79 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -494,6 +494,7 @@ static void make_sortkey(register SORTPARAM *param, sort_field != param->end ; sort_field++) { + bool maybe_null=0; if ((field=sort_field->field)) { // Field if (field->maybe_null()) @@ -519,7 +520,7 @@ static void make_sortkey(register SORTPARAM *param, case STRING_RESULT: { CHARSET_INFO *cs=item->charset(); - if (item->maybe_null) + if ((maybe_null=item->maybe_null)) *to++=1; /* All item->str() to use some extra byte for end null.. */ String tmp((char*) to,sort_field->length+4,cs); @@ -567,7 +568,7 @@ static void make_sortkey(register SORTPARAM *param, case INT_RESULT: { longlong value=item->val_int(); - if (item->maybe_null) + if ((maybe_null=item->maybe_null)) *to++=1; /* purecov: inspected */ if (item->null_value) { @@ -601,13 +602,13 @@ static void make_sortkey(register SORTPARAM *param, case REAL_RESULT: { double value=item->val(); - if (item->null_value) + if ((maybe_null=item->null_value)) { bzero((char*) to,sort_field->length+1); to++; break; } - if (item->maybe_null) + if ((maybe_null=item->maybe_null)) *to++=1; change_double_for_sort(value,(byte*) to); break; @@ -621,6 +622,8 @@ static void make_sortkey(register SORTPARAM *param, } if (sort_field->reverse) { /* Revers key */ + if (maybe_null) + to[-1]= ~to[-1]; length=sort_field->length; while (length--) { |