mbeccati                Tue May 12 22:18:15 2009 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src    NEWS 
    /php-src/ext/pdo_pgsql      pgsql_statement.c php_pdo_pgsql_int.h 
    /php-src/ext/pdo_pgsql/tests        bug44861.phpt 
  Log:
  MFH
  - Fixed bug #48188
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.598&r2=1.2027.2.547.2.965.2.599&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.598 
php-src/NEWS:1.2027.2.547.2.965.2.599
--- php-src/NEWS:1.2027.2.547.2.965.2.598       Mon May 11 12:35:19 2009
+++ php-src/NEWS        Tue May 12 22:18:14 2009
@@ -9,6 +9,8 @@
 - Fixed bug #48227 (NumberFormatter::format leaks memory). (Felipe)
 - Fixed bug #48200 (compile failure with mbstring.c when 
   --enable-zend-multibyte is used). (Jani)
+- Fixed bug #48188 (Cannot execute a scrollable cursors twice with
+  PDO_PGSQL). (Matteo)
 
 
 07 May 2009, PHP 5.3.0 RC 2
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/pgsql_statement.c?r1=1.31.2.12.2.7.2.11&r2=1.31.2.12.2.7.2.12&diff_format=u
Index: php-src/ext/pdo_pgsql/pgsql_statement.c
diff -u php-src/ext/pdo_pgsql/pgsql_statement.c:1.31.2.12.2.7.2.11 
php-src/ext/pdo_pgsql/pgsql_statement.c:1.31.2.12.2.7.2.12
--- php-src/ext/pdo_pgsql/pgsql_statement.c:1.31.2.12.2.7.2.11  Thu Apr 30 
12:38:43 2009
+++ php-src/ext/pdo_pgsql/pgsql_statement.c     Tue May 12 22:18:14 2009
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: pgsql_statement.c,v 1.31.2.12.2.7.2.11 2009/04/30 12:38:43 mbeccati 
Exp $ */
+/* $Id: pgsql_statement.c,v 1.31.2.12.2.7.2.12 2009/05/12 22:18:14 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.13.2.4.2.1.2.3&r2=1.13.2.4.2.1.2.4&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.13.2.4.2.1.2.3 
php-src/ext/pdo_pgsql/php_pdo_pgsql_int.h:1.13.2.4.2.1.2.4
--- php-src/ext/pdo_pgsql/php_pdo_pgsql_int.h:1.13.2.4.2.1.2.3  Thu Apr 30 
12:38:43 2009
+++ php-src/ext/pdo_pgsql/php_pdo_pgsql_int.h   Tue May 12 22:18:14 2009
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: php_pdo_pgsql_int.h,v 1.13.2.4.2.1.2.3 2009/04/30 12:38:43 mbeccati 
Exp $ */
+/* $Id: php_pdo_pgsql_int.h,v 1.13.2.4.2.1.2.4 2009/05/12 22:18:14 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.1.2.1&r2=1.1.2.2&diff_format=u
Index: php-src/ext/pdo_pgsql/tests/bug44861.phpt
diff -u php-src/ext/pdo_pgsql/tests/bug44861.phpt:1.1.2.1 
php-src/ext/pdo_pgsql/tests/bug44861.phpt:1.1.2.2
--- php-src/ext/pdo_pgsql/tests/bug44861.phpt:1.1.2.1   Sat Mar 28 02:58:04 2009
+++ php-src/ext/pdo_pgsql/tests/bug44861.phpt   Tue May 12 22:18:15 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

Reply via email to