Blame SOURCES/myodbc-movecmpfunc.patch

94c54c
The symbol my_charset_latin1 is not exported, but upstream uses it probably,
94c54c
since they use some weird environment with mysql buildroot. Anyway, it is only
94c54c
used only for case-insensitive comparison of encoding identificators, which
94c54c
should include only ASCII chars. So we really don't need any charset
94c54c
information and can use simple case-insensitive strcmp.
94c54c
94c54c
However, the only function doing that is defined at driver/utility.c so it
94c54c
would be better to move it to util/stringutil.c and have it available as
94c54c
a general purpose function. That's basically what this patch does.
94c54c
94c54c
diff -up mysql-connector-odbc-5.2.4-src/driver/utility.c.p5 mysql-connector-odbc-5.2.4-src/driver/utility.c
94c54c
--- mysql-connector-odbc-5.2.4-src/driver/utility.c.p5	2013-02-25 14:37:53.459350162 +0100
94c54c
+++ mysql-connector-odbc-5.2.4-src/driver/utility.c	2013-02-25 14:37:53.494350161 +0100
94c54c
@@ -2239,33 +2239,6 @@ my_bool reget_current_catalog(DBC FAR *d
94c54c
 
94c54c
 
94c54c
 /*
94c54c
-  @type    : myodbc internal
94c54c
-  @purpose : compare strings without regarding to case
94c54c
-*/
94c54c
-
94c54c
-int myodbc_strcasecmp(const char *s, const char *t)
94c54c
-{
94c54c
-  while (toupper((uchar) *s) == toupper((uchar) *t++))
94c54c
-    if (!*s++)
94c54c
-      return 0;
94c54c
-  return((int) toupper((uchar) s[0]) - (int) toupper((uchar) t[-1]));
94c54c
-}
94c54c
-
94c54c
-
94c54c
-/*
94c54c
-  @type    : myodbc internal
94c54c
-  @purpose : compare strings without regarding to case
94c54c
-*/
94c54c
-
94c54c
-int myodbc_casecmp(const char *s, const char *t, uint len)
94c54c
-{
94c54c
-  while (len-- != 0 && toupper(*s++) == toupper(*t++))
94c54c
-    ;
94c54c
-  return (int)len + 1;
94c54c
-}
94c54c
-
94c54c
-
94c54c
-/*
94c54c
   @type    : myodbc3 internal
94c54c
   @purpose : logs the queries sent to server
94c54c
 */
94c54c
diff -up mysql-connector-odbc-5.2.4-src/util/stringutil.c.p5 mysql-connector-odbc-5.2.4-src/util/stringutil.c
94c54c
--- mysql-connector-odbc-5.2.4-src/util/stringutil.c.p5	2013-01-24 18:43:33.000000000 +0100
94c54c
+++ mysql-connector-odbc-5.2.4-src/util/stringutil.c	2013-02-25 14:38:37.263348956 +0100
94c54c
@@ -905,13 +906,40 @@ static const MY_CSET_OS_NAME charsets[]=
94c54c
 };
94c54c
 
94c54c
 
94c54c
+/*
94c54c
+ *   @type    : myodbc internal
94c54c
+ *   @purpose : compare strings without regarding to case
94c54c
+ */
94c54c
+
94c54c
+int myodbc_strcasecmp(const char *s, const char *t)
94c54c
+{
94c54c
+  while (toupper(*s) == toupper(*t++))
94c54c
+    if (!*s++)
94c54c
+      return 0;
94c54c
+  return((int) toupper(s[0]) - (int) toupper(t[-1]));
94c54c
+}
94c54c
+
94c54c
+
94c54c
+/*
94c54c
+  @type    : myodbc internal
94c54c
+  @purpose : compare strings without regarding to case
94c54c
+*/
94c54c
+
94c54c
+int myodbc_casecmp(const char *s, const char *t, uint len)
94c54c
+{
94c54c
+  while (len-- != 0 && toupper(*s++) == toupper(*t++))
94c54c
+    ;
94c54c
+  return (int)len + 1;
94c54c
+}
94c54c
+
94c54c
+
94c54c
 const char *
94c54c
 my_os_charset_to_mysql_charset(const char *csname)
94c54c
 {
94c54c
   const MY_CSET_OS_NAME *csp;
94c54c
   for (csp= charsets; csp->os_name; ++csp)
94c54c
   {
94c54c
-    if (!my_strcasecmp(&my_charset_latin1, csp->os_name, csname))
94c54c
+    if (!myodbc_strcasecmp(csp->os_name, csname))
94c54c
     {
94c54c
       switch (csp->param)
94c54c
       {
94c54c
diff -up mysql-connector-odbc-5.2.4-src/util/stringutil.h.p5 mysql-connector-odbc-5.2.4-src/util/stringutil.h
94c54c
--- mysql-connector-odbc-5.2.4-src/util/stringutil.h.p5	2013-01-24 18:43:33.000000000 +0100
94c54c
+++ mysql-connector-odbc-5.2.4-src/util/stringutil.h	2013-02-25 14:37:53.498350161 +0100
94c54c
@@ -117,6 +117,8 @@ size_t sqlwcharncat2(SQLWCHAR *dest, con
94c54c
 SQLWCHAR *sqlwcharncpy(SQLWCHAR *dest, const SQLWCHAR *src, size_t n);
94c54c
 
94c54c
 char * myodbc_strlwr(char *target, size_t len);
94c54c
+int myodbc_strcasecmp(const char *s, const char *t);
94c54c
+int myodbc_casecmp(const char *s, const char *t, uint len);
94c54c
 #ifdef __cplusplus
94c54c
 }
94c54c
 #endif