From f193c4927be2dad20a283de5ed65bf2109f2beb0 Mon Sep 17 00:00:00 2001 From: sibel Date: Wed, 4 May 2011 12:28:12 +0200 Subject: myodbc 5.1.8-1 correction port --- extra/myodbc/.md5sum.i686 | 4 + extra/myodbc/.md5sum.x86_64 | 4 + extra/myodbc/Pkgfile | 24 +++- extra/myodbc/myodbc-64bit.patch | 85 ++++++++++++ extra/myodbc/myodbc-add-mysys.patch | 29 +++++ extra/myodbc/myodbc-my-free.patch | 253 ++++++++++++++++++++++++++++++++++++ extra/myodbc/myodbc-shutdown.patch | 27 ++++ 7 files changed, 422 insertions(+), 4 deletions(-) create mode 100644 extra/myodbc/myodbc-64bit.patch create mode 100644 extra/myodbc/myodbc-add-mysys.patch create mode 100644 extra/myodbc/myodbc-my-free.patch create mode 100644 extra/myodbc/myodbc-shutdown.patch (limited to 'extra') diff --git a/extra/myodbc/.md5sum.i686 b/extra/myodbc/.md5sum.i686 index cae1d310e..1fe2395ab 100644 --- a/extra/myodbc/.md5sum.i686 +++ b/extra/myodbc/.md5sum.i686 @@ -1 +1,5 @@ +142a985fa0d3273df04399148ef27533 myodbc-64bit.patch +8d019f9b6a10a6a56d835e7e4e22d215 myodbc-add-mysys.patch +2d1636160af606323014b112c9481cf2 myodbc-my-free.patch +ec43ad7b5c887a7de4b6024899ff886c myodbc-shutdown.patch c64d8cec9de453bdf48fcb168643b943 mysql-connector-odbc-5.1.8.tar.gz diff --git a/extra/myodbc/.md5sum.x86_64 b/extra/myodbc/.md5sum.x86_64 index cae1d310e..1fe2395ab 100644 --- a/extra/myodbc/.md5sum.x86_64 +++ b/extra/myodbc/.md5sum.x86_64 @@ -1 +1,5 @@ +142a985fa0d3273df04399148ef27533 myodbc-64bit.patch +8d019f9b6a10a6a56d835e7e4e22d215 myodbc-add-mysys.patch +2d1636160af606323014b112c9481cf2 myodbc-my-free.patch +ec43ad7b5c887a7de4b6024899ff886c myodbc-shutdown.patch c64d8cec9de453bdf48fcb168643b943 mysql-connector-odbc-5.1.8.tar.gz diff --git a/extra/myodbc/Pkgfile b/extra/myodbc/Pkgfile index 8821cee92..3ba68a1e9 100644 --- a/extra/myodbc/Pkgfile +++ b/extra/myodbc/Pkgfile @@ -8,13 +8,29 @@ name=myodbc version=5.1.8 release=1 -source=(http://mirror.switch.ch/mirror/mysql/Downloads/Connector-ODBC/5.1/mysql-connector-odbc-$version.tar.gz ) +source=(http://mirror.switch.ch/mirror/mysql/Downloads/Connector-ODBC/5.1/mysql-connector-odbc-$version.tar.gz + myodbc-64bit.patch + myodbc-add-mysys.patch + myodbc-my-free.patch + myodbc-shutdown.patch ) build () { cd mysql-connector-odbc-$version - [ $NOEXTRACT -eq 1 ] || ./configure --prefix=/usr --sysconfdir=/etc --with-unixODBC=/usr \ - --with-mysql-path=/usr --without-x --disable-gui --enable-shared \ - --disable-static + + [ $NOEXTRACT -eq 1 ] || patch -p1 < $SRC/myodbc-64bit.patch + [ $NOEXTRACT -eq 1 ] || patch -p1 < $SRC/myodbc-add-mysys.patch + [ $NOEXTRACT -eq 1 ] || patch -p1 < $SRC/myodbc-my-free.patch + [ $NOEXTRACT -eq 1 ] || patch -p1 < $SRC/myodbc-shutdown.patch + + [ $NOEXTRACT -eq 1 ] || CFLAGS=-DTHREAD LDFLAGS=-lmysqld ./configure --prefix=/usr --sysconfdir=/etc --with-unixODBC=/usr \ + --with-mysql-path=/usr --without-samples --enable-thread-safe \ + --without-x --without-qt --disable-gui --enable-shared \ + --disable-static --disable-test + +# [ $NOEXTRACT -eq 1 ] || CFLAGS=-DTHREAD LDFLAGS=-lmysqld ./configure --prefix=/usr \ +# --sysconfdir=/etc --with-unixODBC=/usr \ +# --with-mysql-path=/usr --without-x --disable-gui --enable-shared \ +# --disable-static make make DESTDIR=$PKG install } diff --git a/extra/myodbc/myodbc-64bit.patch b/extra/myodbc/myodbc-64bit.patch new file mode 100644 index 000000000..ac62d816a --- /dev/null +++ b/extra/myodbc/myodbc-64bit.patch @@ -0,0 +1,85 @@ +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 @@ + { + /* See comment for fill_transfer_oct_len_buff()*/ + SQLLEN size= get_display_size(stmt, field); +- sprintf(buff,size == SQL_NO_TOTAL ? "%d" : (sizeof(SQLLEN) == 4 ? "%lu" : "%lld"), size); ++ sprintf(buff, (size == SQL_NO_TOTAL ? "%ld" : "%lu"), size); + + return size; + } +@@ -1228,7 +1228,7 @@ + */ + SQLLEN len= get_transfer_octet_length(stmt, field); + +- sprintf(buff, len == SQL_NO_TOTAL ? "%d" : (sizeof(SQLLEN) == 4 ? "%lu" : "%lld"), len ); ++ sprintf(buff, (len == SQL_NO_TOTAL ? "%ld" : "%lu"), len ); + + return len; + } +@@ -1245,8 +1245,7 @@ + SQLULEN fill_column_size_buff(char *buff, STMT *stmt, MYSQL_FIELD *field) + { + SQLULEN size= get_column_size(stmt, field); +- sprintf(buff, (size== SQL_NO_TOTAL ? "%d" : +- (sizeof(SQLULEN) == 4 ? "%lu" : "%llu")), size); ++ sprintf(buff, (size== SQL_NO_TOTAL ? "%ld" : "%lu"), size); + 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 @@ + fprintf(stdout, "# Column Name : %s\n", szColName); + fprintf(stdout, "# NameLengh : %d\n", pcbColName); + fprintf(stdout, "# DataType : %d\n", pfSqlType); +- fprintf(stdout, "# ColumnSize : %d\n", pcbColDef); ++ fprintf(stdout, "# ColumnSize : %ld\n", pcbColDef); + 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 @@ + + rc = SQLRowCount(hstmt1,&row_count); + mystmt(hstmt1,rc); +- fprintf(stdout, "rows affected: %d\n", row_count); ++ fprintf(stdout, "rows affected: %ld\n", row_count); + myassert(row_count == 1); + + rc = SQLExtendedFetch(hstmt,SQL_FETCH_NEXT,1,NULL,&rgfRowStatus); +@@ -732,7 +732,7 @@ + + rc = SQLRowCount(hstmt1,&row_count); + mystmt(hstmt1,rc); +- fprintf(stdout, "rows affected: %d\n", row_count); ++ fprintf(stdout, "rows affected: %ld\n", row_count); + myassert(row_count == 1); + + SQLFreeStmt(hstmt,SQL_UNBIND); diff --git a/extra/myodbc/myodbc-add-mysys.patch b/extra/myodbc/myodbc-add-mysys.patch new file mode 100644 index 000000000..a30466114 --- /dev/null +++ b/extra/myodbc/myodbc-add-mysys.patch @@ -0,0 +1,29 @@ +Add files extracted from mysql into the driver build script. + + +diff -Naur mysql-connector-odbc-5.1.8.orig/util/Makefile.am mysql-connector-odbc-5.1.8/util/Makefile.am +--- mysql-connector-odbc-5.1.8.orig/util/Makefile.am 2010-10-28 14:33:17.000000000 -0400 ++++ mysql-connector-odbc-5.1.8/util/Makefile.am 2010-12-23 18:09:00.359695597 -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 \ + MYODBCUtilAllocDataSource.c \ + MYODBCUtilAllocDriver.c \ diff --git a/extra/myodbc/myodbc-my-free.patch b/extra/myodbc/myodbc-my-free.patch new file mode 100644 index 000000000..cf7730a59 --- /dev/null +++ b/extra/myodbc/myodbc-my-free.patch @@ -0,0 +1,253 @@ +Once again, mysql can't manage to ship a mysql-connector-odbc release +on time ... mysql 5.5 changed the my_free() function and the released +connector version is not up to speed. Can't use NEAR anymore, either. + + +diff -Naur mysql-connector-odbc-5.1.8.orig/driver/catalog.c mysql-connector-odbc-5.1.8/driver/catalog.c +--- mysql-connector-odbc-5.1.8.orig/driver/catalog.c 2010-10-28 14:33:18.000000000 -0400 ++++ mysql-connector-odbc-5.1.8/driver/catalog.c 2010-12-23 17:50:52.916552525 -0500 +@@ -94,11 +94,11 @@ + { + if (stmt->result) + { +- my_free((char *)stmt->result, MYF(0)); ++ my_free((char *)stmt->result); + } + if (stmt->result_array) + { +- my_free((char *)stmt->result_array, MYF(0)); ++ my_free((char *)stmt->result_array); + } + set_mem_error(&stmt->dbc->mysql); + return handle_connection_error(stmt); +diff -Naur mysql-connector-odbc-5.1.8.orig/driver/catalog_no_i_s.c mysql-connector-odbc-5.1.8/driver/catalog_no_i_s.c +--- mysql-connector-odbc-5.1.8.orig/driver/catalog_no_i_s.c 2010-10-28 14:33:18.000000000 -0400 ++++ mysql-connector-odbc-5.1.8/driver/catalog_no_i_s.c 2010-12-23 17:51:41.493551970 -0500 +@@ -269,13 +269,13 @@ + pthread_mutex_lock(&dbc->lock); + if (mysql_query(mysql, select)) + { +- my_free(select, MYF(0)); ++ my_free(select); + pthread_mutex_unlock(&dbc->lock); + return NULL; + } + result= mysql_store_result(&dbc->mysql); + pthread_mutex_unlock(&dbc->lock); +- my_free(select, MYF(0)); ++ my_free(select); + + return result; + } +@@ -1094,7 +1094,7 @@ + SQLFORE_KEYS_FIELDS * + row_count, + MYF(0)); +- my_free((char *)tempdata, MYF(0)); ++ my_free((char *)tempdata); + + if (!stmt->result_array) + { +@@ -1323,12 +1323,12 @@ + && (j != mypcREMARKS) + && (j != mypcCOLUMN_DEF) + && (j != mypcIS_NULLABLE)) +- my_free(((char**)cur_params->data)[j], MYF(0)); ++ my_free(((char**)cur_params->data)[j]); + } + /* cleanup the list */ + params= list_delete_forward(params); +- my_free(cur_params->data, MYF(0)); +- my_free(cur_params, MYF(0)); ++ my_free(cur_params->data); ++ my_free(cur_params); + } + } + } +@@ -1675,7 +1675,7 @@ + } + + dynstr_free(&dynQuery); +- my_free(params_r, MYF(0)); ++ my_free(params_r); + + return nReturn; + } +diff -Naur mysql-connector-odbc-5.1.8.orig/driver/desc.c mysql-connector-odbc-5.1.8/driver/desc.c +--- mysql-connector-odbc-5.1.8.orig/driver/desc.c 2010-10-28 14:33:18.000000000 -0400 ++++ mysql-connector-odbc-5.1.8/driver/desc.c 2010-12-23 17:51:06.532607921 -0500 +@@ -65,7 +65,7 @@ + */ + if (my_init_dynamic_array(&desc->records, sizeof(DESCREC), 0, 0)) + { +- my_free((char *)desc, MYF(0)); ++ my_free((char *)desc); + return NULL; + } + desc->desc_type= desc_type; +@@ -111,7 +111,7 @@ + if (aprec->par.alloced) + { + aprec->par.alloced= FALSE; +- my_free(aprec->par.value, MYF(0)); ++ my_free(aprec->par.value); + } + } + } +diff -Naur mysql-connector-odbc-5.1.8.orig/driver/driver.h mysql-connector-odbc-5.1.8/driver/driver.h +--- mysql-connector-odbc-5.1.8.orig/driver/driver.h 2010-10-28 14:33:18.000000000 -0400 ++++ mysql-connector-odbc-5.1.8/driver/driver.h 2010-12-23 17:50:43.017608761 -0500 +@@ -113,7 +113,7 @@ + /* Max Primary keys in a cursor * WHERE clause */ + #define MY_MAX_PK_PARTS 32 + +-#define x_free(A) { void *tmp= (A); if (tmp) my_free((char *) tmp,MYF(MY_WME+MY_FAE)); } ++#define x_free(A) { void *tmp= (A); if (tmp) my_free((char *) tmp); } + + + /* We don't make any assumption about what the default may be. */ +diff -Naur mysql-connector-odbc-5.1.8.orig/driver/execute.c mysql-connector-odbc-5.1.8/driver/execute.c +--- mysql-connector-odbc-5.1.8.orig/driver/execute.c 2010-10-28 14:33:18.000000000 -0400 ++++ mysql-connector-odbc-5.1.8/driver/execute.c 2010-12-23 17:49:52.799552481 -0500 +@@ -96,7 +96,7 @@ + exit: + pthread_mutex_unlock(&stmt->dbc->lock); + if ( query != stmt->query ) +- my_free(query,MYF(0)); ++ my_free(query); + + /* + If the original query was modified, we reset stmt->query so that the +@@ -104,7 +104,7 @@ + */ + if (stmt->orig_query) + { +- my_free(stmt->query,MYF(0)); ++ my_free(stmt->query); + stmt->query= stmt->orig_query; + stmt->query_end= stmt->orig_query_end; + stmt->orig_query= NULL; +@@ -625,7 +625,7 @@ + + out: + if (free_data) +- my_free(data, MYF(0)); ++ my_free(data); + + *toptr= to; + return SQL_SUCCESS; +@@ -1060,7 +1060,7 @@ + if ( cbValue == SQL_NULL_DATA ) + { + if ( aprec->par.alloced ) +- my_free(aprec->par.value,MYF(0)); ++ my_free(aprec->par.value); + aprec->par.alloced= FALSE; + aprec->par.value= NULL; + return SQL_SUCCESS; +diff -Naur mysql-connector-odbc-5.1.8.orig/driver/handle.c mysql-connector-odbc-5.1.8/driver/handle.c +--- mysql-connector-odbc-5.1.8.orig/driver/handle.c 2010-10-28 14:33:18.000000000 -0400 ++++ mysql-connector-odbc-5.1.8/driver/handle.c 2010-12-23 17:50:17.425586339 -0500 +@@ -112,7 +112,7 @@ + GlobalUnlock(GlobalHandle((HGLOBAL) henv)); + GlobalFree(GlobalHandle((HGLOBAL) henv)); + #else +- if (henv) my_free((char*) henv,MYF(0)); ++ if (henv) my_free((char*) henv); + myodbc_end(); + #endif /* _UNIX_ */ + return(SQL_SUCCESS); +@@ -251,7 +251,8 @@ + LIST *next; + + dbc->env->connections= list_delete(dbc->env->connections,&dbc->list); +- my_free(dbc->database,MYF(MY_ALLOW_ZERO_PTR)); ++ if (dbc->database) ++ my_free(dbc->database); + if (dbc->ds) + ds_delete(dbc->ds); + pthread_mutex_destroy(&dbc->lock); +@@ -268,7 +269,7 @@ + GlobalUnlock(GlobalHandle((HGLOBAL) hdbc)); + GlobalFree(GlobalHandle((HGLOBAL) hdbc)); + #else +- my_free((char*) hdbc,MYF(0)); ++ my_free((char*) hdbc); + #endif + return SQL_SUCCESS; + } +@@ -513,7 +514,7 @@ + GlobalUnlock(GlobalHandle ((HGLOBAL) hstmt)); + GlobalFree(GlobalHandle((HGLOBAL) hstmt)); + #else +- my_free((char*) hstmt,MYF(0)); ++ my_free((char*) hstmt); + #endif /* _UNIX_*/ + return SQL_SUCCESS; + } +diff -Naur mysql-connector-odbc-5.1.8.orig/driver/options.c mysql-connector-odbc-5.1.8/driver/options.c +--- mysql-connector-odbc-5.1.8.orig/driver/options.c 2010-10-28 14:33:18.000000000 -0400 ++++ mysql-connector-odbc-5.1.8/driver/options.c 2010-12-23 17:50:28.864604596 -0500 +@@ -301,7 +301,7 @@ + return SQL_ERROR; + } + } +- my_free(dbc->database,MYF(0)); ++ my_free(dbc->database); + dbc->database= my_strdup(db,MYF(MY_WME)); + pthread_mutex_unlock(&dbc->lock); + } +diff -Naur mysql-connector-odbc-5.1.8.orig/driver/prepare.c mysql-connector-odbc-5.1.8/driver/prepare.c +--- mysql-connector-odbc-5.1.8.orig/driver/prepare.c 2010-10-28 14:33:18.000000000 -0400 ++++ mysql-connector-odbc-5.1.8/driver/prepare.c 2010-12-23 17:51:17.175676805 -0500 +@@ -93,7 +93,7 @@ + CLEAR_STMT_ERROR(stmt); + + if (stmt->query) +- my_free(stmt->query, MYF(0)); ++ my_free(stmt->query); + + if (dupe && szSqlStr) + stmt->query= (char *)szSqlStr; +@@ -223,7 +223,7 @@ + { + aprec->par.alloced= FALSE; + assert(aprec->par.value); +- my_free(aprec->par.value,MYF(0)); ++ my_free(aprec->par.value); + aprec->par.value = NULL; + } + +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:49:05.498552376 -0500 +@@ -930,7 +930,7 @@ + ulong max_length= stmt->stmt_options.max_length; + ulong *offset= &stmt->getdata.src_offset; + #if MYSQL_VERSION_ID >= 40100 +- char NEAR _dig_vec[] = ++ char _dig_vec[] = + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + #endif + +@@ -2154,7 +2154,7 @@ + + my_bool reget_current_catalog(DBC FAR *dbc) + { +- my_free(dbc->database,MYF(0)); ++ my_free(dbc->database); + dbc->database= NULL; + + if ( odbc_stmt(dbc, "select database()") ) +diff -Naur mysql-connector-odbc-5.1.8.orig/util/stringutil.h mysql-connector-odbc-5.1.8/util/stringutil.h +--- mysql-connector-odbc-5.1.8.orig/util/stringutil.h 2010-10-28 14:33:17.000000000 -0400 ++++ mysql-connector-odbc-5.1.8/util/stringutil.h 2010-12-23 17:51:51.848676475 -0500 +@@ -41,7 +41,7 @@ + #include + + #ifndef x_free +-#define x_free(A) { void *tmp= (A); if (tmp) my_free((char *) tmp,MYF(MY_WME+MY_FAE)); } ++#define x_free(A) { void *tmp= (A); if (tmp) my_free((char *) tmp); } + #endif + + #define myodbc_min(a, b) ((a) < (b) ? (a) : (b)) diff --git a/extra/myodbc/myodbc-shutdown.patch b/extra/myodbc/myodbc-shutdown.patch new file mode 100644 index 000000000..ec0cf3d36 --- /dev/null +++ b/extra/myodbc/myodbc-shutdown.patch @@ -0,0 +1,27 @@ +myodbc_end is really only usable during Windows DLL unload, since it's not +connection-specific and not thread-safe either. This bit of brain fade +accounts for our bug #185343 and several bugs filed at mysql.com. + +Furthermore, my_end() isn't exported from libmysqlclient anymore. +Hence, best fix is to turn the function into a no-op. + + +diff -Naur mysql-connector-odbc-5.1.8.orig/driver/dll.c mysql-connector-odbc-5.1.8/driver/dll.c +--- mysql-connector-odbc-5.1.8.orig/driver/dll.c 2010-10-28 14:33:18.000000000 -0400 ++++ mysql-connector-odbc-5.1.8/driver/dll.c 2010-12-23 15:05:49.394608226 -0500 +@@ -94,6 +94,7 @@ + */ + void myodbc_end() + { ++#if 0 + if (!--myodbc_inited) + { + my_free(decimal_point,MYF(0)); +@@ -121,6 +122,7 @@ + my_end(0); + #endif + } ++#endif + } + + -- cgit v1.2.3-70-g09d2