Author: uwendel
Date: 2007-06-27 16:47:50 +0200 (Wed, 27 Jun 2007)
New Revision: 530
Modified:
trunk/tests/ext/mysql/003.phpt
Log:
Always use the connection parameter passed from connect.inc
Modified: trunk/tests/ext/mysql/003.phpt
===================================================================
--- trunk/tests/ext/mysql/003.phpt 2007-06-27 14:03:24 UTC (rev 529)
+++ trunk/tests/ext/mysql/003.phpt 2007-06-27 14:47:50 UTC (rev 530)
@@ -4,9 +4,8 @@
<?php include 'skipif.inc'; ?>
--FILE--
<?php
+include_once('connect.inc');
-include 'connect.inc';
-
class class24 {
function __construct() {
echo __METHOD__ . "\n";
@@ -19,35 +18,42 @@
"three"
);
-$db = mysql_connect($host, $user, $passwd);
+if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***,
dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+if (!mysql_query('DROP TABLE IF EXISTS test', $link))
+ printf("[002] [%d] %s\n", mysql_errno($link), mysql_error($link));
-mysql_select_db("test");
+if (!mysql_query("CREATE TABLE test(a varchar(10))", $link))
+ printf("[003] [%d] %s\n", mysql_errno($link), mysql_error($link));
-mysql_query('DROP TABLE IF EXISTS test');
-
-mysql_query("CREATE TABLE test(a varchar(10))");
-
foreach ($data as $str) {
- mysql_query("INSERT INTO test VALUES('$str')");
- var_dump($str);
+ if (!mysql_query(sprintf("INSERT INTO test VALUES('%s')", $str), $link))
+ printf("[004 - %s] [%d] %s\n", $str, mysql_errno($link), mysql_error($link));
}
echo "==stdClass==\n";
-$res = mysql_query("SELECT a FROM test");
+if (!$res = mysql_query("SELECT a FROM test", $link))
+ printf("[005] [%d] %s\n", mysql_errno($link), mysql_error($link));
+
while ($obj = mysql_fetch_object($res)) {
var_dump($obj);
}
+mysql_free_result($res);
echo "==class24==\n";
-$res = mysql_query("SELECT a FROM test");
+if (!$res = mysql_query("SELECT a FROM test", $link))
+ printf("[006] [%d] %s\n", mysql_errno($link), mysql_error($link));
+
while ($obj = mysql_fetch_object($res, 'class24')) {
var_dump($obj);
}
-
+mysql_free_result($res);
mysql_close($db);
+print "done!";
?>
-==DONE==
--EXPECTF--
string(3) "one"
string(3) "two"
| Thread |
|---|
| • PHP mysqlnd svn commit: r530 - trunk/tests/ext/mysql | uwendel | 27 Jun |