mbeccati Tue May 12 22:17:50 2009 UTC
Modified files:
/php-src/ext/pdo_pgsql pgsql_statement.c php_pdo_pgsql_int.h
/php-src/ext/pdo_pgsql/tests bug44861.phpt
Log:
- Fixed bug #48188
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/pgsql_statement.c?r1=1.54&r2=1.55&diff_format=u
Index: php-src/ext/pdo_pgsql/pgsql_statement.c
diff -u php-src/ext/pdo_pgsql/pgsql_statement.c:1.54
php-src/ext/pdo_pgsql/pgsql_statement.c:1.55
--- php-src/ext/pdo_pgsql/pgsql_statement.c:1.54 Thu Apr 30 12:35:36 2009
+++ php-src/ext/pdo_pgsql/pgsql_statement.c Tue May 12 22:17:50 2009
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pgsql_statement.c,v 1.54 2009/04/30 12:35:36 mbeccati Exp $ */
+/* $Id: pgsql_statement.c,v 1.55 2009/05/12 22:17:50 mbeccati Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -131,6 +131,13 @@
if (S->cursor_name) {
char *q = NULL;
+
+ if (S->is_prepared) {
+ spprintf(&q, 0, "CLOSE %s", S->cursor_name);
+ S->result = PQexec(H->server, q);
+ efree(q);
+ }
+
spprintf(&q, 0, "DECLARE %s SCROLL CURSOR WITH HOLD FOR %s",
S->cursor_name, stmt->active_query_string);
S->result = PQexec(H->server, q);
efree(q);
@@ -142,6 +149,9 @@
return 0;
}
+ /* the cursor was declared correctly */
+ S->is_prepared = 1;
+
/* fetch to be able to get the number of tuples later, but
don't advance the cursor pointer */
spprintf(&q, 0, "FETCH FORWARD 0 FROM %s", S->cursor_name);
S->result = PQexec(H->server, q);
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/php_pdo_pgsql_int.h?r1=1.20&r2=1.21&diff_format=u
Index: php-src/ext/pdo_pgsql/php_pdo_pgsql_int.h
diff -u php-src/ext/pdo_pgsql/php_pdo_pgsql_int.h:1.20
php-src/ext/pdo_pgsql/php_pdo_pgsql_int.h:1.21
--- php-src/ext/pdo_pgsql/php_pdo_pgsql_int.h:1.20 Thu Apr 30 12:35:36 2009
+++ php-src/ext/pdo_pgsql/php_pdo_pgsql_int.h Tue May 12 22:17:50 2009
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pdo_pgsql_int.h,v 1.20 2009/04/30 12:35:36 mbeccati Exp $ */
+/* $Id: php_pdo_pgsql_int.h,v 1.21 2009/05/12 22:17:50 mbeccati Exp $ */
#ifndef PHP_PDO_PGSQL_INT_H
#define PHP_PDO_PGSQL_INT_H
@@ -65,8 +65,8 @@
int *param_lengths;
int *param_formats;
Oid *param_types;
- zend_bool is_prepared;
#endif
+ zend_bool is_prepared;
} pdo_pgsql_stmt;
typedef struct {
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/tests/bug44861.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/pdo_pgsql/tests/bug44861.phpt
diff -u php-src/ext/pdo_pgsql/tests/bug44861.phpt:1.2
php-src/ext/pdo_pgsql/tests/bug44861.phpt:1.3
--- php-src/ext/pdo_pgsql/tests/bug44861.phpt:1.2 Sat Mar 28 03:01:38 2009
+++ php-src/ext/pdo_pgsql/tests/bug44861.phpt Tue May 12 22:17:50 2009
@@ -38,6 +38,12 @@
$res->execute(array("it's working"));
var_dump($res->fetch(PDO::FETCH_NUM));
+
+// Test bug #48188, trying to execute again
+$res->execute(array("try again"));
+var_dump($res->fetchColumn());
+var_dump($res->fetchColumn());
+
?>
--EXPECT--
string(4) "row1"
@@ -76,3 +82,5 @@
[0]=>
string(12) "it's working"
}
+string(9) "try again"
+bool(false)
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php