summaryrefslogtreecommitdiff
path: root/sql/strfunc.cc
diff options
context:
space:
mode:
authorunknown <bar@mysql.com>2004-10-25 17:51:26 +0500
committerunknown <bar@mysql.com>2004-10-25 17:51:26 +0500
commit712326d6846ae718bf5c7c5961ec3173bbf29b06 (patch)
tree7a9462068baaf8b0e98b30d9e65951269bac98e5 /sql/strfunc.cc
parent7df41480849074ad0b1a907d244b5d3b41403f32 (diff)
downloadmariadb-git-712326d6846ae718bf5c7c5961ec3173bbf29b06.tar.gz
Bug#6202: ENUMs are not case sensitive even if declared BINARY
Diffstat (limited to 'sql/strfunc.cc')
-rw-r--r--sql/strfunc.cc41
1 files changed, 41 insertions, 0 deletions
diff --git a/sql/strfunc.cc b/sql/strfunc.cc
index d00e57df5a1..ea67a5a4343 100644
--- a/sql/strfunc.cc
+++ b/sql/strfunc.cc
@@ -117,6 +117,47 @@ uint find_type(TYPELIB *lib, const char *find, uint length, bool part_match)
/*
+ Find a string in a list of strings according to collation
+
+ SYNOPSIS
+ find_type2()
+ lib TYPELIB (struct of pointer to values + count)
+ x String to find
+ length String length
+ cs Character set + collation to use for comparison
+
+ NOTES
+
+ RETURN
+ 0 No matching value
+ >0 Offset+1 in typelib for matched string
+*/
+
+uint find_type2(TYPELIB *typelib, const char *x, uint length, CHARSET_INFO *cs)
+{
+ int find,pos,findpos;
+ const char *j;
+ DBUG_ENTER("find_type2");
+ DBUG_PRINT("enter",("x: '%s' lib: 0x%lx",x,typelib));
+
+ if (!typelib->count)
+ {
+ DBUG_PRINT("exit",("no count"));
+ DBUG_RETURN(0);
+ }
+ LINT_INIT(findpos);
+ for (find=0, pos=0 ; (j=typelib->type_names[pos]) ; pos++)
+ {
+ if (!my_strnncoll(cs, (const uchar*) x, length,
+ (const uchar*) j, typelib->type_lengths[pos]))
+ DBUG_RETURN(pos+1);
+ }
+ DBUG_PRINT("exit",("Couldn't find type"));
+ DBUG_RETURN(0);
+} /* find_type */
+
+
+/*
Check if the first word in a string is one of the ones in TYPELIB
SYNOPSIS