uw Mon Jul 23 07:51:38 2007 UTC
Modified files:
/php-src/ext/mysql/tests connect.inc mysql_fetch_field.phpt
mysql_stat.phpt skipif.inc table.inc
Log:
Whitespace (space to tab)/CS
With this commit the MySQL internal mysqlnd set of ext/mysql tests is in
sync with HEAD. It's likely that php.net/HEAD fails on quite some tests.
Using ext/mysql from the MySQL internal mysqlnd SVN there should be zero
failures. Merging the MySQL internal mysqlnd SVN into HEAD will happen
soon so that we get a bug free version on php.net in the near future.
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/connect.inc?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/mysql/tests/connect.inc
diff -u php-src/ext/mysql/tests/connect.inc:1.2
php-src/ext/mysql/tests/connect.inc:1.3
--- php-src/ext/mysql/tests/connect.inc:1.2 Wed Jul 11 11:12:10 2007
+++ php-src/ext/mysql/tests/connect.inc Mon Jul 23 07:51:37 2007
@@ -43,22 +43,22 @@
}
/*
-Default values are "localhost", "root", database "test" and empty password.
-Change the MYSQL_TEST environment values if you want to use another
configuration.
+Default values are "localhost", "root", database "phptest" and empty password.
+Change the MYSQL_TEST_* environment values if you want to use another
configuration.
*/
$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;
+$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;
/* 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;
+ ((1 == getenv("MYSQL_TEST_EXPERIMENTAL")) ? true : false) :
+ false;
$IS_MYSQLND = stristr(mysql_get_client_info(), "mysqlnd");
-?>
+?>
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_fetch_field.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/mysql/tests/mysql_fetch_field.phpt
diff -u php-src/ext/mysql/tests/mysql_fetch_field.phpt:1.2
php-src/ext/mysql/tests/mysql_fetch_field.phpt:1.3
--- php-src/ext/mysql/tests/mysql_fetch_field.phpt:1.2 Wed Jul 11 15:26:07 2007
+++ php-src/ext/mysql/tests/mysql_fetch_field.phpt Mon Jul 23 07:51:37 2007
@@ -4,106 +4,106 @@
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
- include "connect.inc";
-
- $tmp = NULL;
- $link = NULL;
-
- // Note: no SQL type tests, internally the same function gets used as for
mysql_fetch_array() which does a lot of SQL type test
- if (!is_null($tmp = @mysql_fetch_field()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (false !== ($tmp = @mysql_fetch_field($link)))
- printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp),
$tmp);
-
- require('table.inc');
-
-
- $version = mysql_get_server_info($link);
- if (!preg_match('@(\d+)\.(\d+)\.(\d+)@ism', $version, $matches))
- printf("[003] Cannot get server version\n");
- $version = ($matches[1] * 100) + ($matches[2] * 10) + $matches[3];
-
- if (!$res = mysql_query("SELECT id AS ID, label FROM test AS TEST ORDER BY
id LIMIT 1", $link)) {
- printf("[004] [%d] %s\n", mysql_errno($link), mysql_error($link));
- }
-
- while ($tmp = mysql_fetch_field($res))
- var_dump($tmp);
- var_dump($tmp);
-
- mysql_free_result($res);
-
- if (!$res = mysql_query("SELECT id AS ID, label FROM test AS TEST ORDER BY
id LIMIT 1", $link)) {
- printf("[005] [%d] %s\n", mysql_errno($link), mysql_error($link));
- }
- if (false !== ($tmp = mysql_fetch_field($res, PHP_INT_MAX * 2)))
- printf("[006] Expecting boolean/false got %s/%s\n", gettype($tmp),
$tmp);
-
- mysql_free_result($res);
-
- if (false !== ($tmp = mysql_fetch_field($res)))
- printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp),
$tmp);
-
- $types = array(
- 'BIT' => array(1, 'int'),
- 'TINYINT' => array(1, 'int'),
- 'BOOL' => array('true', 'int'),
- 'SMALLINT' => array(32767, 'int'),
- 'MEDIUMINT' => array(8388607, 'int'),
- 'INT' => array(100, 'int'),
- 'BIGINT' => array(100, 'int'),
- 'FLOAT' => array(100, 'real'),
- 'DOUBLE' => array(100, 'real'),
- 'DECIMAL' => array(100, 'real'),
- 'DATE' => array(@date('Y-m-d'), 'date'),
- 'DATETIME' => array(@date('Y-m-d H:i:s'),
'datetime'),
- 'TIMESTAMP' => array(@date('Y-m-d H:i:s'),
'timestamp'),
- 'TIME' => array(@date('H:i:s'), 'time'),
- 'YEAR' => array(@date('Y'), 'year'),
- 'CHAR(1)' => array('a', 'string'),
- 'VARCHAR(1)' => array('a', 'string'),
- 'BINARY(1)' => array('a', 'string'),
- 'VARBINARY(1)' => array('a', 'string'),
- 'TINYBLOB' => array('a', 'blob'),
- 'TINYTEXT' => array('a', 'blob'),
- 'BLOB' => array('a', 'blob'),
- 'TEXT' => array('a', 'blob'),
- 'MEDIUMBLOB' => array('a', 'blob'),
- 'MEDIUMTEXT' => array('a', 'blob'),
- 'LONGBLOB' => array('a', 'blob'),
- 'LONGTEXT' => array('a', 'blob'),
- 'ENUM("a", "b")' => array('a', 'string'), /* !!! */
- 'SET("a", "b")' => array('a', 'string'), /* !!! */
- );
-
- foreach ($types as $type_name => $type_desc) {
- if (!mysql_query("DROP TABLE IF EXISTS test", $link))
- printf("[008/%s] [%d] %s\n", $type_name, mysql_errno($link),
mysql_error($link));
- if (!mysql_query(sprintf("CREATE TABLE test(id INT, label %s) ENGINE =
%s", $type_name, $engine), $link)) {
- // server and/or engine might not support the data type
- continue;
- }
- if (!mysql_query(sprintf("INSERT INTO test(id, label) VALUES (1,
'%s')", $type_desc[0]), $link)) {
- printf("[009/%s] [%d] %s\n", $type_name, mysql_errno($link),
mysql_error($link));
- continue;
- }
- if (!$res = mysql_query("SELECT id, label FROM test", $link)) {
- printf("[010/%s] [%d] %s\n", $type_name, mysql_errno($link),
mysql_error($link));
- continue;
- }
- if (!$tmp = mysql_fetch_field($res, 1)) {
- printf("[011/%s] [%d] %s\n", $type_name, mysql_errno($link),
mysql_error($link));
- }
-
- if ($type_desc[1] != $tmp->type) {
- printf("[012/%s] Expecting type '%s' got '%s'\n", $type_name,
$type_desc[1], $tmp->type);
- }
- mysql_free_result($res);
- }
-
- mysql_close($link);
- print "done!";
+ include "connect.inc";
+
+ $tmp = NULL;
+ $link = NULL;
+
+ // Note: no SQL type tests, internally the same function gets used as
for mysql_fetch_array() which does a lot of SQL type test
+ if (!is_null($tmp = @mysql_fetch_field()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp),
$tmp);
+
+ if (false !== ($tmp = @mysql_fetch_field($link)))
+ printf("[002] Expecting boolean/false, got %s/%s\n",
gettype($tmp), $tmp);
+
+ require('table.inc');
+
+
+ $version = mysql_get_server_info($link);
+ if (!preg_match('@(\d+)\.(\d+)\.(\d+)@ism', $version, $matches))
+ printf("[003] Cannot get server version\n");
+ $version = ($matches[1] * 100) + ($matches[2] * 10) + $matches[3];
+
+ if (!$res = mysql_query("SELECT id AS ID, label FROM test AS TEST ORDER
BY id LIMIT 1", $link)) {
+ printf("[004] [%d] %s\n", mysql_errno($link),
mysql_error($link));
+ }
+
+ while ($tmp = mysql_fetch_field($res))
+ var_dump($tmp);
+ var_dump($tmp);
+
+ mysql_free_result($res);
+
+ if (!$res = mysql_query("SELECT id AS ID, label FROM test AS TEST ORDER
BY id LIMIT 1", $link)) {
+ printf("[005] [%d] %s\n", mysql_errno($link),
mysql_error($link));
+ }
+ if (false !== ($tmp = mysql_fetch_field($res, PHP_INT_MAX * 2)))
+ printf("[006] Expecting boolean/false got %s/%s\n",
gettype($tmp), $tmp);
+
+ mysql_free_result($res);
+
+ if (false !== ($tmp = mysql_fetch_field($res)))
+ printf("[007] Expecting boolean/false, got %s/%s\n",
gettype($tmp), $tmp);
+
+ $types = array(
+ 'BIT' => array(1, 'int'),
+ 'TINYINT' => array(1, 'int'),
+ 'BOOL' => array('true', 'int'),
+ 'SMALLINT' => array(32767, 'int'),
+ 'MEDIUMINT' => array(8388607, 'int'),
+ 'INT' => array(100, 'int'),
+ 'BIGINT' => array(100, 'int'),
+ 'FLOAT' => array(100, 'real'),
+ 'DOUBLE' => array(100, 'real'),
+ 'DECIMAL' => array(100, 'real'),
+ 'DATE' => array(@date('Y-m-d'), 'date'),
+ 'DATETIME' => array(@date('Y-m-d H:i:s'), 'datetime'),
+ 'TIMESTAMP' => array(@date('Y-m-d H:i:s'), 'timestamp'),
+ 'TIME' => array(@date('H:i:s'), 'time'),
+ 'YEAR' => array(@date('Y'), 'year'),
+ 'CHAR(1)' => array('a', 'string'),
+ 'VARCHAR(1)' => array('a', 'string'),
+ 'BINARY(1)' => array('a', 'string'),
+ 'VARBINARY(1)' => array('a', 'string'),
+ 'TINYBLOB' => array('a', 'blob'),
+ 'TINYTEXT' => array('a', 'blob'),
+ 'BLOB' => array('a', 'blob'),
+ 'TEXT' => array('a', 'blob'),
+ 'MEDIUMBLOB' => array('a', 'blob'),
+ 'MEDIUMTEXT' => array('a', 'blob'),
+ 'LONGBLOB' => array('a', 'blob'),
+ 'LONGTEXT' => array('a', 'blob'),
+ 'ENUM("a", "b")' => array('a', 'string'), /* !!! */
+ 'SET("a", "b")' => array('a', 'string'), /* !!! */
+ );
+
+ foreach ($types as $type_name => $type_desc) {
+ if (!mysql_query("DROP TABLE IF EXISTS test", $link))
+ printf("[008/%s] [%d] %s\n", $type_name,
mysql_errno($link), mysql_error($link));
+ if (!mysql_query(sprintf("CREATE TABLE test(id INT, label %s)
ENGINE = %s", $type_name, $engine), $link)) {
+ // server and/or engine might not support the data type
+ continue;
+ }
+ if (!mysql_query(sprintf("INSERT INTO test(id, label) VALUES
(1, '%s')", $type_desc[0]), $link)) {
+ printf("[009/%s] [%d] %s\n", $type_name,
mysql_errno($link), mysql_error($link));
+ continue;
+ }
+ if (!$res = mysql_query("SELECT id, label FROM test", $link)) {
+ printf("[010/%s] [%d] %s\n", $type_name,
mysql_errno($link), mysql_error($link));
+ continue;
+ }
+ if (!$tmp = mysql_fetch_field($res, 1)) {
+ printf("[011/%s] [%d] %s\n", $type_name,
mysql_errno($link), mysql_error($link));
+ }
+
+ if ($type_desc[1] != $tmp->type) {
+ printf("[012/%s] Expecting type '%s' got '%s'\n",
$type_name, $type_desc[1], $tmp->type);
+ }
+ mysql_free_result($res);
+ }
+
+ mysql_close($link);
+ print "done!";
?>
--EXPECTF--
object(stdClass)#%d (13) {
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_stat.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/mysql/tests/mysql_stat.phpt
diff -u php-src/ext/mysql/tests/mysql_stat.phpt:1.2
php-src/ext/mysql/tests/mysql_stat.phpt:1.3
--- php-src/ext/mysql/tests/mysql_stat.phpt:1.2 Thu Jul 12 13:31:27 2007
+++ php-src/ext/mysql/tests/mysql_stat.phpt Mon Jul 23 07:51:37 2007
@@ -42,4 +42,4 @@
?>
--EXPECTF--
Warning: mysql_stat(): %d is not a valid MySQL-Link resource in %s on line %d
-done!
+done!
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/skipif.inc?r1=1.4&r2=1.5&diff_format=u
Index: php-src/ext/mysql/tests/skipif.inc
diff -u php-src/ext/mysql/tests/skipif.inc:1.4
php-src/ext/mysql/tests/skipif.inc:1.5
--- php-src/ext/mysql/tests/skipif.inc:1.4 Wed Jul 11 11:12:10 2007
+++ php-src/ext/mysql/tests/skipif.inc Mon Jul 23 07:51:37 2007
@@ -1,6 +1,6 @@
<?php
require_once('connect.inc');
if (!extension_loaded("mysql")) {
- die('skip mysql extension not available');
+ die('skip mysql extension not available');
}
?>
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/table.inc?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/mysql/tests/table.inc
diff -u php-src/ext/mysql/tests/table.inc:1.2
php-src/ext/mysql/tests/table.inc:1.3
--- php-src/ext/mysql/tests/table.inc:1.2 Wed Jul 11 11:12:10 2007
+++ php-src/ext/mysql/tests/table.inc Mon Jul 23 07:51:37 2007
@@ -3,22 +3,22 @@
// connect + select_db
if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("Cannot connect to the server using host=%s/%s, user=%s,
passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $myhost, $user, $db, $port, $socket);
- exit(1);
+ printf("Cannot connect to the server using host=%s/%s, user=%s,
passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $myhost, $user, $db, $port, $socket);
+ exit(1);
}
if (!mysql_query('DROP TABLE IF EXISTS test', $link)) {
- printf("Failed to drop old test table: [%d] %s\n", mysql_errno($link),
mysql_error($link));
- exit(1);
+ printf("Failed to drop old test table: [%d] %s\n", mysql_errno($link),
mysql_error($link));
+ exit(1);
}
if (!mysql_query('CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id))
ENGINE=' . $engine, $link)) {
- printf("Failed to create test table: [%d] %s\n", mysql_errno($link),
mysql_error($link));
- exit(1);
+ printf("Failed to create test table: [%d] %s\n", mysql_errno($link),
mysql_error($link));
+ exit(1);
}
if (!mysql_query('INSERT INTO test(id, label) VALUES (1, "a"), (2, "b"), (3,
"c"), (4, "d"), (5, "e"), (6, "f")', $link)) {
- printf("[%d] %s\n", mysql_errno($link), mysql_error($link));
+ printf("[%d] %s\n", mysql_errno($link), mysql_error($link));
}
?>
\ No newline at end of file
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php