mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fix [-Wundef] warning in PDO MySQL extension
This commit is contained in:
parent
db7dc2fa2f
commit
c932cc841a
4 changed files with 24 additions and 24 deletions
|
@ -32,7 +32,7 @@
|
|||
#endif
|
||||
#include "zend_exceptions.h"
|
||||
|
||||
#if defined(PDO_USE_MYSQLND)
|
||||
#ifdef PDO_USE_MYSQLND
|
||||
# define pdo_mysql_init(persistent) mysqlnd_init(MYSQLND_CLIENT_NO_FLAG, persistent)
|
||||
#else
|
||||
# define pdo_mysql_init(persistent) mysql_init(NULL)
|
||||
|
@ -224,7 +224,7 @@ static int mysql_handle_preparer(pdo_dbh_t *dbh, const char *sql, size_t sql_len
|
|||
|
||||
if (S->num_params) {
|
||||
S->params_given = 0;
|
||||
#if defined(PDO_USE_MYSQLND)
|
||||
#ifdef PDO_USE_MYSQLND
|
||||
S->params = NULL;
|
||||
#else
|
||||
S->params = ecalloc(S->num_params, sizeof(MYSQL_BIND));
|
||||
|
@ -444,7 +444,7 @@ static int pdo_mysql_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *return_
|
|||
ZVAL_STRING(return_value, (char *)mysql_get_host_info(H->server));
|
||||
break;
|
||||
case PDO_ATTR_SERVER_INFO: {
|
||||
#if defined(PDO_USE_MYSQLND)
|
||||
#ifdef PDO_USE_MYSQLND
|
||||
zend_string *tmp;
|
||||
|
||||
if (mysqlnd_stat(H->server, &tmp) == PASS) {
|
||||
|
@ -577,7 +577,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options)
|
|||
|CLIENT_MULTI_RESULTS
|
||||
#endif
|
||||
;
|
||||
#if defined(PDO_USE_MYSQLND)
|
||||
#ifdef PDO_USE_MYSQLND
|
||||
size_t dbname_len = 0;
|
||||
size_t password_len = 0;
|
||||
#endif
|
||||
|
@ -610,7 +610,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options)
|
|||
pdo_mysql_error(dbh);
|
||||
goto cleanup;
|
||||
}
|
||||
#if defined(PDO_USE_MYSQLND)
|
||||
#ifdef PDO_USE_MYSQLND
|
||||
if (dbh->is_persistent) {
|
||||
mysqlnd_restart_psession(H->server);
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ static int pdo_mysql_stmt_dtor(pdo_stmt_t *stmt) /* {{{ */
|
|||
}
|
||||
}
|
||||
|
||||
#if PDO_USE_MYSQLND
|
||||
#ifdef PDO_USE_MYSQLND
|
||||
if (!S->stmt && S->current_data) {
|
||||
mnd_free(S->current_data);
|
||||
}
|
||||
|
@ -339,13 +339,13 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt) /* {{{ */
|
|||
{
|
||||
pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data;
|
||||
pdo_mysql_db_handle *H = S->H;
|
||||
#if PDO_USE_MYSQLND
|
||||
#ifdef PDO_USE_MYSQLND
|
||||
zend_long row_count;
|
||||
#endif
|
||||
PDO_DBG_ENTER("pdo_mysql_stmt_next_rowset");
|
||||
PDO_DBG_INF_FMT("stmt=%p", S->stmt);
|
||||
|
||||
#if PDO_USE_MYSQLND
|
||||
#ifdef PDO_USE_MYSQLND
|
||||
if (!H->emulate_prepare) {
|
||||
if (!mysqlnd_stmt_more_results(S->stmt)) {
|
||||
PDO_DBG_RETURN(0);
|
||||
|
@ -416,7 +416,7 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt) /* {{{ */
|
|||
/* No more results */
|
||||
PDO_DBG_RETURN(0);
|
||||
}
|
||||
#if PDO_USE_MYSQLND
|
||||
#ifdef PDO_USE_MYSQLND
|
||||
if (mysql_next_result(H->server) == FAIL) {
|
||||
pdo_mysql_error_stmt(stmt);
|
||||
PDO_DBG_RETURN(0);
|
||||
|
@ -491,7 +491,7 @@ static int pdo_mysql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da
|
|||
parameter = Z_REFVAL(param->parameter);
|
||||
}
|
||||
|
||||
#if PDO_USE_MYSQLND
|
||||
#ifdef PDO_USE_MYSQLND
|
||||
if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_NULL || (Z_TYPE_P(parameter) == IS_NULL)) {
|
||||
mysqlnd_stmt_bind_one_param(S->stmt, param->paramno, parameter, MYSQL_TYPE_NULL);
|
||||
PDO_DBG_RETURN(1);
|
||||
|
@ -537,7 +537,7 @@ static int pdo_mysql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da
|
|||
;
|
||||
}
|
||||
|
||||
#if PDO_USE_MYSQLND
|
||||
#ifdef PDO_USE_MYSQLND
|
||||
/* Is it really correct to check the zval's type? - But well, that's what the old code below does, too */
|
||||
PDO_DBG_INF_FMT("param->parameter->type=%d", Z_TYPE(param->parameter));
|
||||
if (!Z_ISREF(param->parameter)) {
|
||||
|
@ -614,7 +614,7 @@ static int pdo_mysql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da
|
|||
static int pdo_mysql_stmt_fetch(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, zend_long offset) /* {{{ */
|
||||
{
|
||||
pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data;
|
||||
#if PDO_USE_MYSQLND
|
||||
#ifdef PDO_USE_MYSQLND
|
||||
zend_bool fetched_anything;
|
||||
|
||||
PDO_DBG_ENTER("pdo_mysql_stmt_fetch");
|
||||
|
@ -653,14 +653,14 @@ static int pdo_mysql_stmt_fetch(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori
|
|||
strcpy(stmt->error_code, "HY000");
|
||||
PDO_DBG_RETURN(0);
|
||||
}
|
||||
#if PDO_USE_MYSQLND
|
||||
#ifdef PDO_USE_MYSQLND
|
||||
if (!S->stmt && S->current_data) {
|
||||
mnd_free(S->current_data);
|
||||
}
|
||||
#endif /* PDO_USE_MYSQLND */
|
||||
|
||||
if ((S->current_data = mysql_fetch_row(S->result)) == NULL) {
|
||||
#if PDO_USE_MYSQLND
|
||||
#ifdef PDO_USE_MYSQLND
|
||||
if (S->result->unbuf && !S->result->unbuf->eof_reached && mysql_errno(S->H->server)) {
|
||||
#else
|
||||
if (!S->result->eof && mysql_errno(S->H->server)) {
|
||||
|
@ -743,7 +743,7 @@ static int pdo_mysql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, size_
|
|||
/* error invalid column */
|
||||
PDO_DBG_RETURN(0);
|
||||
}
|
||||
#if PDO_USE_MYSQLND
|
||||
#ifdef PDO_USE_MYSQLND
|
||||
if (S->stmt) {
|
||||
Z_TRY_ADDREF(S->stmt->data->result_bind[colno].zv);
|
||||
*ptr = (char*)&S->stmt->data->result_bind[colno].zv;
|
||||
|
|
|
@ -48,7 +48,7 @@ ZEND_DECLARE_MODULE_GLOBALS(pdo_mysql)
|
|||
# ifdef PHP_MYSQL_UNIX_SOCK_ADDR
|
||||
# define PDO_MYSQL_UNIX_ADDR PHP_MYSQL_UNIX_SOCK_ADDR
|
||||
# else
|
||||
# if !PHP_WIN32
|
||||
# ifndef PHP_WIN32
|
||||
# define PDO_MYSQL_UNIX_ADDR "/tmp/mysql.sock"
|
||||
# else
|
||||
# define PDO_MYSQL_UNIX_ADDR NULL
|
||||
|
@ -143,7 +143,7 @@ static PHP_MINIT_FUNCTION(pdo_mysql)
|
|||
static PHP_MSHUTDOWN_FUNCTION(pdo_mysql)
|
||||
{
|
||||
php_pdo_unregister_driver(&pdo_mysql_driver);
|
||||
#if PDO_USE_MYSQLND
|
||||
#ifdef PDO_USE_MYSQLND
|
||||
UNREGISTER_INI_ENTRIES();
|
||||
#endif
|
||||
|
||||
|
@ -169,7 +169,7 @@ static PHP_MINFO_FUNCTION(pdo_mysql)
|
|||
/* }}} */
|
||||
|
||||
|
||||
#if PDO_USE_MYSQLND && PDO_DBG_ENABLED
|
||||
#if defined(PDO_USE_MYSQLND) && PDO_DBG_ENABLED
|
||||
/* {{{ PHP_RINIT_FUNCTION
|
||||
*/
|
||||
static PHP_RINIT_FUNCTION(pdo_mysql)
|
||||
|
@ -245,7 +245,7 @@ zend_module_entry pdo_mysql_module_entry = {
|
|||
pdo_mysql_functions,
|
||||
PHP_MINIT(pdo_mysql),
|
||||
PHP_MSHUTDOWN(pdo_mysql),
|
||||
#if PDO_USE_MYSQLND && PDO_DBG_ENABLED
|
||||
#if defined(PDO_USE_MYSQLND) && PDO_DBG_ENABLED
|
||||
PHP_RINIT(pdo_mysql),
|
||||
PHP_RSHUTDOWN(pdo_mysql),
|
||||
#else
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#ifndef PHP_PDO_MYSQL_INT_H
|
||||
#define PHP_PDO_MYSQL_INT_H
|
||||
|
||||
#if defined(PDO_USE_MYSQLND)
|
||||
#ifdef PDO_USE_MYSQLND
|
||||
# include "ext/mysqlnd/mysqlnd.h"
|
||||
# include "ext/mysqlnd/mysqlnd_libmysql_compat.h"
|
||||
# define PDO_MYSQL_PARAM_BIND MYSQLND_PARAM_BIND
|
||||
|
@ -57,7 +57,7 @@ static inline void PDO_DBG_ENTER(char *func_name) {}
|
|||
|
||||
#endif
|
||||
|
||||
#if defined(PDO_USE_MYSQLND)
|
||||
#ifdef PDO_USE_MYSQLND
|
||||
#include "ext/mysqlnd/mysqlnd_debug.h"
|
||||
#endif
|
||||
|
||||
|
@ -101,7 +101,7 @@ typedef struct {
|
|||
unsigned buffered:1;
|
||||
unsigned emulate_prepare:1;
|
||||
unsigned fetch_table_names:1;
|
||||
#if !PDO_USE_MYSQLND
|
||||
#ifndef PDO_USE_MYSQLND
|
||||
zend_ulong max_buffer_size;
|
||||
#endif
|
||||
|
||||
|
@ -117,13 +117,13 @@ typedef struct {
|
|||
MYSQL_RES *result;
|
||||
const MYSQL_FIELD *fields;
|
||||
MYSQL_ROW current_data;
|
||||
#if PDO_USE_MYSQLND
|
||||
#ifdef PDO_USE_MYSQLND
|
||||
const size_t *current_lengths;
|
||||
#else
|
||||
zend_long *current_lengths;
|
||||
#endif
|
||||
pdo_mysql_error_info einfo;
|
||||
#if PDO_USE_MYSQLND
|
||||
#ifdef PDO_USE_MYSQLND
|
||||
MYSQLND_STMT *stmt;
|
||||
#else
|
||||
MYSQL_STMT *stmt;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue