summaryrefslogtreecommitdiff
path: root/ext/pdo_mysql/mysql_statement.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_statement.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_statement.c')
-rwxr-xr-xext/pdo_mysql/mysql_statement.c41
1 files changed, 9 insertions, 32 deletions
diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c
index ebfe24447e..bba0b8cd45 100755
--- a/ext/pdo_mysql/mysql_statement.c
+++ b/ext/pdo_mysql/mysql_statement.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;
@@ -107,8 +101,8 @@ static int pdo_mysql_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
mysql_free_result(res);
}
}
- }
-#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);
}
/* }}} */