php-src/ext/mysqli/tests/001.phpt

63 lines
1.7 KiB
Plaintext
Raw Normal View History

2003-02-12 00:46:29 +00:00
--TEST--
mysqli connect
2004-12-04 08:50:33 +00:00
--SKIPIF--
<?php
require_once('skipif.inc');
2007-10-10 10:06:53 +00:00
require_once('skipifemb.inc');
require_once('skipifconnectfailure.inc');
?>
2003-02-12 00:46:29 +00:00
--FILE--
2003-08-12 02:05:21 +00:00
<?php
require_once("connect.inc");
2003-08-12 02:05:21 +00:00
2003-02-12 00:46:29 +00:00
$test = "";
2003-02-12 00:46:29 +00:00
/*** test mysqli_connect localhost:port ***/
$link = my_mysqli_connect($host, $user, $passwd, "", $port, $socket);
2003-02-12 00:46:29 +00:00
$test .= ($link) ? "1" : "0";
mysqli_close($link);
/*** test mysqli_real_connect ***/
2007-10-10 10:06:53 +00:00
$link = mysqli_init();
$test.= (my_mysqli_real_connect($link, $host, $user, $passwd, "", $port, $socket) )
2003-02-12 00:46:29 +00:00
? "1" : "0";
mysqli_close($link);
/*** test mysqli_real_connect with db ***/
2007-10-10 10:06:53 +00:00
$link = mysqli_init();
$test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
2003-02-12 00:46:29 +00:00
? "1" : "0";
mysqli_close($link);
/*** test mysqli_real_connect with port ***/
2007-10-10 10:06:53 +00:00
$link = mysqli_init();
$test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
2003-02-12 00:46:29 +00:00
? "1":"0";
mysqli_close($link);
2007-10-10 10:06:53 +00:00
/* 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 (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
2007-10-10 10:06:53 +00:00
printf("[002 + %d] mysqli_real_connect() failed, [%d] %s\n", $i, mysqli_connect_errno(), mysqli_connect_error());
mysqli_close($link);
}
2003-02-12 00:46:29 +00:00
/*** test mysqli_real_connect compressed ***/
2007-10-10 10:06:53 +00:00
/*
$link = mysqli_init();
$test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_COMPRESS))
2003-02-12 00:46:29 +00:00
? "1" : "0";
mysqli_close($link);
2007-10-10 10:06:53 +00:00
*/
2003-02-12 00:46:29 +00:00
/* todo ssl connections */
var_dump($test);
2007-10-10 10:06:53 +00:00
print "done!";
2003-02-12 00:46:29 +00:00
?>
2007-10-10 10:06:53 +00:00
--EXPECTF--
%s(4) "1111"
done!