php-src/ext/mysqli/tests/connect.inc
Andrey Hristov 98f88d7a97 Remove RPL functions. They were always experimental and lead to crashes.
The underlying functions will be removed from libmysql as of MySQL 6.0, so
it's right time to remove them.
2007-12-28 15:37:52 +00:00

56 lines
1.9 KiB
PHP

<?php
/*
Default values are "localhost", "root",
database "stest" and empty password.
Change the MYSQL_TEST environment values
if you want to use another configuration
*/
$driver = new mysqli_driver;
$host = getenv("MYSQL_TEST_HOST") ? getenv("MYSQL_TEST_HOST") : "localhost";
$port = getenv("MYSQL_TEST_PORT") ? getenv("MYSQL_TEST_PORT") : 3306;
$user = getenv("MYSQL_TEST_USER") ? getenv("MYSQL_TEST_USER") : "root";
$passwd = getenv("MYSQL_TEST_PASSWD") ? getenv("MYSQL_TEST_PASSWD") : "";
$db = getenv("MYSQL_TEST_DB") ? getenv("MYSQL_TEST_DB") : "test";
$engine = getenv("MYSQL_TEST_ENGINE") ? getenv("MYSQL_TEST_ENGINE") : "MyISAM";
$socket = getenv("MYSQL_TEST_SOCKET") ? getenv("MYSQL_TEST_SOCKET") : null;
$skip_on_connect_failure = getenv("MYSQL_TEST_SKIP_CONNECT_FAILURE") ? getenv("MYSQL_TEST_SKIP_CONNECT_FAILURE") : true;
/* Development setting: test experimal features and/or feature requests that never worked before? */
$TEST_EXPERIMENTAL = (in_array(getenv("MYSQL_TEST_EXPERIMENTAL"), array(0, 1))) ?
((1 == getenv("MYSQL_TEST_EXPERIMENTAL")) ? true : false) :
false;
$IS_MYSQLND = stristr(mysqli_get_client_info(), "mysqlnd");
if (!$IS_MYSQLND) {
$MYSQLND_VERSION = NULL;
} else {
if (preg_match('@Revision:\s+(\d+)\s*\$@ism', mysqli_get_client_info(), $matches)) {
$MYSQLND_VERSION = (int)$matches[1];
} else {
$MYSQLND_VERSION = -1;
}
}
if (!function_exists('sys_get_temp_dir')) {
function sys_get_temp_dir() {
if (!empty($_ENV['TMP']))
return realpath( $_ENV['TMP'] );
if (!empty($_ENV['TMPDIR']))
return realpath( $_ENV['TMPDIR'] );
if (!empty($_ENV['TEMP']))
return realpath( $_ENV['TEMP'] );
$temp_file = tempnam(md5(uniqid(rand(), TRUE)), '');
if ($temp_file) {
$temp_dir = realpath(dirname($temp_file));
unlink($temp_file);
return $temp_dir;
}
return FALSE;
}
}
?>