mirror of
https://github.com/php/php-src.git
synced 2026-04-26 01:18:19 +02:00
Fix for Bug #54158 MYSQLND + PDO MySQL requires #define MYSQL_OPT_LOCAL_INFILE
and a bunch of other small preprocessor fixes
This commit is contained in:
@@ -19,6 +19,10 @@ PHP NEWS
|
||||
. Fixed bug #55067 (MySQL doesn't support compression - wrong config option).
|
||||
(Andrey)
|
||||
|
||||
- PDO MySQL driver:
|
||||
. Fixed bug #54158 (MYSQLND+PDO MySQL requires #define MYSQL_OPT_LOCAL_INFILE)
|
||||
(Andrey)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug#52013 (Unable to decompress files in a compressed phar). (Hannes)
|
||||
. Fixed bug#53872 (internal corruption of phar). (Hannes)
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
# define pdo_mysql_init(persistent) mysql_init(NULL)
|
||||
#endif
|
||||
|
||||
#if !HAVE_MYSQL_SQLSTATE && !PDO_USE_MYSQLND
|
||||
#if !defined(HAVE_MYSQL_SQLSTATE) && !defined(PDO_USE_MYSQLND)
|
||||
static const char *pdo_mysql_get_sqlstate(unsigned int my_errno) { /* {{{ */
|
||||
switch (my_errno) {
|
||||
/* import auto-generated case: code */
|
||||
@@ -72,7 +72,7 @@ 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 defined(HAVE_MYSQL_STMT_PREPARE) || defined(PDO_USE_MYSQLND)
|
||||
if (S && S->stmt) {
|
||||
einfo->errcode = mysql_stmt_errno(S->stmt);
|
||||
}
|
||||
@@ -112,8 +112,8 @@ 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 defined(HAVE_MYSQL_SQLSTATE) || defined(PDO_USE_MYSQLND)
|
||||
# if defined(HAVE_MYSQL_STMT_PREPARE) || defined(PDO_USE_MYSQLND)
|
||||
if (S && S->stmt) {
|
||||
strcpy(*pdo_err, mysql_stmt_sqlstate(S->stmt));
|
||||
} else
|
||||
@@ -187,7 +187,7 @@ 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
|
||||
#if defined(HAVE_MYSQL_STMT_PREPARE) || defined(PDO_USE_MYSQLND)
|
||||
char *nsql = NULL;
|
||||
int nsql_len = 0;
|
||||
int ret;
|
||||
@@ -206,7 +206,7 @@ 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
|
||||
#if defined(HAVE_MYSQL_STMT_PREPARE) || defined(PDO_USE_MYSQLND)
|
||||
server_version = mysql_get_server_version(H->server);
|
||||
if (server_version < 40100) {
|
||||
goto fallback;
|
||||
@@ -255,7 +255,7 @@ static int mysql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len,
|
||||
|
||||
if (S->num_params) {
|
||||
S->params_given = 0;
|
||||
#if PDO_USE_MYSQLND
|
||||
#ifdef PDO_USE_MYSQLND
|
||||
S->params = NULL;
|
||||
#else
|
||||
S->params = ecalloc(S->num_params, sizeof(MYSQL_BIND));
|
||||
@@ -296,7 +296,7 @@ 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
|
||||
#if defined(HAVE_MYSQL_NEXT_RESULT) || defined(PDO_USE_MYSQLND)
|
||||
/* MULTI_QUERY support - eat up all unfetched result sets */
|
||||
MYSQL_RES* result;
|
||||
while (mysql_more_results(H->server)) {
|
||||
@@ -461,7 +461,7 @@ static int pdo_mysql_get_attribute(pdo_dbh_t *dbh, long attr, zval *return_value
|
||||
break;
|
||||
case PDO_ATTR_SERVER_INFO: {
|
||||
char *tmp;
|
||||
#if PDO_USE_MYSQLND
|
||||
#ifdef PDO_USE_MYSQLND
|
||||
unsigned int tmp_len;
|
||||
|
||||
if (mysqlnd_stat(H->server, &tmp, &tmp_len) == PASS) {
|
||||
@@ -583,7 +583,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
|
||||
#endif
|
||||
;
|
||||
|
||||
#if PDO_USE_MYSQLND
|
||||
#ifdef PDO_USE_MYSQLND
|
||||
int dbname_len = 0;
|
||||
int password_len = 0;
|
||||
#endif
|
||||
@@ -625,7 +625,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
|
||||
char *default_file = NULL, *default_group = NULL;
|
||||
long compress = 0;
|
||||
#endif
|
||||
#if HAVE_MYSQL_STMT_PREPARE || PDO_USE_MYSLQND
|
||||
#if defined(HAVE_MYSQL_STMT_PREPARE) || defined(PDO_USE_MYSLQND)
|
||||
char *ssl_key = NULL, *ssl_cert = NULL, *ssl_ca = NULL, *ssl_capath = NULL, *ssl_cipher = NULL;
|
||||
#endif
|
||||
H->buffered = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_USE_BUFFERED_QUERY, 1 TSRMLS_CC);
|
||||
@@ -660,7 +660,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
|
||||
{
|
||||
local_infile = 0;
|
||||
}
|
||||
#ifdef MYSQL_OPT_LOCAL_INFILE
|
||||
#if defined(MYSQL_OPT_LOCAL_INFILE) || defined(PDO_USE_MYSQLND)
|
||||
if (mysql_options(H->server, MYSQL_OPT_LOCAL_INFILE, (const char *)&local_infile)) {
|
||||
pdo_mysql_error(dbh);
|
||||
goto cleanup;
|
||||
@@ -668,7 +668,9 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
|
||||
#endif
|
||||
#ifdef MYSQL_OPT_RECONNECT
|
||||
/* since 5.0.3, the default for this option is 0 if not specified.
|
||||
* we want the old behaviour */
|
||||
* we want the old behaviour
|
||||
* mysqlnd doesn't support reconnect, thus we don't have "|| defined(PDO_USE_MYSQLND)"
|
||||
*/
|
||||
{
|
||||
long reconnect = 1;
|
||||
mysql_options(H->server, MYSQL_OPT_RECONNECT, (const char*)&reconnect);
|
||||
@@ -712,7 +714,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if HAVE_MYSQL_STMT_PREPARE || PDO_USE_MYSLQND
|
||||
#if defined(HAVE_MYSQL_STMT_PREPARE) || defined(PDO_USE_MYSLQND)
|
||||
ssl_key = pdo_attr_strval(driver_options, PDO_MYSQL_ATTR_SSL_KEY, NULL TSRMLS_CC);
|
||||
ssl_cert = pdo_attr_strval(driver_options, PDO_MYSQL_ATTR_SSL_CERT, NULL TSRMLS_CC);
|
||||
ssl_ca = pdo_attr_strval(driver_options, PDO_MYSQL_ATTR_SSL_CA, NULL TSRMLS_CC);
|
||||
|
||||
Reference in New Issue
Block a user