diff --git a/myodbc-64bit.patch b/myodbc-64bit.patch index ac62d81..3e8e1eb 100644 --- a/myodbc-64bit.patch +++ b/myodbc-64bit.patch @@ -1,10 +1,9 @@ Fix some 64-bitness issues arising from unixODBC 2.2.14 changes. - -diff -Naur mysql-connector-odbc-5.1.8.orig/driver/utility.c mysql-connector-odbc-5.1.8/driver/utility.c ---- mysql-connector-odbc-5.1.8.orig/driver/utility.c 2010-10-28 14:33:18.000000000 -0400 -+++ mysql-connector-odbc-5.1.8/driver/utility.c 2010-12-23 17:15:37.516602586 -0500 -@@ -1205,7 +1205,7 @@ +diff -up mysql-connector-odbc-5.2.4-src/driver/utility.c.p3 mysql-connector-odbc-5.2.4-src/driver/utility.c +--- mysql-connector-odbc-5.2.4-src/driver/utility.c.p3 2013-01-24 18:43:33.000000000 +0100 ++++ mysql-connector-odbc-5.2.4-src/driver/utility.c 2013-02-22 13:22:14.142767103 +0100 +@@ -1219,7 +1219,7 @@ SQLLEN fill_display_size_buff(char *buff { /* See comment for fill_transfer_oct_len_buff()*/ SQLLEN size= get_display_size(stmt, field); @@ -13,7 +12,7 @@ diff -Naur mysql-connector-odbc-5.1.8.orig/driver/utility.c mysql-connector-odbc return size; } -@@ -1228,7 +1228,7 @@ +@@ -1242,7 +1242,7 @@ SQLLEN fill_transfer_oct_len_buff(char * */ SQLLEN len= get_transfer_octet_length(stmt, field); @@ -22,7 +21,7 @@ diff -Naur mysql-connector-odbc-5.1.8.orig/driver/utility.c mysql-connector-odbc return len; } -@@ -1245,8 +1245,7 @@ +@@ -1259,8 +1259,7 @@ SQLLEN fill_transfer_oct_len_buff(char * SQLULEN fill_column_size_buff(char *buff, STMT *stmt, MYSQL_FIELD *field) { SQLULEN size= get_column_size(stmt, field); @@ -32,10 +31,10 @@ diff -Naur mysql-connector-odbc-5.1.8.orig/driver/utility.c mysql-connector-odbc return size; } -diff -Naur mysql-connector-odbc-5.1.8.orig/test/my_catalog.c mysql-connector-odbc-5.1.8/test/my_catalog.c ---- mysql-connector-odbc-5.1.8.orig/test/my_catalog.c 2010-10-28 14:33:18.000000000 -0400 -+++ mysql-connector-odbc-5.1.8/test/my_catalog.c 2010-12-23 17:16:26.284605944 -0500 -@@ -599,7 +599,7 @@ +diff -up mysql-connector-odbc-5.2.4-src/test/my_catalog1.c.p3 mysql-connector-odbc-5.2.4-src/test/my_catalog1.c +--- mysql-connector-odbc-5.2.4-src/test/my_catalog1.c.p3 2013-02-22 13:23:30.260761898 +0100 ++++ mysql-connector-odbc-5.2.4-src/test/my_catalog1.c 2013-02-22 13:25:08.554755176 +0100 +@@ -623,7 +623,7 @@ DECLARE_TEST(t_tables_bug) fprintf(stdout, "# Column Name : %s\n", szColName); fprintf(stdout, "# NameLengh : %d\n", pcbColName); fprintf(stdout, "# DataType : %d\n", pfSqlType); @@ -44,28 +43,10 @@ diff -Naur mysql-connector-odbc-5.1.8.orig/test/my_catalog.c mysql-connector-odb fprintf(stdout, "# DecimalDigits : %d\n", pibScale); fprintf(stdout, "# Nullable : %d\n", pfNullable); -@@ -632,7 +632,7 @@ - - rc = SQLGetConnectAttr(hdbc, SQL_ATTR_CURRENT_CATALOG, db, sizeof(db), &len); - mycon(hdbc,rc); -- fprintf(stdout,"current_catalog: %s (%ld)\n", db, len); -+ fprintf(stdout,"current_catalog: %s (%d)\n", db, len); - is_num(len, 4); - is_str(db, "test", 5); - -@@ -653,7 +653,7 @@ - - rc = SQLGetConnectAttr(hdbc, SQL_ATTR_CURRENT_CATALOG, db, 255, &len); - mycon(hdbc,rc); -- fprintf(stdout,"current_catalog: %s (%ld)\n", db, len); -+ fprintf(stdout,"current_catalog: %s (%d)\n", db, len); - is_num(len, 17); - is_str(db, cur_db, 18); - -diff -Naur mysql-connector-odbc-5.1.8.orig/test/my_cursor.c mysql-connector-odbc-5.1.8/test/my_cursor.c ---- mysql-connector-odbc-5.1.8.orig/test/my_cursor.c 2010-10-28 14:33:18.000000000 -0400 -+++ mysql-connector-odbc-5.1.8/test/my_cursor.c 2010-12-23 17:12:16.632676933 -0500 -@@ -711,7 +711,7 @@ +diff -up mysql-connector-odbc-5.2.4-src/test/my_cursor.c.p3 mysql-connector-odbc-5.2.4-src/test/my_cursor.c +--- mysql-connector-odbc-5.2.4-src/test/my_cursor.c.p3 2013-01-24 18:43:33.000000000 +0100 ++++ mysql-connector-odbc-5.2.4-src/test/my_cursor.c 2013-02-22 13:22:16.812766920 +0100 +@@ -711,7 +711,7 @@ DECLARE_TEST(t_pos_datetime_delete1) rc = SQLRowCount(hstmt1,&row_count); mystmt(hstmt1,rc); @@ -74,7 +55,7 @@ diff -Naur mysql-connector-odbc-5.1.8.orig/test/my_cursor.c mysql-connector-odbc myassert(row_count == 1); rc = SQLExtendedFetch(hstmt,SQL_FETCH_NEXT,1,NULL,&rgfRowStatus); -@@ -732,7 +732,7 @@ +@@ -732,7 +732,7 @@ DECLARE_TEST(t_pos_datetime_delete1) rc = SQLRowCount(hstmt1,&row_count); mystmt(hstmt1,rc); diff --git a/myodbc-add-mysys.patch b/myodbc-add-mysys.patch index 6e9c38c..7f1efa5 100644 --- a/myodbc-add-mysys.patch +++ b/myodbc-add-mysys.patch @@ -1,29 +1,31 @@ Add files extracted from mysql into the driver build script. - -diff -Naur mysql-connector-odbc-5.1.9.orig/util/Makefile.am mysql-connector-odbc-5.1.9/util/Makefile.am ---- mysql-connector-odbc-5.1.9.orig/util/Makefile.am 2011-10-04 16:19:00.000000000 -0400 -+++ mysql-connector-odbc-5.1.9/util/Makefile.am 2012-01-10 15:55:26.762427764 -0500 -@@ -10,6 +10,22 @@ - installer.c \ - odbcinstw.c \ - unicode_transcode.c \ -+ array.c \ -+ list.c \ -+ my_alloc.c \ -+ my_malloc.c \ -+ string.c \ -+ int2str.c \ -+ is_prefix.c \ -+ longlong2str.c \ -+ strcend.c \ -+ strend.c \ -+ strfill.c \ -+ strmake.c \ -+ strmov.c \ -+ strxmov.c \ -+ mysys_err.h \ -+ mysys_priv.h \ - MYODBCUtil.h +diff -up mysql-connector-odbc-5.2.4-src/util/CMakeLists.txt.mysys mysql-connector-odbc-5.2.4-src/util/CMakeLists.txt +--- mysql-connector-odbc-5.2.4-src/util/CMakeLists.txt.mysys 2013-01-24 18:43:33.000000000 +0100 ++++ mysql-connector-odbc-5.2.4-src/util/CMakeLists.txt 2013-03-25 19:17:17.320764909 +0100 +@@ -26,7 +26,24 @@ SET(myodbc3u_SRCS stringutil.c + stringutil.h + unicode_transcode.c + installer.c +- installer.h) ++ installer.h ++ array.c ++ list.c ++ my_alloc.c ++ my_malloc.c ++ string.c ++ int2str.c ++ is_prefix.c ++ longlong2str.c ++ strcend.c ++ strend.c ++ strfill.c ++ strmake.c ++ strmov.c ++ strxmov.c ++ mysys_err.h ++ mysys_priv.h ++) - # libmysql lib deps + IF(NOT WIN32) + SET(myodbc3u_SRCS ${myodbc3u_SRCS} diff --git a/myodbc-libname.patch b/myodbc-libname.patch new file mode 100644 index 0000000..987da14 --- /dev/null +++ b/myodbc-libname.patch @@ -0,0 +1,24 @@ +We use only mysqlclient library, but upstream still tends to use mysqlclient_r, +so we need to change the library we link against. + +diff -up mysql-connector-odbc-5.2.4-src/cmake/FindMySQL.cmake.p1 mysql-connector-odbc-5.2.4-src/cmake/FindMySQL.cmake +--- mysql-connector-odbc-5.2.4-src/cmake/FindMySQL.cmake.p1 2013-01-24 18:43:33.000000000 +0100 ++++ mysql-connector-odbc-5.2.4-src/cmake/FindMySQL.cmake 2013-02-25 16:30:07.458164848 +0100 +@@ -64,7 +64,7 @@ IF (WIN32) + $ENV{ProgramFiles}/MySQL/*/lib + $ENV{SystemDrive}/MySQL/*/lib/${libsuffixDist}) + ELSE (WIN32) +- FIND_LIBRARY(MYSQL_LIB NAMES mysqlclient_r ++ FIND_LIBRARY(MYSQL_LIB NAMES mysqlclient + PATHS + $ENV{MYSQL_DIR}/libmysql_r/.libs + $ENV{MYSQL_DIR}/lib +@@ -93,7 +93,7 @@ IF (MYSQL_INCLUDE_DIR AND MYSQL_LIB_DIR) + IF (WIN32) + SET(MYSQL_CLIENT_LIBS mysqlclient) + ELSE (WIN32) +- SET(MYSQL_CLIENT_LIBS mysqlclient_r) ++ SET(MYSQL_CLIENT_LIBS mysqlclient) + ENDIF (WIN32) + IF (MYSQL_ZLIB) + SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} zlib) diff --git a/myodbc-makefile.patch b/myodbc-makefile.patch deleted file mode 100644 index f8f4b46..0000000 --- a/myodbc-makefile.patch +++ /dev/null @@ -1,23 +0,0 @@ -It appears upstream has stopped maintaining the autoconf build files, -even though they still ship 'em. At some point we should probably -switch to the cmake build system, but I don't feel like investing time -in that now. - - -diff -Naur mysql-connector-odbc-5.1.11-src.orig/driver/Makefile.am mysql-connector-odbc-5.1.11-src/driver/Makefile.am ---- mysql-connector-odbc-5.1.11-src.orig/driver/Makefile.am 2012-04-27 18:12:39.000000000 -0400 -+++ mysql-connector-odbc-5.1.11-src/driver/Makefile.am 2012-07-22 20:38:59.494830648 -0400 -@@ -47,10 +47,13 @@ - handle.c\ - info.c \ - options.c \ -+parse.c \ - prepare.c \ - results.c \ - transact.c \ - unicode.c \ -+my_prepared_stmt.c \ -+my_stmt.c \ - utility.c \ - driver.h - diff --git a/myodbc-movecmpfunc.patch b/myodbc-movecmpfunc.patch new file mode 100644 index 0000000..ddca78c --- /dev/null +++ b/myodbc-movecmpfunc.patch @@ -0,0 +1,104 @@ +The symbol my_charset_latin1 is not exported, but upstream uses it probably, +since they use some weird environment with mysql buildroot. Anyway, it is only +used only for case-insensitive comparison of encoding identificators, which +should include only ASCII chars. So we really don't need any charset +information and can use simple case-insensitive strcmp. + +However, the only function doing that is defined at driver/utility.c so it +would be better to move it to util/stringutil.c and have it available as +a general purpose function. That's basically what this patch does. + +diff -up mysql-connector-odbc-5.2.4-src/driver/utility.c.p5 mysql-connector-odbc-5.2.4-src/driver/utility.c +--- mysql-connector-odbc-5.2.4-src/driver/utility.c.p5 2013-02-25 14:37:53.459350162 +0100 ++++ mysql-connector-odbc-5.2.4-src/driver/utility.c 2013-02-25 14:37:53.494350161 +0100 +@@ -2239,33 +2239,6 @@ my_bool reget_current_catalog(DBC FAR *d + + + /* +- @type : myodbc internal +- @purpose : compare strings without regarding to case +-*/ +- +-int myodbc_strcasecmp(const char *s, const char *t) +-{ +- while (toupper((uchar) *s) == toupper((uchar) *t++)) +- if (!*s++) +- return 0; +- return((int) toupper((uchar) s[0]) - (int) toupper((uchar) t[-1])); +-} +- +- +-/* +- @type : myodbc internal +- @purpose : compare strings without regarding to case +-*/ +- +-int myodbc_casecmp(const char *s, const char *t, uint len) +-{ +- while (len-- != 0 && toupper(*s++) == toupper(*t++)) +- ; +- return (int)len + 1; +-} +- +- +-/* + @type : myodbc3 internal + @purpose : logs the queries sent to server + */ +diff -up mysql-connector-odbc-5.2.4-src/util/stringutil.c.p5 mysql-connector-odbc-5.2.4-src/util/stringutil.c +--- mysql-connector-odbc-5.2.4-src/util/stringutil.c.p5 2013-01-24 18:43:33.000000000 +0100 ++++ mysql-connector-odbc-5.2.4-src/util/stringutil.c 2013-02-25 14:38:37.263348956 +0100 +@@ -905,13 +906,40 @@ static const MY_CSET_OS_NAME charsets[]= + }; + + ++/* ++ * @type : myodbc internal ++ * @purpose : compare strings without regarding to case ++ */ ++ ++int myodbc_strcasecmp(const char *s, const char *t) ++{ ++ while (toupper(*s) == toupper(*t++)) ++ if (!*s++) ++ return 0; ++ return((int) toupper(s[0]) - (int) toupper(t[-1])); ++} ++ ++ ++/* ++ @type : myodbc internal ++ @purpose : compare strings without regarding to case ++*/ ++ ++int myodbc_casecmp(const char *s, const char *t, uint len) ++{ ++ while (len-- != 0 && toupper(*s++) == toupper(*t++)) ++ ; ++ return (int)len + 1; ++} ++ ++ + const char * + my_os_charset_to_mysql_charset(const char *csname) + { + const MY_CSET_OS_NAME *csp; + for (csp= charsets; csp->os_name; ++csp) + { +- if (!my_strcasecmp(&my_charset_latin1, csp->os_name, csname)) ++ if (!myodbc_strcasecmp(csp->os_name, csname)) + { + switch (csp->param) + { +diff -up mysql-connector-odbc-5.2.4-src/util/stringutil.h.p5 mysql-connector-odbc-5.2.4-src/util/stringutil.h +--- mysql-connector-odbc-5.2.4-src/util/stringutil.h.p5 2013-01-24 18:43:33.000000000 +0100 ++++ mysql-connector-odbc-5.2.4-src/util/stringutil.h 2013-02-25 14:37:53.498350161 +0100 +@@ -117,6 +117,8 @@ size_t sqlwcharncat2(SQLWCHAR *dest, con + SQLWCHAR *sqlwcharncpy(SQLWCHAR *dest, const SQLWCHAR *src, size_t n); + + char * myodbc_strlwr(char *target, size_t len); ++int myodbc_strcasecmp(const char *s, const char *t); ++int myodbc_casecmp(const char *s, const char *t, uint len); + #ifdef __cplusplus + } + #endif diff --git a/mysql-connector-odbc.spec b/mysql-connector-odbc.spec index 87b1b57..dc3e587 100644 --- a/mysql-connector-odbc.spec +++ b/mysql-connector-odbc.spec @@ -1,7 +1,7 @@ Summary: ODBC driver for MySQL Name: mysql-connector-odbc -Version: 5.1.11 -Release: 3%{?dist} +Version: 5.2.4 +Release: 1%{?dist} Group: System Environment/Libraries URL: http://dev.mysql.com/downloads/connector/odbc/ # exceptions allow library to be linked with most open source SW, @@ -25,11 +25,12 @@ Source1: mysql-mysys.tar.gz Patch1: myodbc-add-mysys.patch Patch2: myodbc-shutdown.patch Patch3: myodbc-64bit.patch -Patch4: myodbc-makefile.patch -Patch5: myodbc-maria.patch +Patch4: myodbc-maria.patch +Patch5: myodbc-movecmpfunc.patch +Patch6: myodbc-libname.patch BuildRequires: mysql-devel unixODBC-devel -BuildRequires: automake autoconf libtool libtool-ltdl-devel +BuildRequires: cmake BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root %description @@ -45,65 +46,56 @@ tar xfz %{SOURCE1} %patch3 -p1 %patch4 -p1 %patch5 -p1 +%patch6 -p1 %build # mysql 5.5.10 has stopped #define'ing THREAD in its exports, and has # started #define'ing MY_PTHREAD_FASTMUTEX, and neither of those changes # sit well with mysql-connector-odbc 5.1.10. Revisit need for these hacks # when updating to newer release. -export CFLAGS="%{optflags} -fno-strict-aliasing -DTHREAD=1 -UMY_PTHREAD_FASTMUTEX" - -libtoolize --copy --force -aclocal -autoheader -automake -a -automake -autoconf - -%configure \ - --disable-gui \ - --with-unixODBC \ - --with-unixODBC-libs=%{_libdir} \ - --with-odbc-ini=/etc/odbc.ini \ - --with-mysql-includes=%{_includedir}/mysql \ - --with-mysql-libs=%{_libdir}/mysql +export CFLAGS="%{optflags} -fno-strict-aliasing -DTHREAD=1 -UMY_PTHREAD_FASTMUTEX -DDBUG_OFF" -export tagname=CC -make LIBTOOL=/usr/bin/libtool %{?_smp_mflags} +cmake . -G "Unix Makefiles" \ + -DWITH_UNIXODBC=1 \ + -DRPM_BUILD=1 \ + -DCMAKE_INSTALL_PREFIX="%{_prefix}" -%install -rm -rf $RPM_BUILD_ROOT +make %{?_smp_mflags} VERBOSE=1 +%install export tagname=CC -make DESTDIR=$RPM_BUILD_ROOT LIBTOOL=/usr/bin/libtool install +make DESTDIR=$RPM_BUILD_ROOT install # Remove stuff not to be packaged (possibly reconsider later) rm -f $RPM_BUILD_ROOT%{_bindir}/myodbc-installer -# we don't want static libraries, thanks -rm -f $RPM_BUILD_ROOT%{_libdir}/libmyodbc5.*a +rm -f $RPM_BUILD_ROOT/usr/COPYING +rm -f $RPM_BUILD_ROOT/usr/README +rm -f $RPM_BUILD_ROOT/usr/README.debug +rm -f $RPM_BUILD_ROOT/usr/ChangeLog +rm -f $RPM_BUILD_ROOT/usr/INSTALL +rm -f $RPM_BUILD_ROOT/usr/Licenses_for_Third-Party_Components.txt -# makefile thinks it should install docs in totally wrong place -rm -f $RPM_BUILD_ROOT/usr/share/mysql-connector-odbc/COPYING -rm -f $RPM_BUILD_ROOT/usr/share/mysql-connector-odbc/README -rm -f $RPM_BUILD_ROOT/usr/share/mysql-connector-odbc/README.debug -rm -f $RPM_BUILD_ROOT/usr/share/mysql-connector-odbc/ChangeLog -rm -f $RPM_BUILD_ROOT/usr/share/mysql-connector-odbc/INSTALL -rm -f $RPM_BUILD_ROOT/usr/share/mysql-connector-odbc/Licenses_for_Third-Party_Components.txt +# Create a symlink for library to offer name that users are used to +ln -sf libmyodbc5w.so $RPM_BUILD_ROOT%{_libdir}/libmyodbc5.so -%clean -rm -rf $RPM_BUILD_ROOT +# Upstream provides a test suite with functional and regression tests. +# However, some tests fail, so it would deserve some more investigation. +# We don't include the test suite until it works fine. +rm -rf $RPM_BUILD_ROOT/usr/test %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files -%defattr(-,root,root) %doc README README.debug ChangeLog COPYING %{_libdir}/lib*so %changelog +* Tue Mar 5 2013 Honza Horak - 5.2.4-1 +- Update to 5.2.4 + * Fri Mar 1 2013 Honza Horak - 5.1.11-3 - Fix data types for mariadb