]> granicus.if.org Git - php/commitdiff
adding a few tests
authorGeorg Richter <georg@php.net>
Wed, 12 Feb 2003 00:46:29 +0000 (00:46 +0000)
committerGeorg Richter <georg@php.net>
Wed, 12 Feb 2003 00:46:29 +0000 (00:46 +0000)
35 files changed:
ext/mysqli/tests/001.phpt [new file with mode: 0644]
ext/mysqli/tests/002.phpt [new file with mode: 0644]
ext/mysqli/tests/003.phpt [new file with mode: 0644]
ext/mysqli/tests/004.phpt [new file with mode: 0644]
ext/mysqli/tests/005.phpt [new file with mode: 0644]
ext/mysqli/tests/006.phpt [new file with mode: 0644]
ext/mysqli/tests/007.phpt [new file with mode: 0644]
ext/mysqli/tests/008.phpt [new file with mode: 0644]
ext/mysqli/tests/009.phpt [new file with mode: 0644]
ext/mysqli/tests/010.phpt [new file with mode: 0644]
ext/mysqli/tests/011.phpt [new file with mode: 0644]
ext/mysqli/tests/012.phpt [new file with mode: 0644]
ext/mysqli/tests/013.phpt [new file with mode: 0644]
ext/mysqli/tests/014.phpt [new file with mode: 0644]
ext/mysqli/tests/015.phpt [new file with mode: 0644]
ext/mysqli/tests/016.phpt [new file with mode: 0644]
ext/mysqli/tests/017.phpt [new file with mode: 0644]
ext/mysqli/tests/018.phpt [new file with mode: 0644]
ext/mysqli/tests/019.phpt [new file with mode: 0644]
ext/mysqli/tests/020.phpt [new file with mode: 0644]
ext/mysqli/tests/021.phpt [new file with mode: 0644]
ext/mysqli/tests/022.phpt [new file with mode: 0644]
ext/mysqli/tests/023.phpt [new file with mode: 0644]
ext/mysqli/tests/024.phpt [new file with mode: 0644]
ext/mysqli/tests/025.phpt [new file with mode: 0644]
ext/mysqli/tests/026.phpt [new file with mode: 0644]
ext/mysqli/tests/027.phpt [new file with mode: 0644]
ext/mysqli/tests/028.phpt [new file with mode: 0644]
ext/mysqli/tests/029.phpt [new file with mode: 0644]
ext/mysqli/tests/030.phpt [new file with mode: 0644]
ext/mysqli/tests/031.phpt [new file with mode: 0644]
ext/mysqli/tests/032.phpt [new file with mode: 0644]
ext/mysqli/tests/033.phpt [new file with mode: 0644]
ext/mysqli/tests/034.phpt [new file with mode: 0644]
ext/mysqli/tests/035.phpt [new file with mode: 0644]

diff --git a/ext/mysqli/tests/001.phpt b/ext/mysqli/tests/001.phpt
new file mode 100644 (file)
index 0000000..9386f50
--- /dev/null
@@ -0,0 +1,53 @@
+--TEST--
+mysqli connect
+--FILE--
+<?
+       $user = "root";
+       $passwd = "";
+       $test = "";
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect($host, $user, $passwd);
+       $test .= ($link) ? "1" : "0";
+       mysqli_close($link);
+
+       /*** test mysqli_connect localhost ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+       $test .= ($link) ? "1" : "0";
+       mysqli_close($link);
+
+       /*** test mysqli_connect localhost:port ***/
+       $link = mysqli_connect("localhost", $user, $passwd, "", 3306);
+       $test .= ($link) ? "1" : "0";
+       mysqli_close($link);
+
+       /*** test mysqli_real_connect ***/
+       $link = mysqli_init();  
+       $test.= (mysqli_real_connect($link, "localhost", $user, $passwd)) 
+               ? "1" : "0";
+       mysqli_close($link);
+
+       /*** test mysqli_real_connect with db ***/
+       $link = mysqli_init();  
+       $test .= (mysqli_real_connect($link, "localhost", $user, $passwd, $dbname)) 
+               ? "1" : "0";
+       mysqli_close($link);
+
+       /*** test mysqli_real_connect with port ***/
+       $link = mysqli_init();  
+       $test .= (mysqli_real_connect($link, "localhost", $user, $passwd, $dbname, 3306))
+               ? "1":"0";
+       mysqli_close($link);
+
+       /*** test mysqli_real_connect compressed ***/
+       $link = mysqli_init();  
+       $test .= (mysqli_real_connect($link, "localhost", $user, $passwd, $dbname, 0, NULL, MYSQLI_CLIENT_COMPRESS)) 
+               ? "1" : "0";
+       mysqli_close($link);
+
+       /* todo ssl connections */
+
+       var_dump($test);
+?>
+--EXPECT--
+string(7) "1111111"
diff --git a/ext/mysqli/tests/002.phpt b/ext/mysqli/tests/002.phpt
new file mode 100644 (file)
index 0000000..bbf5808
--- /dev/null
@@ -0,0 +1,60 @@
+--TEST--
+mysqli bind_result 1 
+--FILE--
+<?php
+       include "connect.inc";
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");                
+       $rc = mysqli_query($link,"DROP TABLE IF EXISTS test_fetch_null");
+
+       $rc = mysqli_query($link,"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))");
+  
+       $rc = mysqli_query($link,"INSERT INTO test_fetch_null(col1,col10, col11) VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)");
+
+       $stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from test_fetch_null");
+       mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7, &$c8, &$c9, &$c10, &$c11); 
+       mysqli_execute($stmt);
+
+       mysqli_fetch($stmt);
+
+       $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11);
+
+       var_dump($test);
+
+       mysqli_stmt_close($stmt);
+       mysqli_close($link);
+?>
+--EXPECT--
+array(11) {
+  [0]=>
+  int(1)
+  [1]=>
+  NULL
+  [2]=>
+  NULL
+  [3]=>
+  NULL
+  [4]=>
+  NULL
+  [5]=>
+  NULL
+  [6]=>
+  NULL
+  [7]=>
+  NULL
+  [8]=>
+  NULL
+  [9]=>
+  string(4) "foo1"
+  [10]=>
+  string(4) "1000"
+}
diff --git a/ext/mysqli/tests/003.phpt b/ext/mysqli/tests/003.phpt
new file mode 100644 (file)
index 0000000..6baae8a
--- /dev/null
@@ -0,0 +1,56 @@
+--TEST--
+mysqli connect
+--FILE--
+<?php
+       include "connect.inc";
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");
+               
+       mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result");
+       mysqli_query($link,"CREATE TABLE test_bind_result(c1 date, c2 time, 
+                                                        c3 timestamp(14), 
+                                                        c4 year, 
+                                                        c5 datetime, 
+                                                        c6 timestamp(4), 
+                                                        c7 timestamp(6))");
+
+       mysqli_query($link,"INSERT INTO test_bind_result VALUES('2002-01-02',
+                                                              '12:49:00',
+                                                              '2002-01-02 17:46:59', 
+                                                              2010,
+                                                              '2010-07-10', 
+                                                              '2020','1999-12-29')");
+
+       $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
+
+       mysqli_bind_result($stmt,&$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
+       mysqli_execute($stmt);
+       mysqli_fetch($stmt);
+
+       $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+
+       var_dump($test);
+
+       mysqli_stmt_close($stmt);
+       mysqli_close($link);
+?>
+--EXPECT--
+array(7) {
+  [0]=>
+  string(10) "2002-01-02"
+  [1]=>
+  string(8) "12:49:00"
+  [2]=>
+  string(19) "2002-01-02 17:46:59"
+  [3]=>
+  int(2010)
+  [4]=>
+  string(19) "2010-07-10 00:00:00"
+  [5]=>
+  string(0) ""
+  [6]=>
+  string(19) "1999-12-29 00:00:00"
+}
diff --git a/ext/mysqli/tests/004.phpt b/ext/mysqli/tests/004.phpt
new file mode 100644 (file)
index 0000000..1469bb5
--- /dev/null
@@ -0,0 +1,35 @@
+--TEST--
+mysqli fetch char/text 
+--FILE--
+<?php
+       include ("connect.inc");
+
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");
+
+       mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+       mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)");
+
+       mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', 'this is a test')");
+
+       $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+       mysqli_bind_result($stmt, &$c1, &$c2);
+       mysqli_execute($stmt);
+       mysqli_fetch($stmt);
+
+       $test = array($c1,$c2);
+
+       var_dump($test);
+
+       mysqli_stmt_close($stmt);
+       mysqli_close($link);
+?>
+--EXPECT--
+array(2) {
+  [0]=>
+  string(10) "1234567890"
+  [1]=>
+  string(14) "this is a test"
+}
diff --git a/ext/mysqli/tests/005.phpt b/ext/mysqli/tests/005.phpt
new file mode 100644 (file)
index 0000000..5688770
--- /dev/null
@@ -0,0 +1,38 @@
+--TEST--
+mysqli fetch char/text long 
+--FILE--
+<?php
+       include "connect.inc";
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");
+
+       mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+       mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)");
+
+       $a = str_repeat("A1", 32000);
+
+       mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', '$a')");
+
+       $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+       mysqli_bind_result($stmt, &$c1, &$c2);
+       mysqli_execute($stmt);
+       mysqli_fetch($stmt);
+
+       $test[] = $c1;
+       $test[] = ($a == $c2) ? "32K String ok" : "32K String failed";
+
+       var_dump($test);
+
+       mysqli_stmt_close($stmt);
+       mysqli_close($link);
+?>
+--EXPECT--
+array(2) {
+  [0]=>
+  string(10) "1234567890"
+  [1]=>
+  string(13) "32K String ok"
+}
diff --git a/ext/mysqli/tests/006.phpt b/ext/mysqli/tests/006.phpt
new file mode 100644 (file)
index 0000000..059ce14
--- /dev/null
@@ -0,0 +1,51 @@
+--TEST--
+mysqli fetch long values
+--FILE--
+<?php
+       include "connect.inc";
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");
+
+       mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+       mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned,
+                                                     c2 int unsigned,
+                                                     c3 int,
+                                                     c4 int,
+                                                     c5 int,
+                                                     c6 int unsigned,
+                                                     c7 int)");
+
+       mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,35999,NULL,-500,-9999999,-0,0)");
+
+       $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+       mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
+       mysqli_execute($stmt);
+       mysqli_fetch($stmt);
+
+       $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+
+       var_dump($test);
+
+       mysqli_stmt_close($stmt);
+       mysqli_close($link);
+?>
+--EXPECT--
+array(7) {
+  [0]=>
+  int(0)
+  [1]=>
+  int(35999)
+  [2]=>
+  NULL
+  [3]=>
+  int(-500)
+  [4]=>
+  int(-9999999)
+  [5]=>
+  int(0)
+  [6]=>
+  int(0)
+}
diff --git a/ext/mysqli/tests/007.phpt b/ext/mysqli/tests/007.phpt
new file mode 100644 (file)
index 0000000..89d1959
--- /dev/null
@@ -0,0 +1,51 @@
+--TEST--
+mysqli fetch short values
+--FILE--
+<?php
+       include "connect.inc";
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");
+
+       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, "INSERT INTO test_bind_fetch VALUES (-23,35999,NULL,-500,-9999999,+30,0)");
+
+       $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+       mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
+       mysqli_execute($stmt);
+       mysqli_fetch($stmt);
+
+       $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+
+       var_dump($test);
+
+       mysqli_stmt_close($stmt);
+       mysqli_close($link);
+?>
+--EXPECT--
+array(7) {
+  [0]=>
+  int(0)
+  [1]=>
+  int(35999)
+  [2]=>
+  NULL
+  [3]=>
+  int(-500)
+  [4]=>
+  int(-32768)
+  [5]=>
+  int(30)
+  [6]=>
+  int(0)
+}
diff --git a/ext/mysqli/tests/008.phpt b/ext/mysqli/tests/008.phpt
new file mode 100644 (file)
index 0000000..92498da
--- /dev/null
@@ -0,0 +1,53 @@
+--TEST--
+mysqli fetch tinyint values
+--FILE--
+<?php
+       include "connect.inc";
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");
+
+       mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+       mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 tinyint,
+                                                     c2 tinyint unsigned,
+                                                     c3 tinyint not NULL,
+                                                     c4 tinyint,
+                                                     c5 tinyint,
+                                                     c6 tinyint unsigned,
+                                                     c7 tinyint)");
+
+       mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,300,0,-100,-127,+30,0)");
+
+       $c1 = $c2 = $c3 = $c4 = $c5 = $c6 = $c7 = NULL;
+
+       $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+       mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
+       mysqli_execute($stmt);
+       mysqli_fetch($stmt);
+
+       $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+
+       var_dump($test);
+
+       mysqli_stmt_close($stmt);
+       mysqli_close($link);
+?>
+--EXPECT--
+array(7) {
+  [0]=>
+  int(-23)
+  [1]=>
+  int(255)
+  [2]=>
+  int(0)
+  [3]=>
+  int(-100)
+  [4]=>
+  int(-127)
+  [5]=>
+  int(30)
+  [6]=>
+  int(0)
+}
diff --git a/ext/mysqli/tests/009.phpt b/ext/mysqli/tests/009.phpt
new file mode 100644 (file)
index 0000000..942b443
--- /dev/null
@@ -0,0 +1,51 @@
+--TEST--
+mysqli fetch bigint values
+--FILE--
+<?php
+       include "connect.inc";
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");
+
+       mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+       mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 bigint default 5,
+                                                     c2 bigint,
+                                                     c3 bigint not NULL,
+                                                     c4 bigint unsigned,
+                                                     c5 bigint unsigned,
+                                                     c6 bigint unsigned,
+                                                     c7 bigint unsigned)");
+
+       mysqli_query($link, "INSERT INTO test_bind_fetch (c2,c3,c4,c5,c6,c7) VALUES (-23,4.0,33333333333333,0,-333333333333,99.9)");
+
+       $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+       mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
+       mysqli_execute($stmt);
+       mysqli_fetch($stmt);
+
+       $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+
+       var_dump($test);
+
+       mysqli_stmt_close($stmt);
+       mysqli_close($link);
+?>
+--EXPECT--
+array(7) {
+  [0]=>
+  int(5)
+  [1]=>
+  int(-23)
+  [2]=>
+  int(4)
+  [3]=>
+  string(14) "33333333333333"
+  [4]=>
+  int(0)
+  [5]=>
+  string(13) "-333333333333"
+  [6]=>
+  int(100)
+}
diff --git a/ext/mysqli/tests/010.phpt b/ext/mysqli/tests/010.phpt
new file mode 100644 (file)
index 0000000..2986277
--- /dev/null
@@ -0,0 +1,54 @@
+--TEST--
+mysqli fetch float values
+--FILE--
+<?php
+       include "connect.inc";
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");
+
+       mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+
+       mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 float(3),
+                                                     c2 float,
+                                                     c3 float unsigned,
+                                                     c4 float,
+                                                     c5 float,
+                                                     c6 float,
+                                                     c7 float(10) unsigned)");
+
+
+       mysqli_query($link, "INSERT INTO test_bind_fetch (c1,c2,c3,c4,c5,c6,c7) VALUES (3.1415926535,-0.000001, -5, 999999999999,
+                                                                                       sin(0.6), 1.00000000000001, 888888888888888)");
+
+       $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+       mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
+       mysqli_execute($stmt);
+       mysqli_fetch($stmt);
+
+       $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+
+       var_dump($test);
+
+       mysqli_stmt_close($stmt);
+       mysqli_close($link);
+?>
+--EXPECT--
+array(7) {
+  [0]=>
+  float(3.1415927410126)
+  [1]=>
+  float(-9.9999999747524E-7)
+  [2]=>
+  float(0)
+  [3]=>
+  float(999999995904)
+  [4]=>
+  float(0.56464248895645)
+  [5]=>
+  float(1)
+  [6]=>
+  float(888888914608130)
+}
diff --git a/ext/mysqli/tests/011.phpt b/ext/mysqli/tests/011.phpt
new file mode 100644 (file)
index 0000000..5735e2f
--- /dev/null
@@ -0,0 +1,53 @@
+--TEST--
+mysqli fetch mixed values
+--FILE--
+<?php
+       include "connect.inc";
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");
+
+       mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result");
+
+       mysqli_query($link,"CREATE TABLE test_bind_result(c1 tinyint, c2 smallint, 
+                                                        c3 int, c4 bigint, 
+                                                        c5 float, c6 double,
+                                                        c7 varbinary(10), 
+                                                        c8 varchar(50))");
+
+       mysqli_query($link,"INSERT INTO test_bind_result VALUES(19,2999,3999,4999999,
+                                                              2345.6,5678.89563,
+                                                              'foobar','mysql rulez')");
+       $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
+       mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7, &$c8);
+       mysqli_execute($stmt);
+       mysqli_fetch($stmt);
+
+       $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8);
+
+       var_dump($test);
+
+       mysqli_stmt_close($stmt);
+       mysqli_close($link);
+?>
+--EXPECT--
+array(8) {
+  [0]=>
+  int(19)
+  [1]=>
+  int(2999)
+  [2]=>
+  int(3999)
+  [3]=>
+  int(4999999)
+  [4]=>
+  float(2345.6000976563)
+  [5]=>
+  float(5678.89563)
+  [6]=>
+  string(6) "foobar"
+  [7]=>
+  string(11) "mysql rulez"
+}
diff --git a/ext/mysqli/tests/012.phpt b/ext/mysqli/tests/012.phpt
new file mode 100644 (file)
index 0000000..38ef311
--- /dev/null
@@ -0,0 +1,54 @@
+--TEST--
+mysqli fetch mixed values 2
+--FILE--
+<?php
+       include "connect.inc";
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");
+
+       mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result");
+
+       mysqli_query($link,"CREATE TABLE test_bind_result(c1 tinyint, c2 smallint, 
+                                                        c3 int, c4 bigint, 
+                                                        c5 float, c6 double,
+                                                        c7 varbinary(10), 
+                                                        c8 varchar(10))");
+
+       mysqli_query($link,"INSERT INTO test_bind_result VALUES(120,2999,3999,54,
+                                                              2.6,58.89,
+                                                              '206','6.7')");
+
+       $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
+       mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7, &$c8);
+       mysqli_execute($stmt);
+       mysqli_fetch($stmt);
+
+       $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8);
+
+       var_dump($test);
+
+       mysqli_stmt_close($stmt);
+       mysqli_close($link);
+?>
+--EXPECT--
+array(8) {
+  [0]=>
+  int(120)
+  [1]=>
+  int(2999)
+  [2]=>
+  int(3999)
+  [3]=>
+  int(54)
+  [4]=>
+  float(2.5999999046326)
+  [5]=>
+  float(58.89)
+  [6]=>
+  string(3) "206"
+  [7]=>
+  string(3) "6.7"
+}
diff --git a/ext/mysqli/tests/013.phpt b/ext/mysqli/tests/013.phpt
new file mode 100644 (file)
index 0000000..dafc9bb
--- /dev/null
@@ -0,0 +1,45 @@
+--TEST--
+mysqli fetch mixed / mysql_query 
+--FILE--
+<?php
+       include "connect.inc";
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");
+
+       mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result");
+
+       mysqli_query($link,"CREATE TABLE test_bind_result(c1 tinyint, c2 smallint, 
+                                                        c3 int, c4 bigint, 
+                                                        c5 decimal(4,2), c6 double,
+                                                        c7 varbinary(10), 
+                                                        c8 varchar(10))");
+
+       mysqli_query($link,"INSERT INTO test_bind_result VALUES(120,2999,3999,54,
+                                                              2.6,58.89,
+                                                              '206','6.7')");
+       $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
+
+       $c = array(0,0,0,0,0,0,0,0);
+       mysqli_bind_result($stmt, &$c[0], &$c[1], &$c[2], &$c[3], &$c[4], &$c[5], &$c[6], &$c[7]);
+       mysqli_execute($stmt);
+       mysqli_fetch($stmt); 
+       mysqli_fetch($stmt);  
+       mysqli_stmt_close($stmt);
+
+       $result = mysqli_query($link, "select * from test_bind_result");
+       $d = mysqli_fetch_row($result); 
+       mysqli_free_result($result);
+
+       $test = "";
+       for ($i=0; $i < count($c); $i++)
+               $test .= ($c[0] == $d[0]) ? "1" : "0";
+
+       var_dump($test);
+
+       mysqli_close($link);
+?>
+--EXPECT--
+string(8) "11111111"
diff --git a/ext/mysqli/tests/014.phpt b/ext/mysqli/tests/014.phpt
new file mode 100644 (file)
index 0000000..74ba7b5
--- /dev/null
@@ -0,0 +1,56 @@
+--TEST--
+mysqli autocommit/commit/rollback 
+--FILE--
+<?php
+       include "connect.inc";
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");
+
+       mysqli_autocommit($link, TRUE);
+
+       mysqli_query($link,"DROP TABLE IF EXISTS ac_01");
+
+       mysqli_query($link,"CREATE TABLE ac_01(a int, b varchar(10)) type=InnoDB");
+
+       mysqli_query($link, "INSERT INTO ac_01 VALUES (1, 'foobar')");
+       mysqli_autocommit($link, FALSE);
+
+       mysqli_query($link, "DELETE FROM ac_01");
+       mysqli_query($link, "INSERT INTO ac_01 VALUES (2, 'egon')");
+
+       mysqli_rollback($link);
+
+       $result = mysqli_query($link, "SELECT * FROM ac_01");
+       $row = mysqli_fetch_row($result);
+       mysqli_free_result($result);
+
+       var_dump($row);
+
+       mysqli_query($link, "DELETE FROM ac_01");
+       mysqli_query($link, "INSERT INTO ac_01 VALUES (2, 'egon')");
+       mysqli_commit($link);
+
+       $result = mysqli_query($link, "SELECT * FROM ac_01");
+       $row = mysqli_fetch_row($result);
+       mysqli_free_result($result);
+
+       var_dump($row);
+
+       mysqli_close($link);
+?>
+--EXPECT--
+array(2) {
+  [0]=>
+  string(1) "1"
+  [1]=>
+  string(6) "foobar"
+}
+array(2) {
+  [0]=>
+  string(1) "2"
+  [1]=>
+  string(4) "egon"
+}
diff --git a/ext/mysqli/tests/015.phpt b/ext/mysqli/tests/015.phpt
new file mode 100644 (file)
index 0000000..822bf67
--- /dev/null
@@ -0,0 +1,55 @@
+--TEST--
+mysqli autocommit/commit/rollback with myisam 
+--FILE--
+<?php
+       include "connect.inc";
+       
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");
+
+       mysqli_autocommit($link, TRUE);
+
+       mysqli_query($link,"DROP TABLE IF EXISTS ac_01");
+
+       mysqli_query($link,"CREATE TABLE ac_01(a int, b varchar(10))");
+
+       mysqli_query($link, "INSERT INTO ac_01 VALUES (1, 'foobar')");
+       mysqli_autocommit($link, FALSE);
+
+       mysqli_query($link, "DELETE FROM ac_01");
+       mysqli_query($link, "INSERT INTO ac_01 VALUES (2, 'egon')");
+
+       mysqli_rollback($link);
+
+       $result = mysqli_query($link, "SELECT * FROM ac_01");
+       $row = mysqli_fetch_row($result);
+       mysqli_free_result($result);
+
+       var_dump($row);
+
+       mysqli_query($link, "DELETE FROM ac_01");
+       mysqli_query($link, "INSERT INTO ac_01 VALUES (2, 'egon')");
+       mysqli_commit($link);
+
+       $result = mysqli_query($link, "SELECT * FROM ac_01");
+       $row = mysqli_fetch_row($result);
+       mysqli_free_result($result);
+
+       var_dump($row);
+
+       mysqli_close($link);
+?>
+--EXPECT--
+array(2) {
+  [0]=>
+  string(1) "2"
+  [1]=>
+  string(4) "egon"
+}
+array(2) {
+  [0]=>
+  string(1) "2"
+  [1]=>
+  string(4) "egon"
+}
diff --git a/ext/mysqli/tests/016.phpt b/ext/mysqli/tests/016.phpt
new file mode 100644 (file)
index 0000000..7d84c29
--- /dev/null
@@ -0,0 +1,25 @@
+--TEST--
+mysqli fetch user variable 
+--FILE--
+<?php
+       include "connect.inc";
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");
+
+       mysqli_query($link, "SET @dummy='foobar'");
+
+       $stmt = mysqli_prepare($link, "SELECT @dummy");
+       mysqli_bind_result($stmt, &$dummy);
+       mysqli_execute($stmt);
+       mysqli_fetch($stmt);
+
+       var_dump($dummy);
+
+       mysqli_stmt_close($stmt);
+       mysqli_close($link);
+?>
+--EXPECT--
+string(6) "foobar"
diff --git a/ext/mysqli/tests/017.phpt b/ext/mysqli/tests/017.phpt
new file mode 100644 (file)
index 0000000..e7aaf74
--- /dev/null
@@ -0,0 +1,30 @@
+--TEST--
+mysqli fetch functions 
+--FILE--
+<?php
+       include "connect.inc";
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");
+
+       $stmt = mysqli_prepare($link, "SELECT current_user(), database()");
+       mysqli_bind_result($stmt, &$c0, &$c1); 
+       mysqli_execute($stmt);
+
+       mysqli_fetch($stmt);
+
+       $test = array($c0, $c1);
+
+       var_dump($test);
+
+       mysqli_close($link);
+?>
+--EXPECT--
+array(2) {
+  [0]=>
+  string(14) "root@localhost"
+  [1]=>
+  string(4) "test"
+}
diff --git a/ext/mysqli/tests/018.phpt b/ext/mysqli/tests/018.phpt
new file mode 100644 (file)
index 0000000..8fb0d44
--- /dev/null
@@ -0,0 +1,25 @@
+--TEST--
+mysqli fetch system variables
+--FILE--
+<?php
+       include "connect.inc";
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");
+
+       mysqli_query($link, "SET AUTOCOMMIT=0");
+
+       $stmt = mysqli_prepare($link, "SELECT @@autocommit");
+       mysqli_bind_result($stmt, &$c0); 
+       mysqli_execute($stmt);
+
+       mysqli_fetch($stmt);
+
+       var_dump($c0);
+
+       mysqli_close($link);
+?>
+--EXPECT--
+int(0)
diff --git a/ext/mysqli/tests/019.phpt b/ext/mysqli/tests/019.phpt
new file mode 100644 (file)
index 0000000..0e13f75
--- /dev/null
@@ -0,0 +1,68 @@
+--TEST--
+mysqli fetch (bind_param + bind_result) 
+--FILE--
+<?php
+       include "connect.inc";
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");                
+       $rc = mysqli_query($link,"DROP TABLE IF EXISTS insert_read");
+
+       $rc = mysqli_query($link,"CREATE TABLE insert_read(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))");
+  
+       $stmt=  mysqli_prepare($link,"INSERT INTO insert_read(col1,col10, col11) VALUES(?,?,?)");
+       mysqli_bind_param($stmt, &$c1, MYSQLI_BIND_INT, &$c2, MYSQLI_BIND_STRING, &$c3, MYSQLI_BIND_STRING);
+
+       $c1 = 1;
+       $c2 = "foo";
+       $c3 = "foobar";
+
+       mysqli_execute($stmt);
+       mysqli_stmt_close($stmt);
+
+       $stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from insert_read");
+       mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7, &$c8, &$c9, &$c10, &$c11); 
+       mysqli_execute($stmt);
+
+       mysqli_fetch($stmt);
+
+       $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11);
+
+       var_dump($test);
+
+       mysqli_stmt_close($stmt);
+       mysqli_close($link);
+?>
+--EXPECT--
+array(11) {
+  [0]=>
+  int(1)
+  [1]=>
+  NULL
+  [2]=>
+  NULL
+  [3]=>
+  NULL
+  [4]=>
+  NULL
+  [5]=>
+  NULL
+  [6]=>
+  NULL
+  [7]=>
+  NULL
+  [8]=>
+  NULL
+  [9]=>
+  string(3) "foo"
+  [10]=>
+  string(6) "foobar"
+}
diff --git a/ext/mysqli/tests/020.phpt b/ext/mysqli/tests/020.phpt
new file mode 100644 (file)
index 0000000..53827d0
--- /dev/null
@@ -0,0 +1,70 @@
+--TEST--
+mysqli bind_param/bind_result date
+--FILE--
+<?php
+       include "connect.inc";
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");
+               
+       mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result");
+       mysqli_query($link,"CREATE TABLE test_bind_result(c1 date, c2 time, 
+                                                        c3 timestamp(14), 
+                                                        c4 year, 
+                                                        c5 datetime, 
+                                                        c6 timestamp(4), 
+                                                        c7 timestamp(6))");
+
+       $stmt = mysqli_prepare($link, "INSERT INTO test_bind_result VALUES (?,?,?,?,?,?,?)");
+       mysqli_bind_param($stmt, &$d1, MYSQLI_BIND_STRING,
+                                &$d2, MYSQLI_BIND_STRING,
+                                &$d3, MYSQLI_BIND_STRING,
+                                &$d4, MYSQLI_BIND_STRING,
+                                &$d5, MYSQLI_BIND_STRING,
+                                &$d6, MYSQLI_BIND_STRING,
+                                &$d7, MYSQLI_BIND_STRING);
+
+       $d1 = '2002-01-02';
+       $d2 = '12:49:00';
+       $d3 = '2002-01-02 17:46:59';
+       $d4 = 2010;
+       $d5 ='2010-07-10';
+       $d6 = '2020';
+       $d7 = '1999-12-29';
+
+       mysqli_execute($stmt);
+       mysqli_stmt_close($stmt);
+
+       $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
+
+       mysqli_bind_result($stmt,&$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
+       
+       mysqli_execute($stmt);
+       mysqli_fetch($stmt);
+
+       $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+
+       var_dump($test);
+
+       mysqli_stmt_close($stmt);
+       mysqli_close($link);
+?>
+--EXPECT--
+array(7) {
+  [0]=>
+  string(10) "2002-01-02"
+  [1]=>
+  string(8) "12:49:00"
+  [2]=>
+  string(19) "2002-01-02 17:46:59"
+  [3]=>
+  int(2010)
+  [4]=>
+  string(19) "2010-07-10 00:00:00"
+  [5]=>
+  string(0) ""
+  [6]=>
+  string(19) "1999-12-29 00:00:00"
+}
diff --git a/ext/mysqli/tests/021.phpt b/ext/mysqli/tests/021.phpt
new file mode 100644 (file)
index 0000000..deabef6
--- /dev/null
@@ -0,0 +1,40 @@
+--TEST--
+mysqli bind_param+bind_result char/text 
+--FILE--
+<?php
+       include "connect.inc";
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");
+
+       mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+       mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)");
+
+       $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
+       mysqli_bind_param($stmt, &$q1, MYSQLI_BIND_STRING, &$q2, MYSQLI_BIND_STRING);
+       $q1 = "1234567890";
+       $q2 = "this is a test";
+       mysqli_execute($stmt);
+       mysqli_stmt_close($stmt);
+
+       $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+       mysqli_bind_result($stmt, &$c1, &$c2);
+       mysqli_execute($stmt);
+       mysqli_fetch($stmt);
+
+       $test = array($c1,$c2);
+
+       var_dump($test);
+
+       mysqli_stmt_close($stmt);
+       mysqli_close($link);
+?>
+--EXPECT--
+array(2) {
+  [0]=>
+  string(10) "1234567890"
+  [1]=>
+  string(14) "this is a test"
+}
diff --git a/ext/mysqli/tests/022.phpt b/ext/mysqli/tests/022.phpt
new file mode 100644 (file)
index 0000000..efd2fef
--- /dev/null
@@ -0,0 +1,44 @@
+--TEST--
+mysqli bind_param/bind_result char/text long 
+--FILE--
+<?php
+       include "connect.inc";
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");
+
+       mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+       mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)");
+
+
+       $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
+       mysqli_bind_param($stmt, &$a1, MYSQLI_BIND_STRING, &$a2, MYSQLI_BIND_STRING);
+
+       $a1 = "1234567890";
+       $a2 = str_repeat("A1", 32000);
+
+       mysqli_execute($stmt);
+       mysqli_stmt_close($stmt);
+
+       $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+       mysqli_bind_result($stmt, &$c1, &$c2);
+       mysqli_execute($stmt);
+       mysqli_fetch($stmt);
+
+       $test[] = $c1;
+       $test[] = ($a2 == $c2) ? "32K String ok" : "32K String failed";
+
+       var_dump($test);
+
+       mysqli_stmt_close($stmt);
+       mysqli_close($link);
+?>
+--EXPECT--
+array(2) {
+  [0]=>
+  string(10) "1234567890"
+  [1]=>
+  string(13) "32K String ok"
+}
diff --git a/ext/mysqli/tests/023.phpt b/ext/mysqli/tests/023.phpt
new file mode 100644 (file)
index 0000000..fcbd4b2
--- /dev/null
@@ -0,0 +1,64 @@
+--TEST--
+mysqli bind_param/bind_prepare fetch long values
+--FILE--
+<?php
+       include "connect.inc";
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");
+
+       mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+       mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned,
+                                                     c2 int unsigned,
+                                                     c3 int,
+                                                     c4 int,
+                                                     c5 int,
+                                                     c6 int unsigned,
+                                                     c7 int)");
+
+       $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)");
+       mysqli_bind_param($stmt, &$c1,MYSQLI_BIND_INT,&$c2,MYSQLI_BIND_INT,&$c3,MYSQLI_BIND_INT,
+                                &$c4,MYSQLI_BIND_INT,&$c5,MYSQLI_BIND_INT,&$c6,MYSQLI_BIND_INT,
+                                &$c7, MYSQLI_BIND_INT);
+       $c1 = -23;
+       $c2 = 35999;
+       $c3 = NULL;
+       $c4 = -500;
+       $c5 = -9999999;
+       $c6 = -0;
+       $c7 = 0;
+
+       mysqli_execute($stmt);
+       mysqli_stmt_close($stmt);
+
+       $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+       mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
+       mysqli_execute($stmt);
+       mysqli_fetch($stmt);
+
+       $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+
+       var_dump($test);
+
+       mysqli_stmt_close($stmt);
+       mysqli_close($link);
+?>
+--EXPECT--
+array(7) {
+  [0]=>
+  int(0)
+  [1]=>
+  int(35999)
+  [2]=>
+  NULL
+  [3]=>
+  int(-500)
+  [4]=>
+  int(-9999999)
+  [5]=>
+  int(0)
+  [6]=>
+  int(0)
+}
diff --git a/ext/mysqli/tests/024.phpt b/ext/mysqli/tests/024.phpt
new file mode 100644 (file)
index 0000000..e31064a
--- /dev/null
@@ -0,0 +1,65 @@
+--TEST--
+mysqli bind_param/bind_result short values
+--FILE--
+<?php
+       include "connect.inc";
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");
+
+       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, &$c1,MYSQLI_BIND_INT,&$c2,MYSQLI_BIND_INT,&$c3,MYSQLI_BIND_INT,
+                                &$c4,MYSQLI_BIND_INT,&$c5,MYSQLI_BIND_INT,&$c6,MYSQLI_BIND_INT,
+                                &$c7, MYSQLI_BIND_INT);
+
+       $c1 = -23;
+       $c2 = 35999;
+       $c3 = NULL;
+       $c4 = -500;
+       $c5 = -9999999;
+       $c6 = -0;
+       $c7 = 0;
+
+       mysqli_execute($stmt);
+       mysqli_stmt_close($stmt);
+
+       $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+       mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
+       mysqli_execute($stmt);
+       mysqli_fetch($stmt);
+
+       $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+
+       var_dump($test);
+
+       mysqli_stmt_close($stmt);
+       mysqli_close($link);
+?>
+--EXPECT--
+array(7) {
+  [0]=>
+  int(0)
+  [1]=>
+  int(35999)
+  [2]=>
+  NULL
+  [3]=>
+  int(-500)
+  [4]=>
+  int(-32768)
+  [5]=>
+  int(0)
+  [6]=>
+  int(0)
+}
diff --git a/ext/mysqli/tests/025.phpt b/ext/mysqli/tests/025.phpt
new file mode 100644 (file)
index 0000000..f32ef14
--- /dev/null
@@ -0,0 +1,68 @@
+--TEST--
+mysqli bind_param/bind_result tinyint values
+--FILE--
+<?php
+       include "connect.inc";
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");
+
+       mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+       mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 tinyint,
+                                                     c2 tinyint unsigned,
+                                                     c3 tinyint not NULL,
+                                                     c4 tinyint,
+                                                     c5 tinyint,
+                                                     c6 tinyint unsigned,
+                                                     c7 tinyint)");
+
+       $stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES(?,?,?,?,?,?,?)");
+       mysqli_bind_param($stmt,&$c1, MYSQLI_BIND_INT,&$c2, MYSQLI_BIND_INT,&$c3, MYSQLI_BIND_INT,&$c4, MYSQLI_BIND_INT,
+                               &$c5, MYSQLI_BIND_INT,&$c6, MYSQLI_BIND_INT,&$c7, MYSQLI_BIND_INT);
+
+       $c1 = -23;
+       $c2 = 300;
+       $c3 = 0;
+       $c4 = -100;
+       $c5 = -127;
+       $c6 = 30;
+       $c7 = 0;
+
+       mysqli_execute($stmt);
+       mysqli_stmt_close($stmt);
+
+       mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,300,0,-100,-127,+30,0)");
+
+       $c1 = $c2 = $c3 = $c4 = $c5 = $c6 = $c7 = NULL;
+
+       $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+       mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
+       mysqli_execute($stmt);
+       mysqli_fetch($stmt);
+
+       $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+
+       var_dump($test);
+
+       mysqli_stmt_close($stmt);
+       mysqli_close($link);
+?>
+--EXPECT--
+array(7) {
+  [0]=>
+  int(-23)
+  [1]=>
+  int(255)
+  [2]=>
+  int(0)
+  [3]=>
+  int(-100)
+  [4]=>
+  int(-127)
+  [5]=>
+  int(30)
+  [6]=>
+  int(0)
+}
diff --git a/ext/mysqli/tests/026.phpt b/ext/mysqli/tests/026.phpt
new file mode 100644 (file)
index 0000000..ef1b668
--- /dev/null
@@ -0,0 +1,48 @@
+--TEST--
+mysqli bind_param/bind_result with send_long_data 
+--FILE--
+<?php
+       $user = "root";
+       $passwd = "";
+
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");
+
+       mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+       mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 varchar(10), c2 text)");
+
+       $stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
+       mysqli_bind_param($stmt,&$c1, MYSQLI_BIND_STRING, &$c2, MYSQLI_BIND_SEND_DATA);
+
+       $c1 = "Hello World";
+
+       mysqli_send_long_data($stmt, 2, "This is the first sentence.");
+       mysqli_send_long_data($stmt, 2, " And this is the second sentence.");
+       mysqli_send_long_data($stmt, 2, " And finally this is the last sentence.");
+
+       mysqli_execute($stmt);
+       mysqli_stmt_close($stmt);
+
+       $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+       mysqli_bind_result($stmt, &$d1, &$d2);
+       mysqli_execute($stmt);
+       mysqli_fetch($stmt);
+
+       $test = array($d1,$d2);
+
+       var_dump($test);
+
+       mysqli_stmt_close($stmt);
+
+       mysqli_close($link);
+?>
+--EXPECT--
+array(2) {
+  [0]=>
+  string(10) "Hello Worl"
+  [1]=>
+  string(99) "This is the first sentence. And this is the second sentence. And finally this is the last sentence."
+}
diff --git a/ext/mysqli/tests/027.phpt b/ext/mysqli/tests/027.phpt
new file mode 100644 (file)
index 0000000..ae36574
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+function test: mysqli_stat
+--FILE--
+<?php
+       $user = "root";
+       $passwd = "";
+
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       $status = mysqli_stat($link);
+
+       $x = explode('  ', $status);
+
+       var_dump(count($x));
+
+       mysqli_close($link);
+?>
+--EXPECT--
+int(10)
diff --git a/ext/mysqli/tests/028.phpt b/ext/mysqli/tests/028.phpt
new file mode 100644 (file)
index 0000000..2954d28
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST--
+function test: mysqli_character_set_name
+--FILE--
+<?php
+       $user = "root";
+       $passwd = "";
+
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       $cset = mysqli_character_set_name($link);
+
+       var_dump($cset);
+
+       mysqli_close($link);
+?>
+--EXPECT--
+string(6) "latin1"
diff --git a/ext/mysqli/tests/029.phpt b/ext/mysqli/tests/029.phpt
new file mode 100644 (file)
index 0000000..7680b22
--- /dev/null
@@ -0,0 +1,25 @@
+--TEST--
+function test: mysqli_affected_rows
+--FILE--
+<?php
+       $user = "root";
+       $passwd = "";
+
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");
+
+       mysqli_query($link, "drop table if exists general_test");
+       mysqli_query($link, "create table general_test (a int)");
+       mysqli_query($link, "insert into general_test values (1),(2),(3)");
+
+       $afc = mysqli_affected_rows($link);
+
+       var_dump($afc);
+
+       mysqli_close($link);
+?>
+--EXPECT--
+int(3)
diff --git a/ext/mysqli/tests/030.phpt b/ext/mysqli/tests/030.phpt
new file mode 100644 (file)
index 0000000..da87218
--- /dev/null
@@ -0,0 +1,24 @@
+--TEST--
+function test: mysqli_errno
+--FILE--
+<?php
+       $user = "root";
+       $passwd = "";
+
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+       $errno = mysqli_errno($link);
+       var_dump($errno);
+
+       mysqli_select_db($link, "test");
+
+       mysqli_query($link, "select * from non_exisiting_table");
+       $errno = mysqli_errno($link);   
+
+       var_dump($errno);
+
+       mysqli_close($link);
+?>
+--EXPECT--
+int(0)
+int(1146)
diff --git a/ext/mysqli/tests/031.phpt b/ext/mysqli/tests/031.phpt
new file mode 100644 (file)
index 0000000..61bfb5b
--- /dev/null
@@ -0,0 +1,24 @@
+--TEST--
+function test: mysqli_error
+--FILE--
+<?php
+       $user = "root";
+       $passwd = "";
+
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+       $error = mysqli_error($link);
+       var_dump($error);
+
+       mysqli_select_db($link, "test");
+
+       mysqli_query($link, "select * from non_exisiting_table");
+       $error = mysqli_error($link);   
+
+       var_dump($error);
+
+       mysqli_close($link);
+?>
+--EXPECT--
+string(0) ""
+string(46) "Table 'test.non_exisiting_table' doesn't exist"
diff --git a/ext/mysqli/tests/032.phpt b/ext/mysqli/tests/032.phpt
new file mode 100644 (file)
index 0000000..0256483
--- /dev/null
@@ -0,0 +1,25 @@
+--TEST--
+function test: mysqli_info
+--FILE--
+<?php
+       $user = "root";
+       $passwd = "";
+
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       mysqli_select_db($link, "test");
+
+       mysqli_query($link, "drop table if exists general_test");
+       mysqli_query($link, "create table general_test (a int)");
+       mysqli_query($link, "insert into general_test values (1),(2),(3)");
+
+       $afc = mysqli_info($link);
+
+       var_dump($afc);
+
+       mysqli_close($link);
+?>
+--EXPECT--
+string(38) "Records: 3  Duplicates: 0  Warnings: 0"
diff --git a/ext/mysqli/tests/033.phpt b/ext/mysqli/tests/033.phpt
new file mode 100644 (file)
index 0000000..e3d8d15
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST--
+function test: mysqli_get_host_info
+--FILE--
+<?php
+       $user = "root";
+       $passwd = "";
+
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       $hinfo = mysqli_get_host_info($link);
+
+       var_dump($hinfo);
+
+       mysqli_close($link);
+?>
+--EXPECT--
+string(25) "Localhost via UNIX socket"
diff --git a/ext/mysqli/tests/034.phpt b/ext/mysqli/tests/034.phpt
new file mode 100644 (file)
index 0000000..e347586
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST--
+function test: mysqli_get_proto_info
+--FILE--
+<?php
+       $user = "root";
+       $passwd = "";
+
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       $pinfo = mysqli_get_proto_info($link);
+
+       var_dump($pinfo);
+
+       mysqli_close($link);
+?>
+--EXPECT--
+int(10)
diff --git a/ext/mysqli/tests/035.phpt b/ext/mysqli/tests/035.phpt
new file mode 100644 (file)
index 0000000..34af7c0
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST--
+function test: mysqli_get_server_info
+--FILE--
+<?php
+       $user = "root";
+       $passwd = "";
+
+       
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect("localhost", $user, $passwd);
+
+       $sinfo = substr(mysqli_get_server_info($link),0,1);
+
+       var_dump($sinfo);
+
+       mysqli_close($link);
+?>
+--EXPECT--
+string(1) "4"