Skip to content

Commit

Permalink
Fixed bug #39759 (Can't use stored procedures fetching multiple result
Browse files Browse the repository at this point in the history
sets in pdo_mysql).
  • Loading branch information
Ilia Alshanetsky committed Dec 8, 2006
1 parent 4991dba commit b7b0f4d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
2 changes: 2 additions & 0 deletions NEWS
Expand Up @@ -52,6 +52,8 @@ PHP NEWS
- Fixed bug #39775 ("Indirect modification ..." message is not shown). (Dmitry)
- Fixed bug #39763 (magic quotes are applied twice by ext/filter in
parse_str()). (Ilia)
- Fixed bug #39759 (Can't use stored procedures fetching multiple result
sets in pdo_mysql). (Ilia)
- Fixed bug #39754 (Some POSIX extension functions not thread safe).
(Ilia, wharmby at uk dot ibm dot com)
- Fixed bug #39724 (Broken build due to spl/filter usage of pcre extension).
Expand Down
10 changes: 4 additions & 6 deletions ext/pdo/pdo_stmt.c
Expand Up @@ -1932,10 +1932,6 @@ static PHP_METHOD(PDOStatement, setFetchMode)

static int pdo_stmt_do_next_rowset(pdo_stmt_t *stmt TSRMLS_DC)
{
if (!stmt->methods->next_rowset(stmt TSRMLS_CC)) {
return 0;
}

/* un-describe */
if (stmt->columns) {
int i;
Expand All @@ -1949,6 +1945,10 @@ static int pdo_stmt_do_next_rowset(pdo_stmt_t *stmt TSRMLS_DC)
stmt->column_count = 0;
}

if (!stmt->methods->next_rowset(stmt TSRMLS_CC)) {
return 0;
}

pdo_stmt_describe_columns(stmt TSRMLS_CC);

return 1;
Expand All @@ -1969,8 +1969,6 @@ static PHP_METHOD(PDOStatement, nextRowset)
PDO_HANDLE_STMT_ERR();
RETURN_FALSE;
}

pdo_stmt_describe_columns(stmt TSRMLS_CC);

RETURN_TRUE;
}
Expand Down
2 changes: 1 addition & 1 deletion ext/pdo_mysql/mysql_driver.c
Expand Up @@ -471,7 +471,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_

dbh->driver_data = H;
H->max_buffer_size = 1024*1024;
H->emulate_prepare = 1;
H->buffered = H->emulate_prepare = 1;

/* handle MySQL options */
if (driver_options) {
Expand Down
10 changes: 5 additions & 5 deletions ext/pdo_mysql/mysql_statement.c
Expand Up @@ -273,15 +273,15 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC)
/* No more results */
return 0;
} else {
if ((my_ulonglong)-1 == (row_count = mysql_affected_rows(H->server))) {
pdo_mysql_error_stmt(stmt);
return 0;
}

if (!H->buffered) {
S->result = mysql_use_result(H->server);
row_count = 0;
} else {
S->result = mysql_store_result(H->server);
if ((my_ulonglong)-1 == (row_count = mysql_affected_rows(H->server))) {
pdo_mysql_error_stmt(stmt);
return 0;
}
}

if (NULL == S->result) {
Expand Down
8 changes: 3 additions & 5 deletions ext/pdo_mysql/tests/pecl_bug_5780.phpt
Expand Up @@ -33,10 +33,8 @@ array(2) {
[1]=>
string(7) "testing"
}
bool(false)
array(2) {
bool(true)
array(1) {
[0]=>
string(5) "HY000"
[1]=>
int(2014)
string(5) "00000"
}

0 comments on commit b7b0f4d

Please sign in to comment.