summaryrefslogtreecommitdiff
path: root/ext/pdo_mysql/mysql_driver.c
diff options
context:
space:
mode:
authorJohannes Schlüter <johannes@php.net>2010-08-05 13:29:44 +0000
committerJohannes Schlüter <johannes@php.net>2010-08-05 13:29:44 +0000
commiteaad585a2e9d985049296dec8b317a02149d5f6c (patch)
tree14c32b8812ba92ccea00900c9c960f95250c4dea /ext/pdo_mysql/mysql_driver.c
parent3cf5ab9e567e302125f242aaff2f1bd41e3d5409 (diff)
downloadphp-git-eaad585a2e9d985049296dec8b317a02149d5f6c.tar.gz
- Drop (broken) support for libmysql 3.23 and 4.0 from pdo_mysql, see bug #51259
Diffstat (limited to 'ext/pdo_mysql/mysql_driver.c')
-rwxr-xr-xext/pdo_mysql/mysql_driver.c32
1 files changed, 2 insertions, 30 deletions
diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c
index be500da886..4c1901abfb 100755
--- a/ext/pdo_mysql/mysql_driver.c
+++ b/ext/pdo_mysql/mysql_driver.c
@@ -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);
}
}