johannes                                 Thu, 05 Aug 2010 13:29:44 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=301877

Log:
- Drop (broken) support for libmysql 3.23 and 4.0 from pdo_mysql, see bug #51259

Bug: http://bugs.php.net/51259 (Assigned) PHP 5.3.2 + PDO MySQL not compatible 
with MySQL 4.0
      
Changed paths:
    U   php/php-src/trunk/NEWS
    U   php/php-src/trunk/ext/pdo_mysql/config.m4
    U   php/php-src/trunk/ext/pdo_mysql/mysql_driver.c
    U   php/php-src/trunk/ext/pdo_mysql/mysql_statement.c
    U   php/php-src/trunk/ext/pdo_mysql/php_pdo_mysql_int.h

Modified: php/php-src/trunk/NEWS
===================================================================
--- php/php-src/trunk/NEWS	2010-08-05 13:10:15 UTC (rev 301876)
+++ php/php-src/trunk/NEWS	2010-08-05 13:29:44 UTC (rev 301877)
@@ -86,6 +86,9 @@
     functions. (Kalle)
   . y2k_compliance ini option. (Kalle)

+- Removed support for linking against MySQL client libraries older 4.1 from
+  PDO_mysql. (Johannes)
+
 - Implemented FR #51295 (SQLite3::busyTimeout not existing). (Mark)
 - Implemented FR #48632 (OpenSSL AES support). (yonas dot y
    at gmail dot com, Pierre)

Modified: php/php-src/trunk/ext/pdo_mysql/config.m4
===================================================================
--- php/php-src/trunk/ext/pdo_mysql/config.m4	2010-08-05 13:10:15 UTC (rev 301876)
+++ php/php-src/trunk/ext/pdo_mysql/config.m4	2010-08-05 13:29:44 UTC (rev 301877)
@@ -100,15 +100,15 @@
       AC_MSG_ERROR([Unable to find your mysql installation])
     fi

-    PHP_CHECK_LIBRARY($PDO_MYSQL_LIBNAME, mysql_query,
+    PHP_CHECK_LIBRARY($PDO_MYSQL_LIBNAME, mysql_commit,
     [
       PHP_EVAL_INCLINE($PDO_MYSQL_INCLUDE)
       PHP_EVAL_LIBLINE($PDO_MYSQL_LIBS, PDO_MYSQL_SHARED_LIBADD)
     ],[
       if test "$PHP_ZLIB_DIR" != "no"; then
         PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR, PDO_MYSQL_SHARED_LIBADD)
-        PHP_CHECK_LIBRARY($PDO_MYSQL_LIBNAME, mysql_query, [], [
-          AC_MSG_ERROR([PDO_MYSQL configure failed. Please check config.log for more information.])
+        PHP_CHECK_LIBRARY($PDO_MYSQL_LIBNAME, mysql_commit, [], [
+          AC_MSG_ERROR([PDO_MYSQL configure failed, MySQL 4.1 needed. Please check config.log for more information.])
         ], [
           -L$PHP_ZLIB_DIR/$PHP_LIBDIR -L$PDO_MYSQL_LIB_DIR
         ])
@@ -128,11 +128,6 @@
     ],[
       $PDO_MYSQL_LIBS
     ])
-
-    _SAVE_LIBS=$LIBS
-    LIBS="$LIBS $PDO_MYSQL_LIBS"
-    AC_CHECK_FUNCS([mysql_commit mysql_stmt_prepare mysql_next_result mysql_sqlstate])
-    LIBS=$_SAVE_LIBS
   fi

   ifdef([PHP_CHECK_PDO_INCLUDES],

Modified: php/php-src/trunk/ext/pdo_mysql/mysql_driver.c
===================================================================
--- php/php-src/trunk/ext/pdo_mysql/mysql_driver.c	2010-08-05 13:10:15 UTC (rev 301876)
+++ php/php-src/trunk/ext/pdo_mysql/mysql_driver.c	2010-08-05 13:29:44 UTC (rev 301877)
@@ -42,17 +42,6 @@
 #	define pdo_mysql_init(persistent) mysql_init(NULL)
 #endif

-#if !HAVE_MYSQL_SQLSTATE && !PDO_USE_MYSQLND
-static const char *pdo_mysql_get_sqlstate(unsigned int my_errno) { /* {{{ */
-	switch (my_errno) {
-		/* import auto-generated case: code */
-#include "php_pdo_mysql_sqlstate.h"
-	default: return "HY000";
-	}
-}
-/* }}} */
-#endif
-
 /* {{{ _pdo_mysql_error */
 int _pdo_mysql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int line TSRMLS_DC) /* {{{ */
 {
@@ -72,13 +61,9 @@
 		einfo   = &H->einfo;
 	}

-#if HAVE_MYSQL_STMT_PREPARE || PDO_USE_MYSQLND
 	if (S && S->stmt) {
 		einfo->errcode = mysql_stmt_errno(S->stmt);
-	}
-	else
-#endif
-	{
+	} else {
 		einfo->errcode = mysql_errno(H->server);
 	}

@@ -112,18 +97,11 @@
 		PDO_DBG_RETURN(0);
 	}

-#if HAVE_MYSQL_SQLSTATE || PDO_USE_MYSQLND
-# if HAVE_MYSQL_STMT_PREPARE || PDO_USE_MYSQLND
 	if (S && S->stmt) {
 		strcpy(*pdo_err, mysql_stmt_sqlstate(S->stmt));
-	} else
-# endif
-	{
+	} else {
 		strcpy(*pdo_err, mysql_sqlstate(H->server));
 	}
-#else
-	strcpy(*pdo_err, pdo_mysql_get_sqlstate(einfo->errcode));
-#endif

 	if (!dbh->methods) {
 		PDO_DBG_INF("Throwing exception");
@@ -187,12 +165,10 @@
 {
 	pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
 	pdo_mysql_stmt *S = ecalloc(1, sizeof(pdo_mysql_stmt));
-#if HAVE_MYSQL_STMT_PREPARE || PDO_USE_MYSQLND
 	char *nsql = NULL;
 	int nsql_len = 0;
 	int ret;
 	int server_version;
-#endif

 	PDO_DBG_ENTER("mysql_handle_preparer");
 	PDO_DBG_INF_FMT("dbh=%p", dbh);
@@ -206,7 +182,6 @@
 		goto end;
 	}

-#if HAVE_MYSQL_STMT_PREPARE || PDO_USE_MYSQLND
 	server_version = mysql_get_server_version(H->server);
 	if (server_version < 40100) {
 		goto fallback;
@@ -270,7 +245,6 @@
 	PDO_DBG_RETURN(1);

 fallback:
-#endif
 end:
 	stmt->supports_placeholders = PDO_PLACEHOLDER_NONE;

@@ -296,7 +270,6 @@
 			PDO_DBG_RETURN(H->einfo.errcode ? -1 : 0);
 		} else {

-#if HAVE_MYSQL_NEXT_RESULT || PDO_USE_MYSQLND
 			/* MULTI_QUERY support - eat up all unfetched result sets */
 			MYSQL_RES* result;
 			while (mysql_more_results(H->server)) {
@@ -308,7 +281,6 @@
 					mysql_free_result(result);
 				}
 			}
-#endif
 			PDO_DBG_RETURN((int)c);
 		}
 	}

Modified: php/php-src/trunk/ext/pdo_mysql/mysql_statement.c
===================================================================
--- php/php-src/trunk/ext/pdo_mysql/mysql_statement.c	2010-08-05 13:10:15 UTC (rev 301876)
+++ php/php-src/trunk/ext/pdo_mysql/mysql_statement.c	2010-08-05 13:29:44 UTC (rev 301877)
@@ -59,12 +59,10 @@
 		pefree(S->einfo.errmsg, stmt->dbh->is_persistent);
 		S->einfo.errmsg = NULL;
 	}
-#if HAVE_MYSQL_STMT_PREPARE || PDO_USE_MYSQLND
 	if (S->stmt) {
 		pdo_mysql_stmt_close(S->stmt);
 		S->stmt = NULL;
 	}
-#endif /* HAVE_MYSQL_STMT_PREPARE || PDO_USE_MYSQLND */

 #ifndef PDO_USE_MYSQLND
 	if (S->params) {
@@ -77,9 +75,6 @@
 		efree(S->in_length);
 	}

-#endif /* PDO_USE_MYSQLND */
-
-#ifdef HAVE_MYSQL_STMT_PREPARE
 	if (S->bound_result)
 	{
 		int i;
@@ -91,10 +86,9 @@
 		efree(S->out_null);
 		efree(S->out_length);
 	}
-#endif /* HAVE_MYSQL_STMT_PREPARE */
+#endif


-#if HAVE_MYSQL_NEXT_RESULT || PDO_USE_MYSQLND
 	if (S->H->server) {
 		while (mysql_more_results(S->H->server)) {
 			MYSQL_RES *res;
@@ -107,8 +101,8 @@
 				mysql_free_result(res);
 			}
 		}
-	}
-#endif /* HAVE_MYSQL_NEXT_RESULT || PDO_USE_MYSQLND */
+	}
+
 #if PDO_USE_MYSQLND
 	if (!S->stmt && S->current_data) {
 		mnd_free(S->current_data);
@@ -131,7 +125,7 @@
 }
 /* }}} */

-#ifdef HAVE_MYSQL_STMT_PREPARE
+#ifndef PDO_USE_MYSQLND
 static int pdo_mysql_stmt_execute_prepared_libmysql(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
 {
 	pdo_mysql_stmt *S = stmt->driver_data;
@@ -294,11 +288,9 @@
 	PDO_DBG_ENTER("pdo_mysql_stmt_execute");
 	PDO_DBG_INF_FMT("stmt=%p", S->stmt);

-#if HAVE_MYSQL_STMT_PREPARE || PDO_USE_MYSQLND
 	if (S->stmt) {
 		PDO_DBG_RETURN(pdo_mysql_stmt_execute_prepared(stmt));
 	}
-#endif

 	/* ensure that we free any previous unfetched results */
 	if (S->result) {
@@ -340,7 +332,6 @@

 static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
 {
-#if HAVE_MYSQL_NEXT_RESULT || PDO_USE_MYSQLND
 	pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data;
 	pdo_mysql_db_handle *H = S->H;
 	long row_count;
@@ -402,7 +393,7 @@
 #endif

 /* ensure that we free any previous unfetched results */
-#if HAVE_MYSQL_STMT_PREPARE
+#ifndef PDO_USE_MYSQLND
 	if (S->stmt) {
 		stmt->column_count = (int)mysql_num_fields(S->result);
 		mysql_stmt_free_result(S->stmt);
@@ -442,10 +433,6 @@
 		S->fields = mysql_fetch_fields(S->result);
 		PDO_DBG_RETURN(1);
 	}
-#else
-	strcpy(stmt->error_code, "HYC00");
-	PDO_DBG_RETURN(0);
-#endif /* HAVE_MYSQL_STMT_PREPARE */
 }
 /* }}} */

@@ -468,7 +455,6 @@
 #ifndef PDO_USE_MYSQLND
 	PDO_MYSQL_PARAM_BIND *b;
 #endif
-#if HAVE_MYSQL_STMT_PREPARE || PDO_USE_MYSQLND
 	pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data;

 	PDO_DBG_ENTER("pdo_mysql_stmt_param_hook");
@@ -600,7 +586,7 @@
 			break;
 		}
 	}
-#endif /* HAVE_MYSQL_STMT_PREPARE || PDO_USE_MYSQLND */
+
 	PDO_DBG_RETURN(1);
 }
 /* }}} */
@@ -622,7 +608,6 @@
 		PDO_DBG_RETURN(1);
 	}
 #else
-#	if HAVE_MYSQL_STMT_PREPARE
 	int ret;

 	if (S->stmt) {
@@ -643,7 +628,6 @@

 		PDO_DBG_RETURN(1);
 	}
-#	endif /* HAVE_MYSQL_STMT_PREPARE */
 #endif /* PDO_USE_MYSQLND */

 	if (!S->result) {
@@ -730,15 +714,12 @@
 	}

 	/* With mysqlnd data is stored inside mysqlnd, not S->current_data */
-#if HAVE_MYSQL_STMT_PREPARE || PDO_USE_MYSQLND
 	if (!S->stmt) {
-#endif
 		if (S->current_data == NULL || !S->result) {
 			PDO_DBG_RETURN(0);
 		}
-#if HAVE_MYSQL_STMT_PREPARE || PDO_USE_MYSQLND
 	}
-#endif
+
 	if (colno >= stmt->column_count) {
 		/* error invalid column */
 		PDO_DBG_RETURN(0);
@@ -750,7 +731,7 @@
 		*len = sizeof(zval);
 		PDO_DBG_RETURN(1);
 	}
-#elif HAVE_MYSQL_STMT_PREPARE
+#else
 	if (S->stmt) {
 		if (S->out_null[colno]) {
 			*ptr = NULL;
@@ -768,7 +749,7 @@
 		*len = S->out_length[colno];
 		PDO_DBG_RETURN(1);
 	}
-#endif /* PDO_USE_MYSQLND else HAVE_MYSQL_STMT_PREPARE */
+#endif
 	*ptr = S->current_data[colno];
 	*len = S->current_lengths[colno];
 	PDO_DBG_RETURN(1);
@@ -900,15 +881,12 @@
 		mysql_free_result(S->result);
 		S->result = NULL;
 	}
-#if HAVE_MYSQL_STMT_PREPARE || PDO_USE_MYSQLND
 	if (S->stmt) {
 		int retval;
 		retval = mysql_stmt_free_result(S->stmt);
 		PDO_DBG_RETURN(retval ? 0 : 1);
 	}
-#endif

-#if HAVE_MYSQL_NEXT_RESULT || PDO_USE_MYSQLND
 	while (mysql_more_results(S->H->server)) {
 		MYSQL_RES *res;
 		if (mysql_next_result(S->H->server) != 0) {
@@ -919,7 +897,6 @@
 			mysql_free_result(res);
 		}
 	}
-#endif
 	PDO_DBG_RETURN(1);
 }
 /* }}} */

Modified: php/php-src/trunk/ext/pdo_mysql/php_pdo_mysql_int.h
===================================================================
--- php/php-src/trunk/ext/pdo_mysql/php_pdo_mysql_int.h	2010-08-05 13:10:15 UTC (rev 301876)
+++ php/php-src/trunk/ext/pdo_mysql/php_pdo_mysql_int.h	2010-08-05 13:29:44 UTC (rev 301877)
@@ -124,7 +124,6 @@
 	long			*current_lengths;
 #endif
 	pdo_mysql_error_info einfo;
-#if HAVE_MYSQL_STMT_PREPARE || PDO_USE_MYSQLND
 #if PDO_USE_MYSQLND
 	MYSQLND_STMT 		*stmt;
 #else
@@ -141,7 +140,6 @@
 	unsigned long		*out_length;
 	unsigned int		params_given;
 	unsigned		max_length:1;
-#endif
 } pdo_mysql_stmt;

 extern pdo_driver_t pdo_mysql_driver;
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to