diff options
Diffstat (limited to 'ext/pdo_mysql/mysql_driver.c')
| -rw-r--r-- | ext/pdo_mysql/mysql_driver.c | 40 |
1 files changed, 3 insertions, 37 deletions
diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c index 07aaa6f6c1..dcad8ef6c7 100644 --- a/ext/pdo_mysql/mysql_driver.c +++ b/ext/pdo_mysql/mysql_driver.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2018 The PHP Group | + | Copyright (c) 1997-2017 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -349,11 +349,7 @@ static int mysql_handle_commit(pdo_dbh_t *dbh) { PDO_DBG_ENTER("mysql_handle_commit"); PDO_DBG_INF_FMT("dbh=%p", dbh); -#if MYSQL_VERSION_ID >= 40100 || defined(PDO_USE_MYSQLND) PDO_DBG_RETURN(0 == mysql_commit(((pdo_mysql_db_handle *)dbh->driver_data)->server)); -#else - PDO_DBG_RETURN(0 <= mysql_handle_doer(dbh, ZEND_STRL("COMMIT"))); -#endif } /* }}} */ @@ -362,11 +358,7 @@ static int mysql_handle_rollback(pdo_dbh_t *dbh) { PDO_DBG_ENTER("mysql_handle_rollback"); PDO_DBG_INF_FMT("dbh=%p", dbh); -#if MYSQL_VERSION_ID >= 40100 || defined(PDO_USE_MYSQLND) PDO_DBG_RETURN(0 <= mysql_rollback(((pdo_mysql_db_handle *)dbh->driver_data)->server)); -#else - PDO_DBG_RETURN(0 <= mysql_handle_doer(dbh, ZEND_STRL("ROLLBACK"))); -#endif } /* }}} */ @@ -376,15 +368,7 @@ static inline int mysql_handle_autocommit(pdo_dbh_t *dbh) PDO_DBG_ENTER("mysql_handle_autocommit"); PDO_DBG_INF_FMT("dbh=%p", dbh); PDO_DBG_INF_FMT("dbh->autocommit=%d", dbh->auto_commit); -#if MYSQL_VERSION_ID >= 40100 || defined(PDO_USE_MYSQLND) PDO_DBG_RETURN(0 <= mysql_autocommit(((pdo_mysql_db_handle *)dbh->driver_data)->server, dbh->auto_commit)); -#else - if (dbh->auto_commit) { - PDO_DBG_RETURN(0 <= mysql_handle_doer(dbh, ZEND_STRL("SET AUTOCOMMIT=1"))); - } else { - PDO_DBG_RETURN(0 <= mysql_handle_doer(dbh, ZEND_STRL("SET AUTOCOMMIT=0"))); - } -#endif } /* }}} */ @@ -516,37 +500,19 @@ static int pdo_mysql_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *return_ static int pdo_mysql_check_liveness(pdo_dbh_t *dbh) { pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; -#if MYSQL_VERSION_ID <= 32230 - void (*handler) (int); - unsigned int my_errno; -#endif PDO_DBG_ENTER("pdo_mysql_check_liveness"); PDO_DBG_INF_FMT("dbh=%p", dbh); -#if MYSQL_VERSION_ID > 32230 if (mysql_ping(H->server)) { PDO_DBG_RETURN(FAILURE); } -#else /* no mysql_ping() */ - handler = signal(SIGPIPE, SIG_IGN); - mysql_stat(H->server); - switch (mysql_errno(H->server)) { - case CR_SERVER_GONE_ERROR: - case CR_SERVER_LOST: - signal(SIGPIPE, handler); - PDO_DBG_RETURN(FAILURE); - default: - break; - } - signal(SIGPIPE, handler); -#endif /* end mysql_ping() */ PDO_DBG_RETURN(SUCCESS); } /* }}} */ /* {{{ mysql_methods */ -static struct pdo_dbh_methods mysql_methods = { +static const struct pdo_dbh_methods mysql_methods = { mysql_handle_closer, mysql_handle_preparer, mysql_handle_doer, @@ -853,7 +819,7 @@ cleanup: } /* }}} */ -pdo_driver_t pdo_mysql_driver = { +const pdo_driver_t pdo_mysql_driver = { PDO_DRIVER_HEADER(mysql), pdo_mysql_handle_factory }; |
