|
PHP mysqlnd svn commit: r1077 - trunk/tests/ext/mysqli
Author: ahristov
Date: 2007-10-01 23:17:56 +0200 (Mon, 01 Oct 2007)
New Revision: 1077
Modified:
trunk/tests/ext/mysqli/mysqli_fetch_all.phpt
trunk/tests/ext/mysqli/mysqli_stmt_bind_param.phpt
Log:
Fix tests
Modified: trunk/tests/ext/mysqli/mysqli_fetch_all.phpt
- trunk/tests/ext/mysqli/mysqli_fetch_all.phpt 2007-10-01 18:11:19 UTC (rev 1076)
+++ trunk/tests/ext/mysqli/mysqli_fetch_all.phpt 2007-10-01 21:17:56 UTC (rev 1077)
@@ -93,67 +93,67 @@
function func_mysqli_fetch_all($link, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL) {
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
- printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
- return false;
- }
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
+ printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
- if (!mysqli_query($link, $sql = sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
- print $sql;
- // don't bail, engine might not support the datatype
- return false;
- }
+ if (!mysqli_query($link, $sql = sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
+ print $sql;
+ // don't bail, engine might not support the datatype
+ return false;
+ }
- if (is_null($php_value) && !mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) {
- printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
- return false;
- }
+ if (is_null($php_value) && !mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) {
+ printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
- if (!is_null($php_value)) {
- if (is_int($sql_value) && !mysqli_query($link, sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) {
- printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
- return false;
- } else if (!is_int($sql_value) && !mysqli_query($link, sprintf("INSERT INTO test(id, label) VALUES (1, '%s')", $sql_value))) {
- printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
- return false;
- }
- }
+ if (!is_null($php_value)) {
+ if (is_int($sql_value) && !mysqli_query($link, sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) {
+ printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
+ return false;
+ } else if (!is_int($sql_value) && !mysqli_query($link, sprintf("INSERT INTO test(id, label) VALUES (1, '%s')", $sql_value))) {
+ printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+ }
- if (!$res = mysqli_query($link, "SELECT id, label FROM test")) {
- printf("[%04d] [%d] %s\n", $offset + 2, mysqli_errno($link), mysqli_error($link));
- return false;
- }
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test")) {
+ printf("[%04d] [%d] %s\n", $offset + 2, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
- if (!$tmp = mysqli_fetch_all($res, MYSQLI_BOTH)) {
- printf("[%04d] [%d] %s\n", $offset + 3, mysqli_errno($link), mysqli_error($link));
- return false;
- }
- $row = $tmp[0];
+ if (!$tmp = mysqli_fetch_all($res, MYSQLI_BOTH)) {
+ printf("[%04d] [%d] %s\n", $offset + 3, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+ $row = $tmp[0];
- $fields = mysqli_fetch_fields($res);
+ $fields = mysqli_fetch_fields($res);
- if (!(gettype($php_value)=="unicode" && ($fields[1]->flags & 128))) {
+ if (!(gettype($php_value)=="unicode" && ($fields[1]->flags & 128))) {
- if ($regexp_comparison && !$skip) {
- if (!preg_match($regexp_comparison, (string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) {
- printf("[%04d] Expecting %s/%s [reg exp = %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4,
- gettype($php_value), $php_value, $regexp_comparison,
- gettype($row[1]), $row[1],
- gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link));
- return false;
- }
- } else {
- if (($row['label'] !== $php_value) || ($row[1] != $php_value)) {
- printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4,
- gettype($php_value), $php_value,
- gettype($row[1]), $row[1],
- gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link));
- return false;
- }
+ if ($regexp_comparison) {
+ if (!preg_match($regexp_comparison, (string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) {
+ printf("[%04d] Expecting %s/%s [reg exp = %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4,
+ gettype($php_value), $php_value, $regexp_comparison,
+ gettype($row[1]), $row[1],
+ gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link));
+ return false;
}
- }
+ } else {
+ if (($row['label'] !== $php_value) || ($row[1] != $php_value)) {
+ printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4,
+ gettype($php_value), $php_value,
+ gettype($row[1]), $row[1],
+ gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+ }
+ }
- return true;
+ return true;
}
function func_mysqli_fetch_array_make_string($len) {
@@ -558,4 +558,4 @@
Warning: mysqli_fetch_all(): Mode can be only MYSQLI_FETCH_NUM, MYSQLI_FETCH_ASSOC or MYSQLI_FETCH_BOTH in %s on line %d
Warning: mysqli_fetch_array(): Couldn't fetch mysqli_result in %s on line %d
-done!
\ No newline at end of file
+done!
Modified: trunk/tests/ext/mysqli/mysqli_stmt_bind_param.phpt
- trunk/tests/ext/mysqli/mysqli_stmt_bind_param.phpt 2007-10-01 18:11:19 UTC (rev 1076)
+++ trunk/tests/ext/mysqli/mysqli_stmt_bind_param.phpt 2007-10-01 21:17:56 UTC (rev 1077)
@@ -350,7 +350,7 @@
}
mysqli_free_result($res);
- $value_list = array(array('id' => 101, label => 'a'), array('id' => 102, 'label' => 'b'));
+ $value_list = array(array('id' => 101, 'label' => 'a'), array('id' => 102, 'label' => 'b'));
if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
printf("[2010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
--
MySQL Code Commits Mailing List
For list archives:
http://lists.mysql.com/commits
To unsubscribe:
http://lists.mysql.com/commits?unsub=lists@pantek.com
Received on Mon Oct 1 17:18:02 2007
This archive was generated by hypermail 2.1.8
: Sun Oct 07 2007 - 09:48:03 EDT
|