mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
- Drop (broken) support for libmysql 3.23 and 4.0 from pdo_mysql, see bug #51259
This commit is contained in:
parent
3cf5ab9e56
commit
eaad585a2e
5 changed files with 17 additions and 72 deletions
3
NEWS
3
NEWS
|
@ -86,6 +86,9 @@ PHP NEWS
|
|||
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)
|
||||
|
|
|
@ -100,15 +100,15 @@ if test "$PHP_PDO_MYSQL" != "no"; then
|
|||
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 @@ if test "$PHP_PDO_MYSQL" != "no"; then
|
|||
],[
|
||||
$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],
|
||||
|
|
|
@ -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 @@ int _pdo_mysql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int lin
|
|||
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 @@ int _pdo_mysql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int lin
|
|||
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 @@ static int mysql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len,
|
|||
{
|
||||
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 @@ static int mysql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len,
|
|||
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 @@ static int mysql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len,
|
|||
PDO_DBG_RETURN(1);
|
||||
|
||||
fallback:
|
||||
#endif
|
||||
end:
|
||||
stmt->supports_placeholders = PDO_PLACEHOLDER_NONE;
|
||||
|
||||
|
@ -296,7 +270,6 @@ static long mysql_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TSRM
|
|||
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 @@ static long mysql_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TSRM
|
|||
mysql_free_result(result);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
PDO_DBG_RETURN((int)c);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,12 +59,10 @@ static int pdo_mysql_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
|
|||
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 @@ static int pdo_mysql_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
|
|||
efree(S->in_length);
|
||||
}
|
||||
|
||||
#endif /* PDO_USE_MYSQLND */
|
||||
|
||||
#ifdef HAVE_MYSQL_STMT_PREPARE
|
||||
if (S->bound_result)
|
||||
{
|
||||
int i;
|
||||
|
@ -91,10 +86,9 @@ static int pdo_mysql_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
|
|||
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;
|
||||
|
@ -108,7 +102,7 @@ static int pdo_mysql_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
|
|||
}
|
||||
}
|
||||
}
|
||||
#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 @@ static void pdo_mysql_stmt_set_row_count(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
|
|||
}
|
||||
/* }}} */
|
||||
|
||||
#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 @@ static int pdo_mysql_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
|
|||
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_execute(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
|
|||
|
||||
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 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
|
|||
#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 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
|
|||
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 @@ static int pdo_mysql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da
|
|||
#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 @@ static int pdo_mysql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da
|
|||
break;
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_MYSQL_STMT_PREPARE || PDO_USE_MYSQLND */
|
||||
|
||||
PDO_DBG_RETURN(1);
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -622,7 +608,6 @@ static int pdo_mysql_stmt_fetch(pdo_stmt_t *stmt,
|
|||
PDO_DBG_RETURN(1);
|
||||
}
|
||||
#else
|
||||
# if HAVE_MYSQL_STMT_PREPARE
|
||||
int ret;
|
||||
|
||||
if (S->stmt) {
|
||||
|
@ -643,7 +628,6 @@ static int pdo_mysql_stmt_fetch(pdo_stmt_t *stmt,
|
|||
|
||||
PDO_DBG_RETURN(1);
|
||||
}
|
||||
# endif /* HAVE_MYSQL_STMT_PREPARE */
|
||||
#endif /* PDO_USE_MYSQLND */
|
||||
|
||||
if (!S->result) {
|
||||
|
@ -730,15 +714,12 @@ static int pdo_mysql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsig
|
|||
}
|
||||
|
||||
/* 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 @@ static int pdo_mysql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsig
|
|||
*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 @@ static int pdo_mysql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsig
|
|||
*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 @@ static int pdo_mysql_stmt_cursor_closer(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
|
|||
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 @@ static int pdo_mysql_stmt_cursor_closer(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
|
|||
mysql_free_result(res);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
PDO_DBG_RETURN(1);
|
||||
}
|
||||
/* }}} */
|
||||
|
|
|
@ -124,7 +124,6 @@ typedef struct {
|
|||
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 @@ typedef struct {
|
|||
unsigned long *out_length;
|
||||
unsigned int params_given;
|
||||
unsigned max_length:1;
|
||||
#endif
|
||||
} pdo_mysql_stmt;
|
||||
|
||||
extern pdo_driver_t pdo_mysql_driver;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue