summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-04-27 22:12:08 +0300
committerunknown <monty@mashka.mysql.fi>2003-04-27 22:12:08 +0300
commitf22be777341f53b4deb58851828c0733ab5380bf (patch)
tree9cf8ed6360561508fc24e4f8cc90f56282626854 /sql/field.cc
parent3e90ec6a582ec6a39209c00329ed93a7cc639ded (diff)
downloadmariadb-git-f22be777341f53b4deb58851828c0733ab5380bf.tar.gz
Fixed problem when comparing a key for a multi-byte-character set. (bug 152)
Use 0x.... as strings if 'new' mode. (bug 152) Don't report -max on windows when InnoDB is enabled. (bug 332) Reset current_linfo; This could cause a hang when doing PURGE LOGS. Fix for row numbers in EXPLAIN (bug 322) Fix that USE_FRM works for all table types (bug 97) VC++Files/libmysql/libmysql.dsp: Added new source files myisam/mi_key.c: Fixed problem when comparing a key for a multi-byte-character set. myisam/mi_range.c: Fixed problem when comparing a key for a multi-byte-character set. myisam/mi_rkey.c: Fixed problem when comparing a key for a multi-byte-character set. myisam/mi_search.c: Fixed problem when comparing a key for a multi-byte-character set. myisam/mi_test2.c: Fixed printf statements myisam/myisamdef.h: Fixed problem when comparing a key for a multi-byte-character set. myisam/sort.c: Fixed printf statements mysql-test/r/ctype_latin1_de.result: New test results mysql-test/r/join.result: New test results mysql-test/r/repair.result: New test results mysql-test/r/rpl_alter.result: New test results mysql-test/t/ctype_latin1_de-master.opt: --new is needed to get 0x... strings to work properly mysql-test/t/ctype_latin1_de.test: New test for latin1_de mysql-test/t/repair.test: Test of USE_FRM and HEAP tables sql/field.cc: Fixed problem when comparing a key for a multi-byte-character set. sql/item.cc: Use 0x.... as strings if 'new' mode sql/item.h: Use 0x.... as strings if 'new' mode sql/mysqld.cc: Don't report -max on windows when InnoDB is enabled. sql/sql_analyse.cc: Removed unused variable sql/sql_insert.cc: Removed debug message sql/sql_repl.cc: Reset current_linfo; This could cause a hang when doing PURGE LOGS. sql/sql_select.cc: Fix for row numbers in EXPLAIN sql/sql_table.cc: Fix that USE_FRM works for all table types (without strange errors) sql/sql_yacc.yy: Removed compiler warnings.
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc25
1 files changed, 23 insertions, 2 deletions
diff --git a/sql/field.cc b/sql/field.cc
index eb7d3dc5686..a2663626723 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -162,6 +162,14 @@ static bool test_if_real(const char *str,int length)
}
+static inline uint field_length_without_space(const char *ptr, uint length)
+{
+ const char *end= ptr+length;
+ while (end > ptr && end[-1] == ' ')
+ end--;
+ return (uint) (end-ptr);
+}
+
/****************************************************************************
** Functions for the base classes
** This is an unpacked number.
@@ -3673,8 +3681,21 @@ int Field_string::cmp(const char *a_ptr, const char *b_ptr)
{
if (binary_flag)
return memcmp(a_ptr,b_ptr,field_length);
- else
- return my_sortcmp(a_ptr,b_ptr,field_length);
+#ifdef USE_STRCOLL
+ if (use_strcoll(default_charset_info))
+ {
+ /*
+ We have to remove end space to be able to compare multi-byte-characters
+ like in latin_de 'ae' and 0xe4
+ */
+ uint a_length= field_length_without_space(a_ptr, field_length);
+ uint b_length= field_length_without_space(b_ptr, field_length);
+ return my_strnncoll(default_charset_info,
+ (const uchar*) a_ptr, a_length,
+ (const uchar*) b_ptr, b_length);
+ }
+#endif
+ return my_sortcmp(a_ptr,b_ptr,field_length);
}
void Field_string::sort_string(char *to,uint length)