summaryrefslogtreecommitdiff
path: root/ext/pdo_mysql/mysql_statement.c
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2005-07-09 03:54:13 +0000
committerWez Furlong <wez@php.net>2005-07-09 03:54:13 +0000
commitc2f3636cf29209dc4683bc53512e95b5099e93f7 (patch)
treeebb11fe1b9e3472d884307656f6821cf0c107959 /ext/pdo_mysql/mysql_statement.c
parentd3b653e97b5e226f1f3fad86bb5359557e06f875 (diff)
downloadphp-git-c2f3636cf29209dc4683bc53512e95b5099e93f7.tar.gz
Fix two bugs:
- execute() would not re-fetch meta data after nextRowset() had been called. - buffered mode would only be enabled on the first execute on a statement handle.
Diffstat (limited to 'ext/pdo_mysql/mysql_statement.c')
-rwxr-xr-xext/pdo_mysql/mysql_statement.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c
index 35cfa4639c..5a6dd2fe76 100755
--- a/ext/pdo_mysql/mysql_statement.c
+++ b/ext/pdo_mysql/mysql_statement.c
@@ -91,17 +91,13 @@ static int pdo_mysql_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC)
return 0;
}
- if (!stmt->executed) {
+ if (!S->result) {
/* figure out the result set format, if any */
S->result = mysql_stmt_result_metadata(S->stmt);
if (S->result) {
S->fields = mysql_fetch_fields(S->result);
stmt->column_count = (int)mysql_num_fields(S->result);
- if (H->buffered) {
- mysql_stmt_store_result(S->stmt);
- }
-
S->bound_result = ecalloc(stmt->column_count, sizeof(MYSQL_BIND));
S->out_null = ecalloc(stmt->column_count, sizeof(my_bool));
S->out_length = ecalloc(stmt->column_count, sizeof(unsigned long));
@@ -121,6 +117,11 @@ static int pdo_mysql_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC)
}
}
}
+
+ /* if buffered, pre-fetch all the data */
+ if (H->buffered) {
+ mysql_stmt_store_result(S->stmt);
+ }
stmt->row_count = mysql_stmt_affected_rows(S->stmt);
return 1;