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