mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
A fix (Bug#4898: User privileges depending on ORDER BY Settings of table db)
This commit is contained in:
@ -460,22 +460,30 @@ static ulong get_sort(uint count,...)
|
||||
va_start(args,count);
|
||||
ulong sort=0;
|
||||
|
||||
/* Should not use this function with more than 4 arguments for compare. */
|
||||
DBUG_ASSERT(count <= 4);
|
||||
|
||||
while (count--)
|
||||
{
|
||||
char *str=va_arg(args,char*);
|
||||
uint chars=0,wild=0;
|
||||
char *start, *str= va_arg(args,char*);
|
||||
uint chars= 0;
|
||||
uint wild_pos= 0; /* first wildcard position */
|
||||
|
||||
if (str)
|
||||
if (start= str)
|
||||
{
|
||||
for (; *str ; str++)
|
||||
{
|
||||
if (*str == wild_many || *str == wild_one || *str == wild_prefix)
|
||||
wild++;
|
||||
{
|
||||
wild_pos= str - start + 1;
|
||||
break;
|
||||
}
|
||||
else
|
||||
chars++;
|
||||
}
|
||||
}
|
||||
sort= (sort << 8) + (wild ? 1 : chars ? 2 : 0);
|
||||
sort= (sort << 8) + (wild_pos ? (wild_pos > 127 ? 127 : wild_pos) :
|
||||
(chars ? 128 : 0));
|
||||
}
|
||||
va_end(args);
|
||||
return sort;
|
||||
|
Reference in New Issue
Block a user