From 0365e2d3dceccb1dc3727336e1596869e3c1a180 Mon Sep 17 00:00:00 2001 From: unknown <monty@donna.mysql.com> Date: Tue, 16 Jan 2001 06:02:05 +0200 Subject: Removed not used variable 'last_ref' Fixed problem with negative DECIMAL() keys Fixed some bugs with NULL keys in BDB More mysql-test tests Docs/manual.texi: Changelog client/mysqltest.c: Added syntax: -- error #,#,... heap/hp_info.c: cleanup include/thr_lock.h: cleanup isam/pack_isam.c: cleanup myisam/mi_check.c: cleanup myisam/mi_extra.c: cleanup myisammrg/myrg_rkey.c: cleanup mysql-test/mysql-test-run.sh: Change to run test as root mysql-test/r/bdb.result: Many new tests mysql-test/r/func_system.result: Change to root user mysql-test/t/bdb.test: many more tests mysql-test/t/create.test: Change to work by test and root user sql/field.cc: Fixed problem with negative DECIMAL() keys sql/filesort.cc: cleanup sql/ha_berkeley.cc: Added purecoverage notes Fixed some bugs with NULL keys sql/init.cc: cleanup sql/mysql_priv.h: cleanup sql/mysqld.cc: cleanup sql/records.cc: cleanup sql/unireg.h: cleanup --- sql/field.cc | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'sql/field.cc') diff --git a/sql/field.cc b/sql/field.cc index 67f93532e99..1c6aa32e167 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -597,24 +597,23 @@ String *Field_decimal::val_str(String *val_buffer __attribute__((unused)), int Field_decimal::cmp(const char *a_ptr,const char *b_ptr) { const char *end; + int swap=0; /* First remove prefixes '0', ' ', and '-' */ for (end=a_ptr+field_length; a_ptr != end && (*a_ptr == *b_ptr || ((isspace(*a_ptr) || *a_ptr == '+' || *a_ptr == '0') && (isspace(*b_ptr) || *b_ptr == '+' || *b_ptr == '0'))); - a_ptr++,b_ptr++) ; - + a_ptr++,b_ptr++) + { + if (*a_ptr == '-') // If both numbers are negative + swap= -1 ^ 1; // Swap result + } if (a_ptr == end) return 0; - int swap=0; if (*a_ptr == '-') - { - if (*b_ptr != '-') - return -1; - swap= -1 ^ 1; // Swap result - a_ptr++, b_ptr++; - } else if (*b_ptr == '-') + return -1; + else if (*b_ptr == '-') return 1; while (a_ptr != end) -- cgit v1.2.1