1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

After merge fixes

Added more DBUG statements
Ensure that we are comparing end space with BINARY strings
Use 'any_db' instead of '' to mean any database. (For HANDLER command)
Only strip ' ' when comparing CHAR, not other space-like characters (like \t)
This commit is contained in:
monty@mysql.com
2004-02-16 10:03:25 +02:00
parent ce14578909
commit f43093ec0e
101 changed files with 1483 additions and 1031 deletions

View File

@ -699,11 +699,56 @@ void String::qs_append(const char &c)
}
int sortcmp(const String *x,const String *y, CHARSET_INFO *cs)
/*
Compare strings according to collation, without end space.
SYNOPSIS
sortcmp()
s First string
t Second string
cs Collation
NOTE:
Normally this is case sensitive comparison
RETURN
< 0 s < t
0 s == t
> 0 s > t
*/
int sortcmp(const String *s,const String *t, CHARSET_INFO *cs)
{
return cs->coll->strnncollsp(cs,
(unsigned char *) x->ptr(),x->length(),
(unsigned char *) y->ptr(),y->length());
(unsigned char *) s->ptr(),s->length(),
(unsigned char *) t->ptr(),t->length());
}
/*
Compare strings byte by byte. End spaces are also compared.
SYNOPSIS
stringcmp()
s First string
t Second string
NOTE:
Strings are compared as a stream of unsigned chars
RETURN
< 0 s < t
0 s == t
> 0 s > t
*/
int stringcmp(const String *s,const String *t)
{
uint32 s_len=s->length(),t_len=t->length(),len=min(s_len,t_len);
int cmp= memcmp(s->ptr(), t->ptr(), len);
return (cmp) ? cmp : (int) (s_len - t_len);
}