uw Wed Oct 10 10:06:53 2007 UTC
Modified files: (Branch: PHP_5_3)
/php-src/ext/mysqli/tests 001.phpt 002.phpt 003.phpt 004.phpt
005.phpt 006.phpt 007.phpt 008.phpt
009.phpt
Log:
Changes to existing tests: 0*.phpt
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/001.phpt?r1=1.6&r2=1.6.6.1&diff_format=u
Index: php-src/ext/mysqli/tests/001.phpt
diff -u php-src/ext/mysqli/tests/001.phpt:1.6
php-src/ext/mysqli/tests/001.phpt:1.6.6.1
--- php-src/ext/mysqli/tests/001.phpt:1.6 Fri Jan 7 14:59:59 2005
+++ php-src/ext/mysqli/tests/001.phpt Wed Oct 10 10:06:53 2007
@@ -1,47 +1,63 @@
--TEST--
mysqli connect
--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";
- $dbname = "test";
$test = "";
/*** test mysqli_connect localhost:port ***/
- $link = mysqli_connect($host, $user, $passwd, "", 3306);
+ $link = mysqli_connect($host, $user, $passwd, "", $port, $socket);
$test .= ($link) ? "1" : "0";
mysqli_close($link);
/*** test mysqli_real_connect ***/
- $link = mysqli_init();
- $test.= (mysqli_real_connect($link, $host, $user, $passwd))
+ $link = mysqli_init();
+ $test.= (mysqli_real_connect($link, $host, $user, $passwd, "", $port,
$socket) )
? "1" : "0";
mysqli_close($link);
/*** test mysqli_real_connect with db ***/
- $link = mysqli_init();
- $test .= (mysqli_real_connect($link, $host, $user, $passwd, $dbname))
+ $link = mysqli_init();
+ $test .= (mysqli_real_connect($link, $host, $user, $passwd, $db, $port,
$socket))
? "1" : "0";
mysqli_close($link);
/*** test mysqli_real_connect with port ***/
- $link = mysqli_init();
- $test .= (mysqli_real_connect($link, $host, $user, $passwd, $dbname,
3306))
+ $link = mysqli_init();
+ $test .= (mysqli_real_connect($link, $host, $user, $passwd, $db, $port,
$socket))
? "1":"0";
mysqli_close($link);
+ /* temporary addition for Kent's setup, Win32 box */
+ for ($i = 0; $i < 10; $i++) {
+ if (!$link = mysqli_init())
+ printf("[001 + %d] mysqli_init() failed, [%d] %s\n",
$i, mysqli_connect_errno(), mysqli_connect_error());
+
+ if (!mysqli_real_connect($link, $host, $user, $passwd, $db,
$port, $socket))
+ printf("[002 + %d] mysqli_real_connect() failed, [%d]
%s\n", $i, mysqli_connect_errno(), mysqli_connect_error());
+
+ mysqli_close($link);
+ }
+
/*** test mysqli_real_connect compressed ***/
- $link = mysqli_init();
- $test .= (mysqli_real_connect($link, $host, $user, $passwd, $dbname, 0,
NULL, MYSQLI_CLIENT_COMPRESS))
+ /*
+ $link = mysqli_init();
+ $test .= (mysqli_real_connect($link, $host, $user, $passwd, $db, $port,
$socket, MYSQLI_CLIENT_COMPRESS))
? "1" : "0";
mysqli_close($link);
-
+ */
/* todo ssl connections */
var_dump($test);
+ print "done!";
?>
---EXPECT--
-string(5) "11111"
+--EXPECTF--
+%s(4) "1111"
+done!
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/002.phpt?r1=1.4.2.1&r2=1.4.2.1.4.1&diff_format=u
Index: php-src/ext/mysqli/tests/002.phpt
diff -u php-src/ext/mysqli/tests/002.phpt:1.4.2.1
php-src/ext/mysqli/tests/002.phpt:1.4.2.1.4.1
--- php-src/ext/mysqli/tests/002.phpt:1.4.2.1 Fri Mar 24 09:32:24 2006
+++ php-src/ext/mysqli/tests/002.phpt Wed Oct 10 10:06:53 2007
@@ -1,30 +1,38 @@
--TEST--
-mysqli bind_result 1
+mysqli bind_result 1
--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->query("CREATE SCHEMA test");
+ if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(),
mysqli_connect_error());
- mysqli_select_db($link, "test");
- $rc = mysqli_query($link,"DROP TABLE IF EXISTS test_fetch_null");
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_fetch_null"))
+ printf("[002] Cannot drop table, [%d] %s\n",
mysqli_errno($link), mysqli_error($link));
- $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)");
+ $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)) ENGINE=" . $engine);
+
+ if (!$rc)
+ printf("[003] Cannot create table, [%d] %s\n",
mysqli_errno($link), mysqli_error($link));
+
+ $rc = mysqli_query($link, "INSERT INTO test_fetch_null(col1,col10,
col11) VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)");
+ if (!$rc)
+ printf("[004] Cannot insert records, [%d] %s\n",
mysqli_errno($link), mysqli_error($link));
- $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);
+ $stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5,
col6, col7, col8, col9, col10, col11 from test_fetch_null ORDER BY col1");
+ mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9,
$c10, $c11);
mysqli_execute($stmt);
mysqli_fetch($stmt);
@@ -35,8 +43,9 @@
mysqli_stmt_close($stmt);
mysqli_close($link);
+ print "done!";
?>
---EXPECT--
+--EXPECTF--
array(11) {
[0]=>
int(1)
@@ -61,3 +70,30 @@
[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!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/003.phpt?r1=1.5.2.1&r2=1.5.2.1.4.1&diff_format=u
Index: php-src/ext/mysqli/tests/003.phpt
diff -u php-src/ext/mysqli/tests/003.phpt:1.5.2.1
php-src/ext/mysqli/tests/003.phpt:1.5.2.1.4.1
--- php-src/ext/mysqli/tests/003.phpt:1.5.2.1 Sat Oct 8 15:08:07 2005
+++ php-src/ext/mysqli/tests/003.phpt Wed Oct 10 10:06:53 2007
@@ -1,35 +1,44 @@
--TEST--
mysqli connect
--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, "test");
+ $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
mysqli_query($link, "SET sql_mode=''");
- 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')");
+ if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result"))
+ printf("[001] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
+ $rc = 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)) ENGINE=" . $engine);
+
+ if (!$rc)
+ printf("[002] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
+
+ $rc = 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')");
+ if (!$rc)
+ printf("[003] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
- mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
- mysqli_execute($stmt);
+ 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);
@@ -38,8 +47,9 @@
mysqli_stmt_close($stmt);
mysqli_close($link);
+ print "done!";
?>
---EXPECT--
+--EXPECTF--
array(7) {
[0]=>
string(10) "2002-01-02"
@@ -56,3 +66,22 @@
[6]=>
string(19) "1999-12-29 00:00:00"
}
+done!
+--UEXPECTF--
+array(7) {
+ [0]=>
+ unicode(10) "2002-01-02"
+ [1]=>
+ unicode(8) "12:49:00"
+ [2]=>
+ unicode(19) "2002-01-02 17:46:59"
+ [3]=>
+ int(2010)
+ [4]=>
+ unicode(19) "2010-07-10 00:00:00"
+ [5]=>
+ unicode(19) "0000-00-00 00:00:00"
+ [6]=>
+ unicode(19) "1999-12-29 00:00:00"
+}
+done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/004.phpt?r1=1.4.2.1&r2=1.4.2.1.4.1&diff_format=u
Index: php-src/ext/mysqli/tests/004.phpt
diff -u php-src/ext/mysqli/tests/004.phpt:1.4.2.1
php-src/ext/mysqli/tests/004.phpt:1.4.2.1.4.1
--- php-src/ext/mysqli/tests/004.phpt:1.4.2.1 Sun Jan 1 16:52:05 2006
+++ php-src/ext/mysqli/tests/004.phpt Wed Oct 10 10:06:53 2007
@@ -1,39 +1,52 @@
--TEST--
mysqli fetch char/text
--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, $db);
+
+ if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"))
+ printf("[001] [%d] string\n", mysqli_errno($link),
mysqli_error($link));
+
+ if (!mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2
text) ENGINE=" . $engine))
+ printf("[002] [%d] string\n", mysqli_errno($link),
mysqli_error($link));
- mysqli_select_db($link, "test");
+ if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES
('1234567890', 'this is a test0')"))
+ printf("[003] [%d] string\n", mysqli_errno($link),
mysqli_error($link));
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2
text)");
+ if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES
('1234567891', 'this is a test1')"))
+ printf("[004] [%d] string\n", mysqli_errno($link),
mysqli_error($link));
- mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890',
'this is a test0')");
- mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567891',
'this is a test1')");
- mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567892',
'this is a test2')");
- mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567893',
'this is a test3')");
+ if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES
('1234567892', 'this is a test2')"))
+ printf("[005] [%d] string\n", mysqli_errno($link),
mysqli_error($link));
+
+ if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES
('1234567893', 'this is a test3')"))
+ printf("[006] [%d] string\n", mysqli_errno($link),
mysqli_error($link));
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch ORDER BY
c1");
mysqli_bind_result($stmt, $c1, $c2);
mysqli_execute($stmt);
- $i=4;
+ $i = 4;
while ($i--) {
mysqli_fetch($stmt);
- $test = array($c1,$c2);
+ $test = array($c1, $c2);
var_dump($test);
}
-
mysqli_stmt_close($stmt);
mysqli_close($link);
+ print "done!";
?>
---EXPECT--
+--EXPECTF--
array(2) {
[0]=>
string(10) "1234567890"
@@ -58,3 +71,30 @@
[1]=>
string(15) "this is a test3"
}
+done!
+--UEXPECTF--
+array(2) {
+ [0]=>
+ unicode(10) "1234567890"
+ [1]=>
+ unicode(15) "this is a test0"
+}
+array(2) {
+ [0]=>
+ unicode(10) "1234567891"
+ [1]=>
+ unicode(15) "this is a test1"
+}
+array(2) {
+ [0]=>
+ unicode(10) "1234567892"
+ [1]=>
+ unicode(15) "this is a test2"
+}
+array(2) {
+ [0]=>
+ unicode(10) "1234567893"
+ [1]=>
+ unicode(15) "this is a test3"
+}
+done!
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/005.phpt?r1=1.4&r2=1.4.6.1&diff_format=u
Index: php-src/ext/mysqli/tests/005.phpt
diff -u php-src/ext/mysqli/tests/005.phpt:1.4
php-src/ext/mysqli/tests/005.phpt:1.4.6.1
--- php-src/ext/mysqli/tests/005.phpt:1.4 Sat Dec 4 08:50:33 2004
+++ php-src/ext/mysqli/tests/005.phpt Wed Oct 10 10:06:53 2007
@@ -1,18 +1,22 @@
--TEST--
mysqli fetch char/text long
--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_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2
text)");
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
+ printf("[001] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
+
+ if (!mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 char(10), c2
text) ENGINE=" . $engine))
+ printf("[002] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
$a = str_repeat("A1", 32000);
@@ -30,11 +34,21 @@
mysqli_stmt_close($stmt);
mysqli_close($link);
+ print "done!";
?>
---EXPECT--
+--EXPECTF--
array(2) {
[0]=>
string(10) "1234567890"
[1]=>
string(13) "32K String ok"
}
+done!
+--UEXPECTF--
+array(2) {
+ [0]=>
+ unicode(10) "1234567890"
+ [1]=>
+ unicode(13) "32K String ok"
+}
+done!
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/006.phpt?r1=1.4.2.1&r2=1.4.2.1.4.1&diff_format=u
Index: php-src/ext/mysqli/tests/006.phpt
diff -u php-src/ext/mysqli/tests/006.phpt:1.4.2.1
php-src/ext/mysqli/tests/006.phpt:1.4.2.1.4.1
--- php-src/ext/mysqli/tests/006.phpt:1.4.2.1 Sat Oct 8 15:08:07 2005
+++ php-src/ext/mysqli/tests/006.phpt Wed Oct 10 10:06:53 2007
@@ -1,27 +1,35 @@
--TEST--
mysqli fetch long values
--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);
+
+ if (!mysqli_query($link, "SET sql_mode=''"))
+ printf("[001] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- mysqli_select_db($link, "test");
- mysqli_query($link, "SET sql_mode=''");
+ if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"))
+ printf("[002] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- 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)");
+ $rc = 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) ENGINE=" . $engine);
+ if (!$rc)
+ printf("[003] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- mysqli_query($link, "INSERT INTO test_bind_fetch VALUES
(-23,35999,NULL,-500,-9999999,-0,0)");
+ if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES
(-23,35999,NULL,-500,-9999999,-0,0)"))
+ printf("[004] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
@@ -34,6 +42,7 @@
mysqli_stmt_close($stmt);
mysqli_close($link);
+ print "done!";
?>
--EXPECT--
array(7) {
@@ -52,3 +61,4 @@
[6]=>
int(0)
}
+done!
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/007.phpt?r1=1.4.2.1&r2=1.4.2.1.4.1&diff_format=u
Index: php-src/ext/mysqli/tests/007.phpt
diff -u php-src/ext/mysqli/tests/007.phpt:1.4.2.1
php-src/ext/mysqli/tests/007.phpt:1.4.2.1.4.1
--- php-src/ext/mysqli/tests/007.phpt:1.4.2.1 Sat Oct 8 15:08:07 2005
+++ php-src/ext/mysqli/tests/007.phpt Wed Oct 10 10:06:53 2007
@@ -1,27 +1,35 @@
--TEST--
mysqli fetch short values
--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);
+
+ if (!mysqli_query($link, "SET sql_mode=''"))
+ printf("[001] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- mysqli_select_db($link, "test");
- mysqli_query($link, "SET sql_mode=''");
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
+ printf("[002] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- 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)");
+ $rc = 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) ENGINE=" . $engine);
+ if (!$rc)
+ printf("[003] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- mysqli_query($link, "INSERT INTO test_bind_fetch VALUES
(-23,35999,NULL,-500,-9999999,+30,0)");
+ if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES
(-23,35999,NULL,-500,-9999999,+30,0)"))
+ printf("[004] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
@@ -34,6 +42,7 @@
mysqli_stmt_close($stmt);
mysqli_close($link);
+ print "done!";
?>
--EXPECT--
array(7) {
@@ -52,3 +61,4 @@
[6]=>
int(0)
}
+done!
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/008.phpt?r1=1.4.2.1&r2=1.4.2.1.4.1&diff_format=u
Index: php-src/ext/mysqli/tests/008.phpt
diff -u php-src/ext/mysqli/tests/008.phpt:1.4.2.1
php-src/ext/mysqli/tests/008.phpt:1.4.2.1.4.1
--- php-src/ext/mysqli/tests/008.phpt:1.4.2.1 Sat Oct 8 15:08:07 2005
+++ php-src/ext/mysqli/tests/008.phpt Wed Oct 10 10:06:53 2007
@@ -1,27 +1,35 @@
--TEST--
mysqli fetch tinyint values
--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);
+
+ if (!mysqli_query($link, "SET sql_mode=''"))
+ printf("[001] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- mysqli_select_db($link, "test");
- mysqli_query($link, "SET sql_mode=''");
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
+ printf("[002] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- 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)");
+ $rc = 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) ENGINE=" . $engine);
+ if (!$rc)
+ printf("[003] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- mysqli_query($link, "INSERT INTO test_bind_fetch VALUES
(-23,300,0,-100,-127,+30,0)");
+ if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES
(-23,300,0,-100,-127,+30,0)"))
+ printf("[004] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
@@ -34,6 +42,7 @@
mysqli_stmt_close($stmt);
mysqli_close($link);
+ print "done!";
?>
--EXPECT--
array(7) {
@@ -52,3 +61,4 @@
[6]=>
int(0)
}
+done!
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/009.phpt?r1=1.6.2.7&r2=1.6.2.7.4.1&diff_format=u
Index: php-src/ext/mysqli/tests/009.phpt
diff -u php-src/ext/mysqli/tests/009.phpt:1.6.2.7
php-src/ext/mysqli/tests/009.phpt:1.6.2.7.4.1
--- php-src/ext/mysqli/tests/009.phpt:1.6.2.7 Mon Nov 28 13:35:54 2005
+++ php-src/ext/mysqli/tests/009.phpt Wed Oct 10 10:06:53 2007
@@ -7,43 +7,63 @@
exit;
}
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_query($link, "SET sql_mode=''");
+ if (!mysqli_query($link, "SET sql_mode=''"))
+ printf("[001] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- 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)");
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
+ printf("[002] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- mysqli_query($link, "INSERT INTO test_bind_fetch (c2,c3,c4,c5,c6,c7)
VALUES (-23,4.0,33333333333333,0,-333333333333,99.9)");
+ $rc = 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,
+
c8 bigint unsigned) ENGINE=" . $engine);
+ if (!$rc)
+ printf("[003] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
+
+ $rc = mysqli_query($link, "INSERT INTO test_bind_fetch
(c2,c3,c4,c5,c6,c7,c8) ".
+ "VALUES
(-23,4.0,33333333333333,0,-333333333333,99.9,1234)");
+ if (!$rc)
+ printf("[004] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
+ mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8);
mysqli_execute($stmt);
$rc = mysqli_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ if (mysqli_get_server_version($link) < 50000) {
+ // 4.1 is faulty and will return big number for $c6
+ if ($c6 == "18446743740376218283") {
+ $c6 = 0;
+ }
+ }
+ $c8 = 4567;// change this to test how mysqli/mysqlnd handles is_ref
changing
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8);
var_dump($test);
mysqli_stmt_close($stmt);
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch_uint");
- mysqli_query($link,"CREATE TABLE test_bind_fetch_uint(c1 integer
unsigned, c2 integer unsigned)");
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch_uint"))
+ printf("[005] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
+ $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch_uint(c1 integer
unsigned, c2 integer unsigned) ENGINE=" . $engine);
+ if (!$rc)
+ printf("[006] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- mysqli_query($link, "INSERT INTO test_bind_fetch_uint (c1,c2) VALUES
(20123456, 3123456789)");
+ if (!mysqli_query($link, "INSERT INTO test_bind_fetch_uint (c1,c2)
VALUES (20123456, 3123456789)"))
+ printf("[007] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch_uint");
mysqli_bind_result($stmt, $c1, $c2);
@@ -53,13 +73,12 @@
echo $c1, "\n", $c2, "\n";
mysqli_stmt_close($stmt);
-
-
mysqli_close($link);
+ print "done!";
?>
---EXPECT--
-array(7) {
+--EXPECTF--
+array(8) {
[0]=>
int(5)
[1]=>
@@ -74,6 +93,31 @@
int(0)
[6]=>
int(100)
+ [7]=>
+ int(4567)
+}
+20123456
+3123456789
+done!
+--UEXPECTF--
+array(8) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(-23)
+ [2]=>
+ int(4)
+ [3]=>
+ unicode(14) "33333333333333"
+ [4]=>
+ int(0)
+ [5]=>
+ int(0)
+ [6]=>
+ int(100)
+ [7]=>
+ int(4567)
}
20123456
3123456789
+done!
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php