]> granicus.if.org Git - php/commitdiff
Changes to 04*.phpt, 05*.phpt.
authorUlf Wendel <uw@php.net>
Wed, 10 Oct 2007 10:08:29 +0000 (10:08 +0000)
committerUlf Wendel <uw@php.net>
Wed, 10 Oct 2007 10:08:29 +0000 (10:08 +0000)
20 files changed:
ext/mysqli/tests/040.phpt
ext/mysqli/tests/041.phpt
ext/mysqli/tests/042.phpt
ext/mysqli/tests/043.phpt
ext/mysqli/tests/044.phpt
ext/mysqli/tests/045.phpt
ext/mysqli/tests/046.phpt
ext/mysqli/tests/047.phpt
ext/mysqli/tests/048.phpt
ext/mysqli/tests/049.phpt
ext/mysqli/tests/050.phpt
ext/mysqli/tests/051.phpt
ext/mysqli/tests/052.phpt
ext/mysqli/tests/053.phpt
ext/mysqli/tests/054.phpt
ext/mysqli/tests/055.phpt
ext/mysqli/tests/056.phpt
ext/mysqli/tests/057.phpt
ext/mysqli/tests/058.phpt
ext/mysqli/tests/059.phpt

index 79bfe0d5fb4859aaacf0f374c73053fc89a85e8f..fa1754a562bdf9d2132c5c7c9bfe3dea7d12c4e5 100644 (file)
@@ -1,16 +1,19 @@
 --TEST--
 function test: mysqli_num_rows()
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php 
+require_once('skipif.inc'); 
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
 
        include "connect.inc";
-       
+
        /*** test mysqli_connect 127.0.0.1 ***/
-       $link = mysqli_connect($host, $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
 
-       mysqli_select_db($link, "test");
+       mysqli_select_db($link, $db);
 
        mysqli_query($link, "DROP TABLE IF EXISTS test_result");
 
@@ -28,6 +31,8 @@ function test: mysqli_num_rows()
        var_dump($num);
 
        mysqli_close($link);
+       print "done!";
 ?>
 --EXPECT--
 int(1)
+done!
\ No newline at end of file
index 90bed1ad49ad86521256f65de484faf3f900528f..81bd808c4b69b7a8476fffda6284ff00393b504e 100644 (file)
@@ -1,15 +1,18 @@
 --TEST--
 function test: mysqli_warning_count()
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php 
+require_once('skipif.inc'); 
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
 
        include "connect.inc";
-       
+
        /*** test mysqli_connect 127.0.0.1 ***/
-       $link = mysqli_connect($host, $user, $passwd);
-       mysqli_select_db($link, "test");
+       $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+       mysqli_select_db($link, $db);
 
        mysqli_query($link, "DROP TABLE IF EXISTS test_warnings");
        mysqli_query($link, "DROP TABLE IF EXISTS test_warnings");
@@ -17,6 +20,8 @@ function test: mysqli_warning_count()
        var_dump(mysqli_warning_count($link));
 
        mysqli_close($link);
+       print "done!";
 ?>
 --EXPECT--
 int(1)
+done!
\ No newline at end of file
index 719e24925d0114f99dd1b6c5167672ec53f609f1..bb622b3e30cd72c85e286e29da0ba303da55b74c 100644 (file)
@@ -1,25 +1,28 @@
 --TEST--
 mysqli_fetch_object
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php 
+require_once('skipif.inc'); 
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
        include "connect.inc";
-       
+
        /*** test mysqli_connect 127.0.0.1 ***/
-       $link = mysqli_connect($host, $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
 
-       mysqli_select_db($link, "test");
+       mysqli_select_db($link, $db);
        mysqli_query($link, "SET sql_mode=''");
 
-       mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
-       mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 smallint unsigned,
-                                                     c2 smallint unsigned,
-                                                     c3 smallint,
-                                                     c4 smallint,
-                                                     c5 smallint,
-                                                     c6 smallint unsigned,
-                                                     c7 smallint)");
+       mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+       mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 smallint unsigned,
+               c2 smallint unsigned,
+               c3 smallint,
+               c4 smallint,
+               c5 smallint,
+               c6 smallint unsigned,
+               c7 smallint)");
 
        $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)");
        mysqli_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7);
@@ -42,6 +45,7 @@ mysqli_fetch_object
        var_dump($test);
 
        mysqli_close($link);
+       print "done!"
 ?>
 --EXPECTF--
 object(stdClass)#%d (7) {
@@ -60,3 +64,22 @@ object(stdClass)#%d (7) {
   ["c7"]=>
   string(1) "0"
 }
+done!
+--UEXPECTF--
+object(stdClass)#%d (7) {
+  [u"c1"]=>
+  unicode(1) "0"
+  [u"c2"]=>
+  unicode(5) "35999"
+  [u"c3"]=>
+  NULL
+  [u"c4"]=>
+  unicode(4) "-500"
+  [u"c5"]=>
+  unicode(6) "-32768"
+  [u"c6"]=>
+  unicode(1) "0"
+  [u"c7"]=>
+  unicode(1) "0"
+}
+done!
\ No newline at end of file
index fb0284e06a3929b4cf20481ae0830c46ffa5e443..b5038ffb2a65e8686c1083a7da62bcd494d4527a 100644 (file)
@@ -1,18 +1,21 @@
 --TEST--
 mysqli_bind_param (UPDATE)
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php 
+require_once('skipif.inc'); 
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
        include "connect.inc";
-       
+
        /*** test mysqli_connect 127.0.0.1 ***/
-       $link = mysqli_connect($host, $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
 
-       mysqli_select_db($link, "test");
+       mysqli_select_db($link, $db);
 
-       mysqli_query($link,"DROP TABLE IF EXISTS test_update");
-       mysqli_query($link,"CREATE TABLE test_update(a varchar(10),
+       mysqli_query($link,"DROP TABLE IF EXISTS test_update");
+       mysqli_query($link,"CREATE TABLE test_update(a varchar(10),
                                                      b int)");
 
        mysqli_query($link, "INSERT INTO test_update VALUES ('foo', 2)");
@@ -34,9 +37,17 @@ mysqli_bind_param (UPDATE)
        var_dump($test);
 
        mysqli_close($link);
+       print "done!";
 ?>
---EXPECT--
+--EXPECTF--
 array(1) {
   [0]=>
   string(15) "Rasmus is No. 1"
 }
+done!
+--UEXPECF--
+array(1) {
+  [0]=>
+  unicode(15) "Rasmus is No. 1"
+}
+done!
\ No newline at end of file
index 28e73a7e0999b68043f61aafab6523920ddf4230..0a2495b9cfe49f663bf169202a482b15d37a0ea4 100644 (file)
@@ -1,13 +1,16 @@
 --TEST--
 mysqli_get_server_version
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php 
+require_once('skipif.inc'); 
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
        include "connect.inc";
-       
+
        /*** test mysqli_connect 127.0.0.1 ***/
-       $link = mysqli_connect($host, $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
 
        $i = mysqli_get_server_version($link);
 
@@ -16,6 +19,8 @@ mysqli_get_server_version
        var_dump($test);
 
        mysqli_close($link);
+       print "done!";
 ?>
 --EXPECT--
 int(1)
+done!
\ No newline at end of file
index dd491a69774eb72783a80004fa39e623edd22031..ca916b0d32fd8569e30f2a28db2221a3c8ad4f95 100644 (file)
@@ -1,14 +1,14 @@
 --TEST--
 mysqli_bind_result (SHOW)
 --SKIPIF--
-<?php  
+<?php
        require_once('skipif.inc');
-       require_once('skipifemb.inc'); 
-
+       require_once('skipifemb.inc');
+       require_once('skipifconnectfailure.inc');
+       
        include "connect.inc";
        $link = mysqli_connect($host, $user, $passwd);
 
-
        $stmt = mysqli_prepare($link, "SHOW VARIABLES LIKE 'port'");
        mysqli_execute($stmt);
 
@@ -21,26 +21,41 @@ mysqli_bind_result (SHOW)
 --FILE--
 <?php
        include "connect.inc";
-       
+
        /*** test mysqli_connect 127.0.0.1 ***/
-       $link = mysqli_connect($host, $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
 
        $stmt = mysqli_prepare($link, "SHOW VARIABLES LIKE 'port'");
        mysqli_execute($stmt);
 
-       mysqli_bind_result($stmt, $c1, $c2);    
+       mysqli_bind_result($stmt, $c1, $c2);
        mysqli_fetch($stmt);
-       mysqli_stmt_close($stmt);       
+       mysqli_stmt_close($stmt);
+       if (ini_get("unicode.semantics") && mysqli_get_server_version($link) < 50000) {
+               /* variables are binary */
+               settype($c1, "unicode");
+               settype($c2, "unicode");
+       }
        $test = array ($c1,$c2);
 
        var_dump($test);
 
        mysqli_close($link);
+       print "done!";
 ?>
---EXPECT--
+--EXPECTF--
 array(2) {
   [0]=>
   string(4) "port"
   [1]=>
-  string(4) "3306"
+  string(%d) "%s"
+}
+done!
+--UEXPECTF--
+array(2) {
+  [0]=>
+  unicode(4) "port"
+  [1]=>
+  unicode(%d) "%s"
 }
+done!
index e88348bfa92599457a7e8d5d145175269948b250..9fcf321eef343cfed7f073836f2cdfa99dd65e92 100644 (file)
@@ -1,15 +1,18 @@
 --TEST--
 mysqli_stmt_affected_rows (delete)
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php 
+require_once('skipif.inc'); 
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
        include "connect.inc";
-       
+
        /*** test mysqli_connect 127.0.0.1 ***/
-       $link = mysqli_connect($host, $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
 
-       mysqli_select_db($link, "test");
+       mysqli_select_db($link, $db);
 
        mysqli_query($link, "DROP TABLE IF EXISTS test_affected");
        mysqli_query($link, "CREATE TABLE test_affected (foo int)");
@@ -24,10 +27,12 @@ mysqli_stmt_affected_rows (delete)
        mysqli_execute($stmt);
        $x = mysqli_stmt_affected_rows($stmt);
 
-       mysqli_stmt_close($stmt);       
+       mysqli_stmt_close($stmt);
        var_dump($x==1);
 
        mysqli_close($link);
+       print "done!";
 ?>
 --EXPECT--
 bool(true)
+done!
\ No newline at end of file
index 4b5df98676ab20ba9ea57eef7be494e156ed3951..a32dd70edfbfddedd24f3ca96a8693bbf580bacd 100644 (file)
@@ -1,15 +1,18 @@
 --TEST--
 mysqli_get_metadata
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php 
+require_once('skipif.inc'); 
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
        include "connect.inc";
-       
+
        /*** test mysqli_connect 127.0.0.1 ***/
-       $link = mysqli_connect($host, $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
 
-       mysqli_select_db($link, "test");
+       mysqli_select_db($link, $db);
 
        mysqli_query($link, "DROP TABLE IF EXISTS test_affected");
        mysqli_query($link, "CREATE TABLE test_affected (foo int, bar varchar(10) character set latin1)");
@@ -31,14 +34,15 @@ mysqli_get_metadata
        while ($field = mysqli_fetch_field($result)) {
                var_dump($field);
        }
-    
+
        print_r(mysqli_fetch_lengths($result));
-    
+
        mysqli_free_result($result);
 
 
-       mysqli_stmt_close($stmt);       
+       mysqli_stmt_close($stmt);
        mysqli_close($link);
+       print "done!";
 ?>
 --EXPECTF--
 === fetch_fields ===
@@ -193,4 +197,160 @@ object(stdClass)#5 (11) {
   int(253)
   ["decimals"]=>
   int(0)
-}
\ No newline at end of file
+}
+done!
+--UEXPECTF--
+=== fetch_fields ===
+array(2) {
+  [0]=>
+  object(stdClass)#5 (11) {
+    [u"name"]=>
+    unicode(3) "foo"
+    [u"orgname"]=>
+    unicode(3) "foo"
+    [u"table"]=>
+    unicode(13) "test_affected"
+    [u"orgtable"]=>
+    unicode(13) "test_affected"
+    [u"def"]=>
+    unicode(0) ""
+    [u"max_length"]=>
+    int(0)
+    [u"length"]=>
+    int(11)
+    [u"charsetnr"]=>
+    int(63)
+    [u"flags"]=>
+    int(32768)
+    [u"type"]=>
+    int(3)
+    [u"decimals"]=>
+    int(0)
+  }
+  [1]=>
+  object(stdClass)#6 (11) {
+    [u"name"]=>
+    unicode(3) "bar"
+    [u"orgname"]=>
+    unicode(3) "bar"
+    [u"table"]=>
+    unicode(13) "test_affected"
+    [u"orgtable"]=>
+    unicode(13) "test_affected"
+    [u"def"]=>
+    unicode(0) ""
+    [u"max_length"]=>
+    int(0)
+    [u"length"]=>
+    int(%d)
+    [u"charsetnr"]=>
+    int(%d)
+    [u"flags"]=>
+    int(0)
+    [u"type"]=>
+    int(253)
+    [u"decimals"]=>
+    int(0)
+  }
+}
+
+=== fetch_field_direct ===
+object(stdClass)#6 (11) {
+  [u"name"]=>
+  unicode(3) "foo"
+  [u"orgname"]=>
+  unicode(3) "foo"
+  [u"table"]=>
+  unicode(13) "test_affected"
+  [u"orgtable"]=>
+  unicode(13) "test_affected"
+  [u"def"]=>
+  unicode(0) ""
+  [u"max_length"]=>
+  int(0)
+  [u"length"]=>
+  int(%d)
+  [u"charsetnr"]=>
+  int(%d)
+  [u"flags"]=>
+  int(32768)
+  [u"type"]=>
+  int(3)
+  [u"decimals"]=>
+  int(0)
+}
+object(stdClass)#6 (11) {
+  [u"name"]=>
+  unicode(3) "bar"
+  [u"orgname"]=>
+  unicode(3) "bar"
+  [u"table"]=>
+  unicode(13) "test_affected"
+  [u"orgtable"]=>
+  unicode(13) "test_affected"
+  [u"def"]=>
+  unicode(0) ""
+  [u"max_length"]=>
+  int(0)
+  [u"length"]=>
+  int(%d)
+  [u"charsetnr"]=>
+  int(%d)
+  [u"flags"]=>
+  int(0)
+  [u"type"]=>
+  int(253)
+  [u"decimals"]=>
+  int(0)
+}
+
+=== fetch_field ===
+object(stdClass)#6 (11) {
+  [u"name"]=>
+  unicode(3) "foo"
+  [u"orgname"]=>
+  unicode(3) "foo"
+  [u"table"]=>
+  unicode(13) "test_affected"
+  [u"orgtable"]=>
+  unicode(13) "test_affected"
+  [u"def"]=>
+  unicode(0) ""
+  [u"max_length"]=>
+  int(0)
+  [u"length"]=>
+  int(%d)
+  [u"charsetnr"]=>
+  int(%d)
+  [u"flags"]=>
+  int(32768)
+  [u"type"]=>
+  int(3)
+  [u"decimals"]=>
+  int(0)
+}
+object(stdClass)#5 (11) {
+  [u"name"]=>
+  unicode(3) "bar"
+  [u"orgname"]=>
+  unicode(3) "bar"
+  [u"table"]=>
+  unicode(13) "test_affected"
+  [u"orgtable"]=>
+  unicode(13) "test_affected"
+  [u"def"]=>
+  unicode(0) ""
+  [u"max_length"]=>
+  int(0)
+  [u"length"]=>
+  int(%d)
+  [u"charsetnr"]=>
+  int(%d)
+  [u"flags"]=>
+  int(0)
+  [u"type"]=>
+  int(253)
+  [u"decimals"]=>
+  int(0)
+}
+done!
\ No newline at end of file
index 1cf5b67894b9a81a873d3ddd85b962abf300d1b8..afd4799b8358f173dc39340b420eef4163df3182 100644 (file)
@@ -1,29 +1,32 @@
 --TEST--
-mysqli bind_result (OO-Style) 
+mysqli bind_result (OO-Style)
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php 
+require_once('skipif.inc'); 
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
        include "connect.inc";
-       
+
        /*** test mysqli_connect 127.0.0.1 ***/
-       $mysql = mysqli_connect($host, $user, $passwd);
+       $mysql = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
 
-       $mysql->select_db("test");              
+       $mysql->select_db($db);
        $mysql->query("DROP TABLE IF EXISTS test_fetch_null");
 
-       $mysql->query("CREATE TABLE test_fetch_null(col1 tinyint, col2 smallint,
-                                                       col3 int, col4 bigint, 
-                                                       col5 float, col6 double,
-                                                       col7 date, col8 time, 
-                                                       col9 varbinary(10), 
-                                                       col10 varchar(50),
-                                                       col11 char(20))");
-  
+       $mysql->query("CREATE TABLE test_fetch_null(col1 tinyint, col2 smallint,
+               col3 int, col4 bigint,
+               col5 float, col6 double,
+               col7 date, col8 time,
+               col9 varbinary(10),
+               col10 varchar(50),
+               col11 char(20))");
+
        $mysql->query("INSERT INTO test_fetch_null(col1,col10, col11) VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)");
 
        $stmt = $mysql->prepare("SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from test_fetch_null");
-       $stmt->bind_result($c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11); 
+       $stmt->bind_result($c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11);
        $stmt->execute();
 
        $stmt->fetch();
@@ -34,8 +37,9 @@ mysqli bind_result (OO-Style)
 
        $stmt->close();
        $mysql->close();
+       print "done!";
 ?>
---EXPECT--
+--EXPECTF--
 array(11) {
   [0]=>
   int(1)
@@ -60,3 +64,30 @@ array(11) {
   [10]=>
   string(4) "1000"
 }
+done!
+--UEXPECTF--
+array(11) {
+  [0]=>
+  int(1)
+  [1]=>
+  NULL
+  [2]=>
+  NULL
+  [3]=>
+  NULL
+  [4]=>
+  NULL
+  [5]=>
+  NULL
+  [6]=>
+  NULL
+  [7]=>
+  NULL
+  [8]=>
+  NULL
+  [9]=>
+  unicode(4) "foo1"
+  [10]=>
+  unicode(4) "1000"
+}
+done!
\ No newline at end of file
index 4bb5bfef45c0d8885c84a2a899da6d3d00b1ffee..5be8b40f3bbea455577ff78b47504af44aa0462d 100644 (file)
@@ -1,16 +1,19 @@
 --TEST--
-mysql_fetch_row (OO-Style) 
+mysql_fetch_row (OO-Style)
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
-<?php require_once('skipifemb.inc'); ?>
+<?php 
+require_once('skipif.inc'); 
+require_once('skipifemb.inc');
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
        include "connect.inc";
-       
+
        /*** test mysqli_connect 127.0.0.1 ***/
-       $mysql = mysqli_connect($host, $user, $passwd);
+       $mysql = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
 
-       $mysql->select_db("test");              
+       $mysql->select_db($db);
        $result = $mysql->query("SELECT DATABASE()");
        $row = $result->fetch_row();
        $result->close();
@@ -18,9 +21,17 @@ mysql_fetch_row (OO-Style)
        var_dump($row);
 
        $mysql->close();
+       print "done!";
 ?>
---EXPECT--
+--EXPECTF--
+array(1) {
+  [0]=>
+  string(%d) "%s"
+}
+done!
+--UEXPECTF--
 array(1) {
   [0]=>
-  string(4) "test"
+  unicode(%d) "%s"
 }
+done!
\ No newline at end of file
index 5f923ccf34bd910bf7e03045daf5e41f17b93829..ee1c20322e263718206cd8ca6b48677c7ea016d2 100644 (file)
@@ -1,15 +1,18 @@
 --TEST--
-non freed statement test 
+non freed statement test
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php 
+require_once('skipif.inc'); 
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
        include "connect.inc";
-       
+
        /************************
         * non freed stamement
         ************************/
-       $link = mysqli_connect($host, $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
 
        $stmt = mysqli_prepare($link, "SELECT CURRENT_USER()");
        mysqli_execute($stmt);
index ef378757f1adf2c5feda7d9cbfc67bce4d15be4b..8ff75d59bf25a63b74e1907d6c5565cfc020bf31 100644 (file)
@@ -1,15 +1,18 @@
 --TEST--
-free statement after close 
+free statement after close
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php 
+require_once('skipif.inc'); 
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
        include "connect.inc";
-       
+
        /************************
-        * free statement after close 
+        * free statement after close
         ************************/
-       $link = mysqli_connect($host, $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
 
        $stmt1 = mysqli_prepare($link, "SELECT CURRENT_USER()");
        mysqli_execute($stmt1);
index 3fa5dc8f1702810d41c4ff3e8642510043ce7628..95fdc2f27c74e1dcc71dd71e570db3f979cce4f4 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 call statement after close
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php 
+require_once('skipif.inc'); 
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
        include "connect.inc";
@@ -9,7 +12,7 @@ call statement after close
        /************************
         * statement call  after close 
         ************************/
-       $link = mysqli_connect($host, $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
 
        $stmt2 = mysqli_prepare($link, "SELECT CURRENT_USER()");
 
index 99148c7e80dd1031eade380f2093c284f31b9ff8..5a60b0fc013ef4b576c86f787e717a0035b456a4 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 not freed resultset 
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php 
+require_once('skipif.inc'); 
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
        include "connect.inc";
@@ -9,7 +12,7 @@ not freed resultset
        /************************
         * non freed resultset 
         ************************/
-       $link = mysqli_connect($host, $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
 
        $result = mysqli_query($link, "SELECT CURRENT_USER()");
        mysqli_close($link);
index 727b87ef8e99c2f0326cdbe8bb31dff24658848e..969ae7a1f13cbf21fd17556d21b94d0b001b0e59 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 free resultset after close 
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php 
+require_once('skipif.inc'); 
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
        include "connect.inc";
@@ -9,7 +12,7 @@ free resultset after close
        /************************
         * free resultset after close 
         ************************/
-       $link = mysqli_connect($host, $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
 
        $result1 = mysqli_query($link, "SELECT CURRENT_USER()");
        mysqli_close($link);
index e650dbcecdd1e41a75f3905d095e256e476cf920..1d0f6c9df6322786994b04c9ed40e716c297ffc1 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 free nothing 
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php 
+require_once('skipif.inc'); 
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
        include "connect.inc";
@@ -9,7 +12,7 @@ free nothing
        /************************
         * don't free anything 
         ************************/
-       $link = mysqli_connect($host, $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
 
        $result2 = mysqli_query($link, "SELECT CURRENT_USER()");
        $stmt2 = mysqli_prepare($link, "SELECT CURRENT_USER()");
index cc5c32fc6099c202f1b42cecae6b818835a53ebf..e8669dc32f7864715d52942ff4639e879374b3b2 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 extend mysqli 
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php 
+require_once('skipif.inc'); 
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
        include "connect.inc";
@@ -13,7 +16,7 @@ extend mysqli
        }
 
        $foo = new foobar();
-       $foo->connect($host, $user, $passwd);
+       $foo->connect($host, $user, $passwd, $db, $port, $socket);
        $foo->close();
        printf("%s\n", $foo->test());
 ?>
index a987c72381c45b0fd22fd86199032da580b981cc..1bb17b6961167cfd93910077d6507d4831503efd 100644 (file)
@@ -1,18 +1,21 @@
 --TEST--
 mysqli_get_metadata
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php 
+require_once('skipif.inc'); 
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
        include "connect.inc";
-       
+
        /*** test mysqli_connect 127.0.0.1 ***/
-       $link = mysqli_connect($host, $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
 
-       mysqli_select_db($link, "test");
+       mysqli_select_db($link, $db);
 
-       mysqli_query($link,"DROP TABLE IF EXISTS test_store_result");
-       mysqli_query($link,"CREATE TABLE test_store_result (a int)");
+       mysqli_query($link,"DROP TABLE IF EXISTS test_store_result");
+       mysqli_query($link,"CREATE TABLE test_store_result (a int)");
 
        mysqli_query($link, "INSERT INTO test_store_result VALUES (1),(2),(3)");
 
@@ -26,6 +29,15 @@ mysqli_get_metadata
        }
        mysqli_stmt_close($stmt);
 
+       /* now we should try mysqli_stmt_reset() */
+       $stmt = mysqli_prepare($link, "SELECT * FROM test_store_result");
+       var_dump(mysqli_execute($stmt));
+       var_dump(mysqli_stmt_reset($stmt));
+       var_dump($stmt = mysqli_prepare($link, "SELECT * FROM test_store_result"));
+       var_dump(mysqli_execute($stmt));
+       var_dump($stmt = @mysqli_prepare($link, "SELECT * FROM test_store_result"), mysqli_error($link));
+       var_dump(mysqli_stmt_reset($stmt));
+
        $stmt = mysqli_prepare($link, "SELECT * FROM test_store_result");
        mysqli_execute($stmt);
        $result1 = mysqli_get_metadata($stmt);
@@ -37,18 +49,46 @@ mysqli_get_metadata
        if ($result = mysqli_query($link, "SELECT * FROM test_store_result")) {
                $row = mysqli_fetch_row($result);
                mysqli_free_result($result);
-       } 
-       
+       }
 
-       var_dump($row); 
+       var_dump($row);
 
        mysqli_free_result($result1);
        mysqli_stmt_close($stmt);
        mysqli_close($link);
+       echo "done!";
 ?>
---EXPECT--
+--EXPECTF--
+bool(true)
+bool(true)
+object(mysqli_stmt)#%d (%d) {
+}
+bool(true)
+bool(false)
+string(0) ""
+
+Warning: mysqli_stmt_reset() expects parameter 1 to be mysqli_stmt, boolean given in %s on line %d
+NULL
 Rows: 3
 array(1) {
   [0]=>
   string(1) "1"
 }
+done!
+--UEXPECTF--
+bool(true)
+bool(true)
+object(mysqli_stmt)#%d (%d) {
+}
+bool(true)
+bool(false)
+unicode(0) ""
+
+Warning: mysqli_stmt_reset() expects parameter 1 to be mysqli_stmt, boolean given in %s on line %d
+NULL
+Rows: 3
+array(1) {
+  [0]=>
+  unicode(1) "1"
+}
+done!
\ No newline at end of file
index 7554d08f687273b5db650373176e2f26e36c5c87..32a735322dad20a479adb4c52aded2ed9b8e2209 100644 (file)
@@ -1,21 +1,24 @@
 --TEST--
 multiple binds
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php 
+require_once('skipif.inc'); 
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
        include "connect.inc";
-       
+
        /*** test mysqli_connect 127.0.0.1 ***/
-       $link = mysqli_connect($host, $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
 
-       mysqli_select_db($link, "test");
+       mysqli_select_db($link, $db);
 
-       mysqli_query($link,"DROP TABLE IF EXISTS mbind");
-       mysqli_query($link,"CREATE TABLE mbind (a int, b varchar(10))");
+       mysqli_query($link,"DROP TABLE IF EXISTS mbind");
+       mysqli_query($link,"CREATE TABLE mbind (a int, b varchar(10))");
 
        $stmt = mysqli_prepare($link, "INSERT INTO mbind VALUES (?,?)");
-       
+
        mysqli_bind_param($stmt, "is", $a, $b);
 
        $a = 1;
@@ -43,8 +46,9 @@ multiple binds
        var_dump((array($e,$f,$g,$h)));
 
        mysqli_close($link);
+       print "done!";
 ?>
---EXPECT--
+--EXPECTF--
 array(4) {
   [0]=>
   int(1)
@@ -55,3 +59,16 @@ array(4) {
   [3]=>
   string(3) "bar"
 }
+done!
+--UEXPECTF--
+array(4) {
+  [0]=>
+  int(1)
+  [1]=>
+  unicode(3) "foo"
+  [2]=>
+  int(2)
+  [3]=>
+  unicode(3) "bar"
+}
+done!
\ No newline at end of file
index 0bc8a62bbf1123c414744c41a55670ad37768725..b56dc26e2a00ba363daf4d6a4b99bb849d90e953 100644 (file)
@@ -1,23 +1,26 @@
 --TEST--
 sqlmode + bind
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php 
+require_once('skipif.inc'); 
+require_once('skipifconnectfailure.inc');
+?>
 --FILE--
 <?php
        include "connect.inc";
-       
+
        /*** test mysqli_connect 127.0.0.1 ***/
-       $link = mysqli_connect($host, $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
 
-       mysqli_select_db($link, "test");
+       mysqli_select_db($link, $db);
 
        mysqli_query($link, "SET SQL_MODE='PIPES_AS_CONCAT'");
 
-       mysqli_query($link,"DROP TABLE IF EXISTS mbind");
-       mysqli_query($link,"CREATE TABLE mbind (b varchar(25))");
+       mysqli_query($link,"DROP TABLE IF EXISTS mbind");
+       mysqli_query($link,"CREATE TABLE mbind (b varchar(25))");
 
        $stmt = mysqli_prepare($link, "INSERT INTO mbind VALUES (?||?)");
-       
+
        mysqli_bind_param($stmt, "ss", $a, $b);
 
        $a = "foo";
@@ -36,6 +39,11 @@ sqlmode + bind
        var_dump($e);
 
        mysqli_close($link);
+       print "done!";
 ?>
 --EXPECT--
 string(6) "foobar"
+done!
+--UEXPECT--
+unicode(6) "foobar"
+done!
\ No newline at end of file