uw Mon, 20 Sep 2010 18:26:11 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=303629
Log:
Align test to the style used in the other tests
Changed paths:
U php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug52891.phpt
U php/php-src/trunk/ext/mysqli/tests/bug52891.phpt
Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug52891.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug52891.phpt 2010-09-20 17:26:39 UTC (rev 303628)
+++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug52891.phpt 2010-09-20 18:26:11 UTC (rev 303629)
@@ -8,51 +8,78 @@
--FILE--
<?php
require_once("connect.inc");
- $link = mysqli_init();
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
- printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
}
- var_dump($link->query("DROP TABLE IF EXISTS tuint"));
- var_dump($link->query("DROP TABLE IF EXISTS tsint"));
- var_dump($link->query("CREATE TABLE tuint(a bigint unsigned) ENGINE=".$engine));
- var_dump($link->query("CREATE TABLE tsint(a bigint) ENGINE=".$engine));
-
- $stmt = $link->prepare("INSERT INTO tuint VALUES(?)");
- $stmt2 = $link->prepare("INSERT INTO tsint VALUES(?)");
+
+ if (!$link->query("DROP TABLE IF EXISTS tuint") ||
+ !$link->query("DROP TABLE IF EXISTS tsint")) {
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
+ }
+
+ if (!$link->query("CREATE TABLE tuint(a BIGINT UNSIGNED) ENGINE=" . $engine) ||
+ !$link->query("CREATE TABLE tsint(a BIGINT) ENGINE=" . $engine)) {
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
+ }
+
+
+ if (!$stmt1 = $link->prepare("INSERT INTO tuint VALUES(?)"))
+ printf("[004] [%d] %s\n", $link->errno, $link->error);
+
+ if (!$stmt2 = $link->prepare("INSERT INTO tsint VALUES(?)"))
+ printf("[005] [%d] %s\n", $link->errno, $link->error);
+
$param = 42;
- $stmt->bind_param("i", $param);
- $stmt2->bind_param("i", $param);
+ if (!$stmt1->bind_param("i", $param))
+ printf("[006] [%d] %s\n", $stmt1->errno, $stmt1->error);
+
+ if (!$stmt2->bind_param("i", $param))
+ printf("[007] [%d] %s\n", $stmt2->errno, $stmt2->error);
+
/* first insert normal value to force initial send of types */
- var_dump($stmt->execute());
- var_dump($stmt2->execute());
+ if (!$stmt1->execute())
+ printf("[008] [%d] %s\n", $stmt1->errno, $stmt1->error);
+ if (!$stmt2->execute())
+ printf("[009] [%d] %s\n", $stmt2->errno, $stmt2->error);
+
/* now try values that don't fit in long, on 32bit, new types should be sent or 0 will be inserted */
$param = -4294967297;
- var_dump($stmt2->execute());
+ if (!$stmt2->execute())
+ printf("[010] [%d] %s\n", $stmt2->errno, $stmt2->error);
/* again normal value */
$param = 43;
- var_dump($stmt->execute());
- var_dump($stmt2->execute());
+ if (!$stmt1->execute())
+ printf("[011] [%d] %s\n", $stmt1->errno, $stmt1->error);
+
+ if (!$stmt2->execute())
+ printf("[012] [%d] %s\n", $stmt2->errno, $stmt2->error);
+
/* again conversion */
$param = -4294967295;
- var_dump($stmt2->execute());
+ if (!$stmt2->execute())
+ printf("[013] [%d] %s\n", $stmt2->errno, $stmt2->error);
$param = 4294967295;
- var_dump($stmt->execute());
- var_dump($stmt2->execute());
+ if (!$stmt1->execute())
+ printf("[014] [%d] %s\n", $stmt1->errno, $stmt1->error);
+ if (!$stmt2->execute())
+ printf("[015] [%d] %s\n", $stmt2->errno, $stmt2->error);
+
$param = 4294967297;
- var_dump($stmt->execute());
- var_dump($stmt2->execute());
+ if (!$stmt1->execute())
+ printf("[016] [%d] %s\n", $stmt1->errno, $stmt1->error);
- $result = $link->query("SELECT * FROM tsint ORDER BY a");
- $result2 = $link->query("SELECT * FROM tuint ORDER BY a");
+ if (!$stmt2->execute())
+ printf("[017] [%d] %s\n", $stmt2->errno, $stmt2->error);
- var_dump($link->query("DROP TABLE tsint"));
- var_dump($link->query("DROP TABLE tuint"));
+ $result = $link->query("SELECT * FROM tsint ORDER BY a ASC");
+ $result2 = $link->query("SELECT * FROM tuint ORDER BY a ASC");
echo "tsint:\n";
while ($row = $result->fetch_assoc()) {
@@ -62,26 +89,29 @@
while ($row = $result2->fetch_assoc()) {
var_dump($row);
}
-
+
echo "done";
?>
+--CLEAN--
+<?php
+require_once('connect.inc');
+
+if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+}
+
+if (!mysqli_query($link, 'DROP TABLE IF EXISTS tuint')) {
+ printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+}
+
+if (!mysqli_query($link, 'DROP TABLE IF EXISTS tsint')) {
+ printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+}
+
+mysqli_close($link);
+?>
--EXPECTF--
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
tsint:
array(1) {
["a"]=>
@@ -124,4 +154,4 @@
["a"]=>
string(10) "4294967297"
}
-done
+done
\ No newline at end of file
Modified: php/php-src/trunk/ext/mysqli/tests/bug52891.phpt
===================================================================
--- php/php-src/trunk/ext/mysqli/tests/bug52891.phpt 2010-09-20 17:26:39 UTC (rev 303628)
+++ php/php-src/trunk/ext/mysqli/tests/bug52891.phpt 2010-09-20 18:26:11 UTC (rev 303629)
@@ -8,51 +8,78 @@
--FILE--
<?php
require_once("connect.inc");
- $link = mysqli_init();
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
- printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
}
- var_dump($link->query("DROP TABLE IF EXISTS tuint"));
- var_dump($link->query("DROP TABLE IF EXISTS tsint"));
- var_dump($link->query("CREATE TABLE tuint(a bigint unsigned) ENGINE=".$engine));
- var_dump($link->query("CREATE TABLE tsint(a bigint) ENGINE=".$engine));
-
- $stmt = $link->prepare("INSERT INTO tuint VALUES(?)");
- $stmt2 = $link->prepare("INSERT INTO tsint VALUES(?)");
+
+ if (!$link->query("DROP TABLE IF EXISTS tuint") ||
+ !$link->query("DROP TABLE IF EXISTS tsint")) {
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
+ }
+
+ if (!$link->query("CREATE TABLE tuint(a BIGINT UNSIGNED) ENGINE=" . $engine) ||
+ !$link->query("CREATE TABLE tsint(a BIGINT) ENGINE=" . $engine)) {
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
+ }
+
+
+ if (!$stmt1 = $link->prepare("INSERT INTO tuint VALUES(?)"))
+ printf("[004] [%d] %s\n", $link->errno, $link->error);
+
+ if (!$stmt2 = $link->prepare("INSERT INTO tsint VALUES(?)"))
+ printf("[005] [%d] %s\n", $link->errno, $link->error);
+
$param = 42;
- $stmt->bind_param("i", $param);
- $stmt2->bind_param("i", $param);
+ if (!$stmt1->bind_param("i", $param))
+ printf("[006] [%d] %s\n", $stmt1->errno, $stmt1->error);
+
+ if (!$stmt2->bind_param("i", $param))
+ printf("[007] [%d] %s\n", $stmt2->errno, $stmt2->error);
+
/* first insert normal value to force initial send of types */
- var_dump($stmt->execute());
- var_dump($stmt2->execute());
+ if (!$stmt1->execute())
+ printf("[008] [%d] %s\n", $stmt1->errno, $stmt1->error);
+ if (!$stmt2->execute())
+ printf("[009] [%d] %s\n", $stmt2->errno, $stmt2->error);
+
/* now try values that don't fit in long, on 32bit, new types should be sent or 0 will be inserted */
$param = -4294967297;
- var_dump($stmt2->execute());
+ if (!$stmt2->execute())
+ printf("[010] [%d] %s\n", $stmt2->errno, $stmt2->error);
/* again normal value */
$param = 43;
- var_dump($stmt->execute());
- var_dump($stmt2->execute());
+ if (!$stmt1->execute())
+ printf("[011] [%d] %s\n", $stmt1->errno, $stmt1->error);
+
+ if (!$stmt2->execute())
+ printf("[012] [%d] %s\n", $stmt2->errno, $stmt2->error);
+
/* again conversion */
$param = -4294967295;
- var_dump($stmt2->execute());
+ if (!$stmt2->execute())
+ printf("[013] [%d] %s\n", $stmt2->errno, $stmt2->error);
$param = 4294967295;
- var_dump($stmt->execute());
- var_dump($stmt2->execute());
+ if (!$stmt1->execute())
+ printf("[014] [%d] %s\n", $stmt1->errno, $stmt1->error);
+ if (!$stmt2->execute())
+ printf("[015] [%d] %s\n", $stmt2->errno, $stmt2->error);
+
$param = 4294967297;
- var_dump($stmt->execute());
- var_dump($stmt2->execute());
+ if (!$stmt1->execute())
+ printf("[016] [%d] %s\n", $stmt1->errno, $stmt1->error);
- $result = $link->query("SELECT * FROM tsint ORDER BY a");
- $result2 = $link->query("SELECT * FROM tuint ORDER BY a");
+ if (!$stmt2->execute())
+ printf("[017] [%d] %s\n", $stmt2->errno, $stmt2->error);
- var_dump($link->query("DROP TABLE tsint"));
- var_dump($link->query("DROP TABLE tuint"));
+ $result = $link->query("SELECT * FROM tsint ORDER BY a ASC");
+ $result2 = $link->query("SELECT * FROM tuint ORDER BY a ASC");
echo "tsint:\n";
while ($row = $result->fetch_assoc()) {
@@ -62,26 +89,29 @@
while ($row = $result2->fetch_assoc()) {
var_dump($row);
}
-
+
echo "done";
?>
+--CLEAN--
+<?php
+require_once('connect.inc');
+
+if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+}
+
+if (!mysqli_query($link, 'DROP TABLE IF EXISTS tuint')) {
+ printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+}
+
+if (!mysqli_query($link, 'DROP TABLE IF EXISTS tsint')) {
+ printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+}
+
+mysqli_close($link);
+?>
--EXPECTF--
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
tsint:
array(1) {
["a"]=>
@@ -124,4 +154,4 @@
["a"]=>
string(10) "4294967297"
}
-done
+done
\ No newline at end of file
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php