summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorArun Kuruvila <arun.kuruvila@oracle.com>2015-04-28 14:58:01 +0530
committerArun Kuruvila <arun.kuruvila@oracle.com>2015-04-28 14:58:01 +0530
commitc9a38e8698cfb9408e7bf28a75716eb91208ddbd (patch)
treeb469baee02f692d01a9e388bf16b1d074edaf83a /sql
parentc3870e089a0f9ba50adcf17c8795871132e81697 (diff)
parentfdae90dd11b6f1230f66d530f2d213599f58c760 (diff)
downloadmariadb-git-c9a38e8698cfb9408e7bf28a75716eb91208ddbd.tar.gz
Merge branch 'mysql-5.1' into mysql-5.5
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_acl.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 9d47ac7ecf8..e8edd790f39 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1242,7 +1242,8 @@ static ulong get_access(TABLE *form, uint fieldnr, uint *next_field)
/*
Return a number which, if sorted 'desc', puts strings in this order:
no wildcards
- wildcards
+ strings containg wildcards and non-wildcard characters
+ single muilt-wildcard character('%')
empty string
*/
@@ -1259,7 +1260,16 @@ static ulong get_sort(uint count,...)
{
char *start, *str= va_arg(args,char*);
uint chars= 0;
- uint wild_pos= 0; /* first wildcard position */
+ uint wild_pos= 0;
+
+ /*
+ wild_pos
+ 0 if string is empty
+ 1 if string is a single muilt-wildcard
+ character('%')
+ first wildcard position + 1 if string containg wildcards and
+ non-wildcard characters
+ */
if ((start= str))
{
@@ -1270,6 +1280,8 @@ static ulong get_sort(uint count,...)
else if (*str == wild_many || *str == wild_one)
{
wild_pos= (uint) (str - start) + 1;
+ if (!(wild_pos == 1 && *str == wild_many && *(++str) == '\0'))
+ wild_pos++;
break;
}
chars= 128; // Marker that chars existed