]> granicus.if.org Git - php/commitdiff
fixed bug #29311
authorGeorg Richter <georg@php.net>
Fri, 23 Jul 2004 12:47:36 +0000 (12:47 +0000)
committerGeorg Richter <georg@php.net>
Fri, 23 Jul 2004 12:47:36 +0000 (12:47 +0000)
added support for Cursors (MySQL 5.0.x)

NEWS
ext/mysqli/mysqli.c
ext/mysqli/mysqli_fe.c
ext/mysqli/tests/bug29311.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 2fcc8503e245344bc22ca570fcb512465dabafbf..e38dd004c0c84e252b2ea95ea9cc490888622e64 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,10 +1,11 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2004, PHP 5.1.0
-- Fixed bug #28985 (__getTypes() returning nothing on complex WSDL). (Dmitry)
+- Fixed bug #29311 (calling parent constructor in mysqli). (Georg)
 - Fixed bug #29236 (memory error when wsdl-cache is enabled). (Dmitry)
 - Fixed bug #29109 (SoapFault exception: [WSDL] Out of memory). (Dmitry)
 - Fixed bug #29061 (soap extension segfaults). (Dmitry)
+- Fixed bug #28985 (__getTypes() returning nothing on complex WSDL). (Dmitry)
 - Added new functions :
   . array_diff_key() (Andrey)
   . array_diff_ukey() (Andrey)
@@ -13,6 +14,7 @@ PHP                                                                        NEWS
   . stream_context_get_default()  (Wez)
   . stream_socket_enable_crypto()  (Wez)
 - PHP will now respect extension dependencies when initializing.  (Wez)
+- Added Cursor support for MySQL 5.0.x in mysqli (Georg)
 - Added MDTM support to ftp_url_stat. (Sara)
 - Added zlib stream filter suport. (Sara)
 - Added bz2 stream filter support. (Sara)
index 684e622ae8c111b17b57a58011e6687f88e8a6fc..b02effb7f98f1fe5c330600633a668cbe2c599db 100644 (file)
@@ -273,7 +273,7 @@ static union _zend_function *php_mysqli_constructor_get(zval *object TSRMLS_DC)
 {
        mysqli_object *obj = (mysqli_object *)zend_objects_get_address(object TSRMLS_CC);
 
-       if (obj->zo.ce != mysqli_link_class_entry && obj->zo.ce->constructor) {
+       if (obj->zo.ce != mysqli_link_class_entry) {
                return obj->zo.ce->constructor;
        } else {
                static zend_internal_function f;
@@ -443,6 +443,14 @@ PHP_MINIT_FUNCTION(mysqli)
        
        /* for mysqli_stmt_set_attr */
        REGISTER_LONG_CONSTANT("MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH", STMT_ATTR_UPDATE_MAX_LENGTH, CONST_CS | CONST_PERSISTENT);
+
+#ifdef STMT_ATTR_CURSOR_TYPE
+       REGISTER_LONG_CONSTANT("MYSQLI_STMT_ATTR_CURSOR_TYPE", STMT_ATTR_CURSOR_TYPE, CONST_CS | CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("MYSQLI_CURSOR_TYPE_NO_CURSOR", CURSOR_TYPE_NO_CURSOR, CONST_CS | CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("MYSQLI_CURSOR_TYPE_READ_ONLY", CURSOR_TYPE_READ_ONLY, CONST_CS | CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("MYSQLI_CURSOR_TYPE_FOR_UPDATE", CURSOR_TYPE_FOR_UPDATE, CONST_CS | CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("MYSQLI_CURSOR_TYPE_SCROLLABLE", CURSOR_TYPE_SCROLLABLE, CONST_CS | CONST_PERSISTENT);
+#endif
        
        /* column information */
        REGISTER_LONG_CONSTANT("MYSQLI_NOT_NULL_FLAG", NOT_NULL_FLAG, CONST_CS | CONST_PERSISTENT);
index 2510e86432b32ff9e609cca3f886eba12be4146e..35c43e6c4e5f24e3bb5f9060dfa94cfa52a262f9 100644 (file)
@@ -202,6 +202,7 @@ function_entry mysqli_link_methods[] = {
        PHP_FALIAS(set_local_infile_handler,mysqli_set_local_infile_handler,NULL)
        PHP_FALIAS(master_query,mysqli_master_query,NULL)
        PHP_FALIAS(multi_query,mysqli_multi_query,NULL)
+       PHP_FALIAS(mysqli,mysqli_connect,NULL)
        PHP_FALIAS(more_results,mysqli_more_results, NULL)
        PHP_FALIAS(next_result, mysqli_next_result, NULL)
        PHP_FALIAS(options,mysqli_options,NULL)
diff --git a/ext/mysqli/tests/bug29311.phpt b/ext/mysqli/tests/bug29311.phpt
new file mode 100644 (file)
index 0000000..82845e1
--- /dev/null
@@ -0,0 +1,44 @@
+--TEST--
+constructor test
+--FILE--
+<?php
+       include "connect.inc";
+       
+       /* class 1 calls parent constructor */
+       class mysql1 extends mysqli {
+               function __construct() {
+                       parent::__construct("localhost", "root", "", "test");
+               }
+       }
+
+       /* class 2 has an own constructor */
+       class mysql2 extends mysqli {
+               
+               function __construct() {
+                       $this->connect("localhost", "root", "", "test");
+               }
+       }
+
+       /* class 3 has no constructor */
+       class mysql3 extends mysqli {
+               
+       }
+
+       $foo[0] = new mysql1(); 
+       $foo[1] = new mysql2(); 
+       $foo[2] = new mysql3("localhost", "root", "", "test");
+
+
+       for ($i=0; $i < 3; $i++) {
+               if (($result = $foo[$i]->query("SELECT DATABASE()"))) {
+                       $row = $result->fetch_row();
+                       printf("%d: %s\n", $i, $row[0]);
+                       $result->close();
+               }
+               $foo[$i]->close();
+       }
+?>
+--EXPECTF--
+0: test
+1: test
+2: test