]> granicus.if.org Git - php/commitdiff
Will this never end?
authorUlf Wendel <uw@php.net>
Thu, 12 Jul 2007 20:57:30 +0000 (20:57 +0000)
committerUlf Wendel <uw@php.net>
Thu, 12 Jul 2007 20:57:30 +0000 (20:57 +0000)
   - connection parameter tweaking
   - a bit of whitespace here and there
   - use UEXPECTF if need be

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 5f923ccf34bd910bf7e03045daf5e41f17b93829..1e3fd6403a2f72760b4dd6838d309e8d8065da35 100644 (file)
@@ -1,15 +1,15 @@
 --TEST--
-non freed statement test 
+non freed statement test
 --SKIPIF--
 <?php require_once('skipif.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..72b861831947febdb3e2dae81468d8b591737b8e 100644 (file)
@@ -1,15 +1,15 @@
 --TEST--
-free statement after close 
+free statement after close
 --SKIPIF--
 <?php require_once('skipif.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..24b9db94bd70b3e8de300837ed3c16e47fd084c5 100644 (file)
@@ -9,7 +9,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..5f1de890b5df67fb3f6e6e1bcf125fad2bdf2850 100644 (file)
@@ -9,7 +9,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..756c008fc9ab5eb3a48d20c681ce7043d7cd7d8d 100644 (file)
@@ -9,7 +9,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..0c30a3130475a7832e690bacd172c9b843148f46 100644 (file)
@@ -9,7 +9,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..e723c6158ab85e44ed89735d113a83ec12e30936 100644 (file)
@@ -13,7 +13,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 6f2f797021d17027b0fec279eaa5502c9e223c2c..063126560a0bf2d62887ae64563904236e031276 100644 (file)
@@ -5,14 +5,14 @@ mysqli_get_metadata
 --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 +26,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 +46,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!";
 ?>
 --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]=>
-  %s(1) "1"
+  unicode(1) "1"
 }
+done!
\ No newline at end of file
index 2c08090d99155cf9475d4c2c3cbd307081bdab67..b602b55cd57b18c7b60a73b654e89c0c7c61c462 100644 (file)
@@ -5,17 +5,17 @@ multiple binds
 --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,15 +43,29 @@ multiple binds
        var_dump((array($e,$f,$g,$h)));
 
        mysqli_close($link);
+       print "done!";
 ?>
 --EXPECTF--
 array(4) {
   [0]=>
   int(1)
   [1]=>
-  %s(3) "foo"
+  string(3) "foo"
+  [2]=>
+  int(2)
+  [3]=>
+  string(3) "bar"
+}
+done!
+--UEXPECTF--
+array(4) {
+  [0]=>
+  int(1)
+  [1]=>
+  unicode(3) "foo"
   [2]=>
   int(2)
   [3]=>
-  %s(3) "bar"
+  unicode(3) "bar"
 }
+done!
\ No newline at end of file
index 98149f303a02a7ec6693ae737c6b3f3dab03087c..8ad4d86a08d2c00dd965f140bfad6ece266e2441 100644 (file)
@@ -5,19 +5,19 @@ sqlmode + bind
 --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,8 +36,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