Skip to content

Commit c9a38e8

Browse files
author
Arun Kuruvila
committed
Merge branch 'mysql-5.1' into mysql-5.5
2 parents c3870e0 + fdae90d commit c9a38e8

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

sql/sql_acl.cc

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,8 @@ static ulong get_access(TABLE *form, uint fieldnr, uint *next_field)
12421242
/*
12431243
Return a number which, if sorted 'desc', puts strings in this order:
12441244
no wildcards
1245-
wildcards
1245+
strings containg wildcards and non-wildcard characters
1246+
single muilt-wildcard character('%')
12461247
empty string
12471248
*/
12481249

@@ -1259,7 +1260,16 @@ static ulong get_sort(uint count,...)
12591260
{
12601261
char *start, *str= va_arg(args,char*);
12611262
uint chars= 0;
1262-
uint wild_pos= 0; /* first wildcard position */
1263+
uint wild_pos= 0;
1264+
1265+
/*
1266+
wild_pos
1267+
0 if string is empty
1268+
1 if string is a single muilt-wildcard
1269+
character('%')
1270+
first wildcard position + 1 if string containg wildcards and
1271+
non-wildcard characters
1272+
*/
12631273

12641274
if ((start= str))
12651275
{
@@ -1270,6 +1280,8 @@ static ulong get_sort(uint count,...)
12701280
else if (*str == wild_many || *str == wild_one)
12711281
{
12721282
wild_pos= (uint) (str - start) + 1;
1283+
if (!(wild_pos == 1 && *str == wild_many && *(++str) == '\0'))
1284+
wild_pos++;
12731285
break;
12741286
}
12751287
chars= 128; // Marker that chars existed

0 commit comments

Comments
 (0)