Author: uwendel
Date: 2007-07-20 16:59:00 +0200 (Fri, 20 Jul 2007)
New Revision: 810
Modified:
trunk/tests/ext/mysqli/mysqli_stmt_attr_set.phpt
trunk/tests/ext/mysqli/mysqli_stmt_bind_param_references.phpt
trunk/tests/ext/mysqli/mysqli_stmt_close.phpt
trunk/tests/ext/mysqli/mysqli_stmt_data_seek.phpt
trunk/tests/ext/mysqli/mysqli_stmt_errno.phpt
trunk/tests/ext/mysqli/mysqli_stmt_error.phpt
trunk/tests/ext/mysqli/mysqli_stmt_execute.phpt
trunk/tests/ext/mysqli/mysqli_stmt_fetch.phpt
trunk/tests/ext/mysqli/mysqli_stmt_fetch_fields_win32_unicode.phpt
trunk/tests/ext/mysqli/mysqli_stmt_field_count.phpt
trunk/tests/ext/mysqli/mysqli_stmt_free_result.phpt
trunk/tests/ext/mysqli/mysqli_stmt_get_result2.phpt
Log:
Space2Tab
Modified: trunk/tests/ext/mysqli/mysqli_stmt_attr_set.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_stmt_attr_set.phpt 2007-07-20 14:45:38 UTC (rev 809)
+++ trunk/tests/ext/mysqli/mysqli_stmt_attr_set.phpt 2007-07-20 14:59:00 UTC (rev 810)
@@ -5,241 +5,242 @@
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- include "connect.inc";
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_attr_set()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_attr_set($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ include "connect.inc";
- if (!is_null($tmp = @mysqli_stmt_attr_set($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_attr_set($link, $link, $link)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $tmp = NULL;
+ $link = NULL;
- require('table.inc');
-
- $valid_attr = array(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH);
- if (mysqli_get_client_version() > 50003)
- $valid_attr[] = MYSQLI_STMT_ATTR_CURSOR_TYPE;
+ if (!is_null($tmp = @mysqli_stmt_attr_set()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_stmt_attr_set($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_stmt_attr_set($link, $link)))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_stmt_attr_set($link, $link, $link)))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ require('table.inc');
+
+ $valid_attr = array(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH);
+ if (mysqli_get_client_version() > 50003)
+ $valid_attr[] = MYSQLI_STMT_ATTR_CURSOR_TYPE;
+
/* prefetch isn't supported
- if (mysqli_get_client_version() > 50007)
- $valid_attr[] = MYSQLI_STMT_ATTR_PREFETCH_ROWS;
-*/
- do {
- $invalid_attr = mt_rand(-10000, 10000);
- } while (in_array($invalid_attr, $valid_attr));
-
- $stmt = mysqli_stmt_init($link);
- if (!is_null($tmp = @mysqli_stmt_attr_set($stmt, 0, 0)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- $stmt->prepare("SELECT * FROM test");
- if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0)))
- printf("[006] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- $stmt->close();
-
- //
- // MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH
- //
-
-
- // expecting max_length not to be set and be 0 in all cases
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT label FROM test");
- $stmt->execute();
- $stmt->store_result();
- $res = $stmt->result_metadata();
- $fields = $res->fetch_fields();
- $max_lengths = array();
- foreach ($fields as $k => $meta) {
- $max_lengths[$meta->name] = $meta->max_length;
- if ($meta->max_length !== 0)
- printf("[007] max_length should be not set (= 0), got %s for field %s\n",
$meta->max_length, $meta->name);
- }
- $res->close();
- $stmt->close();
-
- // expecting max_length to _be_ set
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT label FROM test");
- $stmt->attr_set(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH, 1);
- $stmt->execute();
- $stmt->store_result();
- $res = $stmt->result_metadata();
- $fields = $res->fetch_fields();
- $max_lengths = array();
- foreach ($fields as $k => $meta) {
- $max_lengths[$meta->name] = $meta->max_length;
- if ($meta->max_length === 0)
- printf("[008] max_length should be set (!= 0), got %s for field %s\n",
$meta->max_length, $meta->name);
- }
- $res->close();
- $stmt->close();
-
- // expecting max_length not to be set
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT label FROM test");
- $stmt->attr_set(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH, 0);
- $stmt->execute();
- $stmt->store_result();
- $res = $stmt->result_metadata();
- $fields = $res->fetch_fields();
- $max_lengths = array();
- foreach ($fields as $k => $meta) {
- $max_lengths[$meta->name] = $meta->max_length;
- if ($meta->max_length !== 0)
- printf("[009] max_length should not be set (= 0), got %s for field %s\n",
$meta->max_length, $meta->name);
- }
- $res->close();
- $stmt->close();
-
- //
- // Cursors
- //
+ if (mysqli_get_client_version() > 50007)
+ $valid_attr[] = MYSQLI_STMT_ATTR_PREFETCH_ROWS;
+*/
+ do {
+ $invalid_attr = mt_rand(-10000, 10000);
+ } while (in_array($invalid_attr, $valid_attr));
- if (mysqli_get_client_version() > 50003) {
-
- $cursor_types = array(
- MYSQLI_CURSOR_TYPE_NO_CURSOR,
- MYSQLI_CURSOR_TYPE_READ_ONLY,
- MYSQLI_CURSOR_TYPE_FOR_UPDATE,
- MYSQLI_CURSOR_TYPE_SCROLLABLE
- );
- do {
- $invalid_cursor_type = mt_rand(-1000, 1000);
- } while (in_array($invalid_cursor_type, $cursor_types));
-
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT id, label FROM test");
-
- if (false !== ($tmp = @$stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE,
$invalid_cursor_type)))
- printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (false !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE,
MYSQLI_CURSOR_TYPE_FOR_UPDATE)))
- printf("[011] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (false !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE,
MYSQLI_CURSOR_TYPE_SCROLLABLE)))
- printf("[012] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE,
MYSQLI_CURSOR_TYPE_NO_CURSOR)))
- printf("[013] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE,
MYSQLI_CURSOR_TYPE_READ_ONLY)))
- printf("[014] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- $stmt->close();
-
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT id, label FROM test");
- $stmt->execute();
- $id = $label = NULL;
- $stmt->bind_result($id, $label);
- $results = array();
- while ($stmt->fetch())
- $results[$id] = $label;
- $stmt->close();
- if (empty($results))
- printf("[015] Results should not be empty, subsequent tests will probably
fail!\n");
-
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT id, label FROM test");
- if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE,
MYSQLI_CURSOR_TYPE_NO_CURSOR)))
- printf("[016] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- $stmt->execute();
- $id = $label = NULL;
- $stmt->bind_result($id, $label);
- $results2 = array();
- while ($stmt->fetch())
- $results2[$id] = $label;
- $stmt->close();
- if ($results != $results2) {
- printf("[017] Results should not differ. Dumping both result sets.\n");
- var_dump($results);
- var_dump($results2);
- }
-
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT id, label FROM test");
- if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE,
MYSQLI_CURSOR_TYPE_READ_ONLY)))
- printf("[018] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- $stmt->execute();
- $id = $label = NULL;
- $stmt->bind_result($id, $label);
- $results2 = array();
- while ($stmt->fetch())
- $results2[$id] = $label;
- $stmt->close();
- if ($results != $results2) {
- printf("[019] Results should not differ. Dumping both result sets.\n");
- var_dump($results);
- var_dump($results2);
- }
+ $stmt = mysqli_stmt_init($link);
+ if (!is_null($tmp = @mysqli_stmt_attr_set($stmt, 0, 0)))
+ printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- }
+ $stmt->prepare("SELECT * FROM test");
+ if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0)))
+ printf("[006] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- //
- // MYSQLI_STMT_ATTR_PREFETCH_ROWS
- //
-
- if (mysqli_get_client_version() > 50007) {
-
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT id, label FROM test");
- if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, 1)))
- printf("[020] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- $stmt->execute();
- $id = $label = NULL;
- $stmt->bind_result($id, $label);
- $results = array();
- while ($stmt->fetch())
- $results[$id] = $label;
- $stmt->close();
- if (empty($results))
- printf("[021] Results should not be empty, subsequent tests will probably
fail!\n");
-
- /* prefetch is not supported
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT label FROM test");
- if (false !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, -1)))
- printf("[022] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- $stmt->close();
-
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT label FROM test");
- if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS,
PHP_INT_MAX)))
- printf("[023] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- $stmt->close();
-
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT id, label FROM test");
- if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, 2)))
- printf("[024] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- $stmt->execute();
- $id = $label = NULL;
- $stmt->bind_result($id, $label);
- $results2 = array();
- while ($stmt->fetch())
- $results2[$id] = $label;
- $stmt->close();
- if ($results != $results2) {
- printf("[025] Results should not differ. Dumping both result sets.\n");
- var_dump($results);
- var_dump($results2);
- }
+ $stmt->close();
+
+ //
+ // MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH
+ //
+
+
+ // expecting max_length not to be set and be 0 in all cases
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT label FROM test");
+ $stmt->execute();
+ $stmt->store_result();
+ $res = $stmt->result_metadata();
+ $fields = $res->fetch_fields();
+ $max_lengths = array();
+ foreach ($fields as $k => $meta) {
+ $max_lengths[$meta->name] = $meta->max_length;
+ if ($meta->max_length !== 0)
+ printf("[007] max_length should be not set (= 0), got %s for field %s\n",
$meta->max_length, $meta->name);
+ }
+ $res->close();
+ $stmt->close();
+
+ // expecting max_length to _be_ set
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT label FROM test");
+ $stmt->attr_set(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH, 1);
+ $stmt->execute();
+ $stmt->store_result();
+ $res = $stmt->result_metadata();
+ $fields = $res->fetch_fields();
+ $max_lengths = array();
+ foreach ($fields as $k => $meta) {
+ $max_lengths[$meta->name] = $meta->max_length;
+ if ($meta->max_length === 0)
+ printf("[008] max_length should be set (!= 0), got %s for field %s\n",
$meta->max_length, $meta->name);
+ }
+ $res->close();
+ $stmt->close();
+
+ // expecting max_length not to be set
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT label FROM test");
+ $stmt->attr_set(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH, 0);
+ $stmt->execute();
+ $stmt->store_result();
+ $res = $stmt->result_metadata();
+ $fields = $res->fetch_fields();
+ $max_lengths = array();
+ foreach ($fields as $k => $meta) {
+ $max_lengths[$meta->name] = $meta->max_length;
+ if ($meta->max_length !== 0)
+ printf("[009] max_length should not be set (= 0), got %s for field %s\n",
$meta->max_length, $meta->name);
+ }
+ $res->close();
+ $stmt->close();
+
+ //
+ // Cursors
+ //
+
+ if (mysqli_get_client_version() > 50003) {
+
+ $cursor_types = array(
+ MYSQLI_CURSOR_TYPE_NO_CURSOR,
+ MYSQLI_CURSOR_TYPE_READ_ONLY,
+ MYSQLI_CURSOR_TYPE_FOR_UPDATE,
+ MYSQLI_CURSOR_TYPE_SCROLLABLE
+ );
+ do {
+ $invalid_cursor_type = mt_rand(-1000, 1000);
+ } while (in_array($invalid_cursor_type, $cursor_types));
+
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT id, label FROM test");
+
+ if (false !== ($tmp = @$stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE,
$invalid_cursor_type)))
+ printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (false !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE,
MYSQLI_CURSOR_TYPE_FOR_UPDATE)))
+ printf("[011] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (false !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE,
MYSQLI_CURSOR_TYPE_SCROLLABLE)))
+ printf("[012] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE,
MYSQLI_CURSOR_TYPE_NO_CURSOR)))
+ printf("[013] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE,
MYSQLI_CURSOR_TYPE_READ_ONLY)))
+ printf("[014] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ $stmt->close();
+
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT id, label FROM test");
+ $stmt->execute();
+ $id = $label = NULL;
+ $stmt->bind_result($id, $label);
+ $results = array();
+ while ($stmt->fetch())
+ $results[$id] = $label;
+ $stmt->close();
+ if (empty($results))
+ printf("[015] Results should not be empty, subsequent tests will probably fail!\n");
+
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT id, label FROM test");
+ if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE,
MYSQLI_CURSOR_TYPE_NO_CURSOR)))
+ printf("[016] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $stmt->execute();
+ $id = $label = NULL;
+ $stmt->bind_result($id, $label);
+ $results2 = array();
+ while ($stmt->fetch())
+ $results2[$id] = $label;
+ $stmt->close();
+ if ($results != $results2) {
+ printf("[017] Results should not differ. Dumping both result sets.\n");
+ var_dump($results);
+ var_dump($results2);
+ }
+
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT id, label FROM test");
+ if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE,
MYSQLI_CURSOR_TYPE_READ_ONLY)))
+ printf("[018] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $stmt->execute();
+ $id = $label = NULL;
+ $stmt->bind_result($id, $label);
+ $results2 = array();
+ while ($stmt->fetch())
+ $results2[$id] = $label;
+ $stmt->close();
+ if ($results != $results2) {
+ printf("[019] Results should not differ. Dumping both result sets.\n");
+ var_dump($results);
+ var_dump($results2);
+ }
+
+ }
+
+
+ //
+ // MYSQLI_STMT_ATTR_PREFETCH_ROWS
+ //
+
+ if (mysqli_get_client_version() > 50007) {
+
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT id, label FROM test");
+ if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, 1)))
+ printf("[020] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $stmt->execute();
+ $id = $label = NULL;
+ $stmt->bind_result($id, $label);
+ $results = array();
+ while ($stmt->fetch())
+ $results[$id] = $label;
+ $stmt->close();
+ if (empty($results))
+ printf("[021] Results should not be empty, subsequent tests will probably fail!\n");
+
+ /* prefetch is not supported
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT label FROM test");
+ if (false !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, -1)))
+ printf("[022] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ $stmt->close();
+
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT label FROM test");
+ if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, PHP_INT_MAX)))
+ printf("[023] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $stmt->close();
+
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT id, label FROM test");
+ if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, 2)))
+ printf("[024] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $stmt->execute();
+ $id = $label = NULL;
+ $stmt->bind_result($id, $label);
+ $results2 = array();
+ while ($stmt->fetch())
+ $results2[$id] = $label;
+ $stmt->close();
+ if ($results != $results2) {
+ printf("[025] Results should not differ. Dumping both result sets.\n");
+ var_dump($results);
+ var_dump($results2);
+ }
*/
-
- }
-
- mysqli_close($link);
- print "done!";
+
+ }
+
+ mysqli_close($link);
+ print "done!";
?>
--EXPECTF--
-done!
+done!
\ No newline at end of file
Modified: trunk/tests/ext/mysqli/mysqli_stmt_bind_param_references.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_stmt_bind_param_references.phpt 2007-07-20 14:45:38 UTC
(rev 809)
+++ trunk/tests/ext/mysqli/mysqli_stmt_bind_param_references.phpt 2007-07-20 14:59:00 UTC
(rev 810)
@@ -197,4 +197,4 @@
print "done!";
?>
--EXPECTF--
-done!
+done!
\ No newline at end of file
Modified: trunk/tests/ext/mysqli/mysqli_stmt_close.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_stmt_close.phpt 2007-07-20 14:45:38 UTC (rev 809)
+++ trunk/tests/ext/mysqli/mysqli_stmt_close.phpt 2007-07-20 14:59:00 UTC (rev 810)
@@ -5,80 +5,80 @@
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- include "connect.inc";
+ include "connect.inc";
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_stmt_close()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_close()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_stmt_close($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_stmt_close($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- // Yes, amazing, eh? AFAIK a work around of a constructor bug...
- if (!is_null($tmp = mysqli_stmt_close($stmt)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ // Yes, amazing, eh? AFAIK a work around of a constructor bug...
+ if (!is_null($tmp = mysqli_stmt_close($stmt)))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test"))
- printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test"))
+ printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (true !== ($tmp = mysqli_stmt_close($stmt)))
- printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_stmt_close($stmt)))
+ printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = mysqli_stmt_close($stmt)))
- printf("[007] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = mysqli_stmt_close($stmt)))
+ printf("[007] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
- printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
+ printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = $label = null;
- if (!mysqli_stmt_bind_param($stmt, "is", $id, $label))
- printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = 100; $label = 'z';
- if (!mysqli_stmt_execute($stmt))
- printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- mysqli_kill($link, mysqli_thread_id($link));
+ $id = $label = null;
+ if (!mysqli_stmt_bind_param($stmt, "is", $id, $label))
+ printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (true !== ($tmp = mysqli_stmt_close($stmt)))
- printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $id = 100; $label = 'z';
+ if (!mysqli_stmt_execute($stmt))
+ printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_close($link);
-
- require('table.inc');
- if (!$stmt = mysqli_stmt_init($link))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_kill($link, mysqli_thread_id($link));
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test"))
- printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label))
- printf("[015] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (true !== ($tmp = mysqli_stmt_close($stmt)))
+ printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt))
- printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- mysqli_kill($link, mysqli_thread_id($link));
-
- if (true !== ($tmp = mysqli_stmt_close($stmt)))
- printf("[017] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ mysqli_close($link);
- print "done!";
+ require('table.inc');
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test"))
+ printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label))
+ printf("[015] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt))
+ printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ mysqli_kill($link, mysqli_thread_id($link));
+
+ if (true !== ($tmp = mysqli_stmt_close($stmt)))
+ printf("[017] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ print "done!";
?>
--EXPECTF--
Warning: mysqli_stmt_close(): invalid object or resource mysqli_stmt
in %s on line %d
Warning: mysqli_stmt_close(): Couldn't fetch mysqli_stmt in %s on line %d
-done!
+done!
\ No newline at end of file
Modified: trunk/tests/ext/mysqli/mysqli_stmt_data_seek.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_stmt_data_seek.phpt 2007-07-20 14:45:38 UTC (rev 809)
+++ trunk/tests/ext/mysqli/mysqli_stmt_data_seek.phpt 2007-07-20 14:59:00 UTC (rev 810)
@@ -5,78 +5,78 @@
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- include "connect.inc";
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_data_seek()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_data_seek($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!is_null($tmp = mysqli_stmt_data_seek($stmt, 1)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id"))
- printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (true !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
-
- $id = null;
- if (!mysqli_stmt_bind_result($stmt, $id))
- printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_store_result($stmt))
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!is_null($tmp = mysqli_stmt_data_seek($stmt, 2)))
- printf("[009] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_fetch($stmt))
- printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- var_dump($id);
-
- if (!is_null($tmp = mysqli_stmt_data_seek($stmt, 0)))
- printf("[011] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_fetch($stmt))
- printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- var_dump($id);
-
- if (!is_null($tmp = mysqli_stmt_data_seek($stmt, mysqli_stmt_num_rows($stmt) + 100)))
- printf("[013] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (mysqli_stmt_fetch($stmt))
- printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- var_dump($id);
-
- if (false !== ($tmp = mysqli_stmt_data_seek($stmt, -1)))
- printf("[015] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (mysqli_stmt_fetch($stmt))
- printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- var_dump($id);
-
- mysqli_stmt_close($stmt);
-
- if (NULL !== ($tmp = mysqli_stmt_data_seek($stmt, 0)))
- printf("[017] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
- print "done!";
+ include "connect.inc";
+
+ $tmp = NULL;
+ $link = NULL;
+
+ if (!is_null($tmp = @mysqli_stmt_data_seek()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_stmt_data_seek($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ require('table.inc');
+
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!is_null($tmp = mysqli_stmt_data_seek($stmt, 1)))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id"))
+ printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (true !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+
+ $id = null;
+ if (!mysqli_stmt_bind_result($stmt, $id))
+ printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_store_result($stmt))
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!is_null($tmp = mysqli_stmt_data_seek($stmt, 2)))
+ printf("[009] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_fetch($stmt))
+ printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ var_dump($id);
+
+ if (!is_null($tmp = mysqli_stmt_data_seek($stmt, 0)))
+ printf("[011] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_fetch($stmt))
+ printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ var_dump($id);
+
+ if (!is_null($tmp = mysqli_stmt_data_seek($stmt, mysqli_stmt_num_rows($stmt) + 100)))
+ printf("[013] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (mysqli_stmt_fetch($stmt))
+ printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ var_dump($id);
+
+ if (false !== ($tmp = mysqli_stmt_data_seek($stmt, -1)))
+ printf("[015] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (mysqli_stmt_fetch($stmt))
+ printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ var_dump($id);
+
+ mysqli_stmt_close($stmt);
+
+ if (NULL !== ($tmp = mysqli_stmt_data_seek($stmt, 0)))
+ printf("[017] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_close($link);
+ print "done!";
?>
--EXPECTF--
Warning: mysqli_stmt_data_seek(): invalid object or resource mysqli_stmt
@@ -89,4 +89,4 @@
int(1)
Warning: mysqli_stmt_data_seek(): Couldn't fetch mysqli_stmt in %s on line %d
-done!
+done!
\ No newline at end of file
Modified: trunk/tests/ext/mysqli/mysqli_stmt_errno.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_stmt_errno.phpt 2007-07-20 14:45:38 UTC (rev 809)
+++ trunk/tests/ext/mysqli/mysqli_stmt_errno.phpt 2007-07-20 14:59:00 UTC (rev 810)
@@ -5,57 +5,57 @@
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- include "connect.inc";
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_errno()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_errno($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- // properly initialized?
- if (0 !== ($tmp = mysqli_stmt_errno($stmt)))
- printf("[004] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
-
- if (mysqli_stmt_prepare($stmt, "SELECT i_do_not_exist_believe_me FROM test ORDER BY
id"))
- printf("[005] Statement should have failed!\n");
+ include "connect.inc";
- // set after error server?
- if (0 === ($tmp = mysqli_stmt_errno($stmt)))
- printf("[006] Expecting int/any non zero, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id"))
- printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- // reset after error & success
- if (0 != ($tmp = mysqli_stmt_errno($stmt)))
- printf("[008] Expecting zero, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_kill($link, mysqli_thread_id($link));
-
- if (true === ($tmp = mysqli_stmt_execute($stmt)))
- printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- // set after client error
- if (0 === ($tmp = mysqli_stmt_errno($stmt)))
- printf("[010] Execting int/any non zero, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_stmt_close($stmt);
-
- if (NULL !== ($tmp = mysqli_stmt_errno($stmt)))
- printf("[011] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
- print "done!";
+ $tmp = NULL;
+ $link = NULL;
+
+ if (!is_null($tmp = @mysqli_stmt_errno()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_stmt_errno($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ require('table.inc');
+
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ // properly initialized?
+ if (0 !== ($tmp = mysqli_stmt_errno($stmt)))
+ printf("[004] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (mysqli_stmt_prepare($stmt, "SELECT i_do_not_exist_believe_me FROM test ORDER BY
id"))
+ printf("[005] Statement should have failed!\n");
+
+ // set after error server?
+ if (0 === ($tmp = mysqli_stmt_errno($stmt)))
+ printf("[006] Expecting int/any non zero, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id"))
+ printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ // reset after error & success
+ if (0 != ($tmp = mysqli_stmt_errno($stmt)))
+ printf("[008] Expecting zero, got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_kill($link, mysqli_thread_id($link));
+
+ if (true === ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ // set after client error
+ if (0 === ($tmp = mysqli_stmt_errno($stmt)))
+ printf("[010] Execting int/any non zero, got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_stmt_close($stmt);
+
+ if (NULL !== ($tmp = mysqli_stmt_errno($stmt)))
+ printf("[011] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_close($link);
+ print "done!";
?>
--EXPECTF--
Warning: mysqli_stmt_errno(): Couldn't fetch mysqli_stmt in %s on line %d
-done!
+done!
\ No newline at end of file
Modified: trunk/tests/ext/mysqli/mysqli_stmt_error.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_stmt_error.phpt 2007-07-20 14:45:38 UTC (rev 809)
+++ trunk/tests/ext/mysqli/mysqli_stmt_error.phpt 2007-07-20 14:59:00 UTC (rev 810)
@@ -5,58 +5,57 @@
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- include "connect.inc";
+ include "connect.inc";
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_error()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_error($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- // properly initialized?
- if ('' !== ($tmp = mysqli_stmt_error($stmt)))
- printf("[004] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
-
- if (mysqli_stmt_prepare($stmt, "SELECT i_do_not_exist_believe_me FROM test ORDER BY
id"))
- printf("[005] Statement should have failed!\n");
+ $tmp = NULL;
+ $link = NULL;
- // set after error server?
- if ('' === ($tmp = mysqli_stmt_error($stmt)))
- printf("[006] Expecting string/any non empty, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id"))
- printf("[007] [%d] %s\n", mysqli_stmt_error($stmt), mysqli_stmt_error($stmt));
-
- // reset after error & success
- if ('' !== ($tmp = mysqli_stmt_error($stmt)))
- printf("[008] Expecting empty string, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_kill($link, mysqli_thread_id($link));
-
- if (true === ($tmp = mysqli_stmt_execute($stmt)))
- printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- // set after client error
- if ('' === ($tmp = mysqli_stmt_error($stmt)))
- printf("[010] Execting string/any non empty, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_stmt_close($stmt);
-
- if (NULL !== ($tmp = mysqli_stmt_error($stmt)))
- printf("[011] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
-
- mysqli_close($link);
- print "done!";
+ if (!is_null($tmp = @mysqli_stmt_error()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_stmt_error($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ require('table.inc');
+
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ // properly initialized?
+ if ('' !== ($tmp = mysqli_stmt_error($stmt)))
+ printf("[004] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (mysqli_stmt_prepare($stmt, "SELECT i_do_not_exist_believe_me FROM test ORDER BY
id"))
+ printf("[005] Statement should have failed!\n");
+
+ // set after error server?
+ if ('' === ($tmp = mysqli_stmt_error($stmt)))
+ printf("[006] Expecting string/any non empty, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id"))
+ printf("[007] [%d] %s\n", mysqli_stmt_error($stmt), mysqli_stmt_error($stmt));
+
+ // reset after error & success
+ if ('' !== ($tmp = mysqli_stmt_error($stmt)))
+ printf("[008] Expecting empty string, got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_kill($link, mysqli_thread_id($link));
+
+ if (true === ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ // set after client error
+ if ('' === ($tmp = mysqli_stmt_error($stmt)))
+ printf("[010] Execting string/any non empty, got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_stmt_close($stmt);
+
+ if (NULL !== ($tmp = mysqli_stmt_error($stmt)))
+ printf("[011] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_close($link);
+ print "done!";
?>
--EXPECTF--
Warning: mysqli_stmt_error(): Couldn't fetch mysqli_stmt in %s on line %d
-done!
+done!
\ No newline at end of file
Modified: trunk/tests/ext/mysqli/mysqli_stmt_execute.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_stmt_execute.phpt 2007-07-20 14:45:38 UTC (rev 809)
+++ trunk/tests/ext/mysqli/mysqli_stmt_execute.phpt 2007-07-20 14:59:00 UTC (rev 810)
@@ -5,67 +5,67 @@
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- include "connect.inc";
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_execute()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_execute($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- // stmt object status test
- if (NULL !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (mysqli_stmt_prepare($stmt, "SELECT i_do_not_exist_believe_me FROM test ORDER BY
id"))
- printf("[005] Statement should have failed!\n");
+ include "connect.inc";
- // stmt object status test
- if (NULL !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id LIMIT 1"))
- printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (true !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[008] Expecting boolean/true, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
- printf("[009] [%d] %s\n", mysqli_stmt_execute($stmt),
mysqli_stmt_execute($stmt));
-
- // no input variables bound
- if (false !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- $id = 100;
- $label = "z";
- if (!mysqli_stmt_bind_param($stmt, "is", $id, $label))
- printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (true !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- mysqli_kill($link, mysqli_thread_id($link));
-
- if (false !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[014] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_stmt_close($stmt);
-
- if (NULL !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[015] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
- print "done!";
+ $tmp = NULL;
+ $link = NULL;
+
+ if (!is_null($tmp = @mysqli_stmt_execute()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_stmt_execute($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ require('table.inc');
+
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ // stmt object status test
+ if (NULL !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (mysqli_stmt_prepare($stmt, "SELECT i_do_not_exist_believe_me FROM test ORDER BY
id"))
+ printf("[005] Statement should have failed!\n");
+
+ // stmt object status test
+ if (NULL !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id LIMIT 1"))
+ printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (true !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[008] Expecting boolean/true, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
+ printf("[009] [%d] %s\n", mysqli_stmt_execute($stmt), mysqli_stmt_execute($stmt));
+
+ // no input variables bound
+ if (false !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ $id = 100;
+ $label = "z";
+ if (!mysqli_stmt_bind_param($stmt, "is", $id, $label))
+ printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (true !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ mysqli_kill($link, mysqli_thread_id($link));
+
+ if (false !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[014] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_stmt_close($stmt);
+
+ if (NULL !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[015] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_close($link);
+ print "done!";
?>
--EXPECTF--
Warning: mysqli_stmt_execute(): invalid object or resource mysqli_stmt
@@ -75,4 +75,4 @@
in %s on line %d
Warning: mysqli_stmt_execute(): Couldn't fetch mysqli_stmt in %s on line %d
-done!
+done!
\ No newline at end of file
Modified: trunk/tests/ext/mysqli/mysqli_stmt_fetch.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_stmt_fetch.phpt 2007-07-20 14:45:38 UTC (rev 809)
+++ trunk/tests/ext/mysqli/mysqli_stmt_fetch.phpt 2007-07-20 14:59:00 UTC (rev 810)
@@ -5,82 +5,82 @@
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- /*
- NOTE: no datatype tests here! This is done by
- mysqli_stmt_bind_result.phpt already. Restrict
- this test case to the basics.
- */
- include "connect.inc";
+ /*
+ NOTE: no datatype tests here! This is done by
+ mysqli_stmt_bind_result.phpt already. Restrict
+ this test case to the basics.
+ */
+ include "connect.inc";
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_fetch()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_fetch($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- // stmt object status test
- if (NULL !== ($tmp = mysqli_stmt_fetch($stmt)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
- printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- // FIXME - different versions return different values ?!
- if ((NULL !== ($tmp = mysqli_stmt_fetch($stmt))) && (false !== $tmp))
- printf("[006] Expecting NULL or boolean/false, got %s/%s\n", gettype($tmp),
$tmp);
-
- if (!mysqli_stmt_execute($stmt))
- printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (true !== ($tmp = mysqli_stmt_fetch($stmt)))
- printf("[008] NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = NULL;
+ $link = NULL;
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
- printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = NULL;
- $label = NULL;
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
- printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== ($tmp = mysqli_stmt_fetch($stmt)))
- printf("[013] Expecting boolean/true, got %s/%s, [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_kill($link, mysqli_thread_id($link)))
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (true !== ($tmp = mysqli_stmt_fetch($stmt)))
- printf("[015] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_stmt_close($stmt);
-
- if (NULL !== ($tmp = mysqli_stmt_fetch($stmt)))
- printf("[016] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
-
- /* Check that the function alias exists. It's a deprecated function,
- but we have not announce the removal so far, therefore we need to check for it */
- if (!is_null($tmp = @mysqli_fetch()))
- printf("[017] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ if (!is_null($tmp = @mysqli_stmt_fetch()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_stmt_fetch($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ require('table.inc');
+
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ // stmt object status test
+ if (NULL !== ($tmp = mysqli_stmt_fetch($stmt)))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
+ printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ // FIXME - different versions return different values ?!
+ if ((NULL !== ($tmp = mysqli_stmt_fetch($stmt))) && (false !== $tmp))
+ printf("[006] Expecting NULL or boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (true !== ($tmp = mysqli_stmt_fetch($stmt)))
+ printf("[008] NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
+ printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = NULL;
+ $label = NULL;
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
+ printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== ($tmp = mysqli_stmt_fetch($stmt)))
+ printf("[013] Expecting boolean/true, got %s/%s, [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_kill($link, mysqli_thread_id($link)))
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (true !== ($tmp = mysqli_stmt_fetch($stmt)))
+ printf("[015] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_stmt_close($stmt);
+
+ if (NULL !== ($tmp = mysqli_stmt_fetch($stmt)))
+ printf("[016] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_close($link);
+
+ /* Check that the function alias exists. It's a deprecated function,
+ but we have not announce the removal so far, therefore we need to check for it */
+ if (!is_null($tmp = @mysqli_fetch()))
+ printf("[017] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ print "done!";
?>
--EXPECTF--
Warning: mysqli_stmt_fetch(): invalid object or resource mysqli_stmt
@@ -88,4 +88,4 @@
[014] [%d] Commands out of sync; you can't run this command now
Warning: mysqli_stmt_fetch(): Couldn't fetch mysqli_stmt in %s on line %d
-done!
+done!
\ No newline at end of file
Modified: trunk/tests/ext/mysqli/mysqli_stmt_fetch_fields_win32_unicode.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_stmt_fetch_fields_win32_unicode.phpt 2007-07-20 14:45:38
UTC (rev 809)
+++ trunk/tests/ext/mysqli/mysqli_stmt_fetch_fields_win32_unicode.phpt 2007-07-20 14:59:00
UTC (rev 810)
@@ -4,30 +4,30 @@
<?php require_once('skipif.inc'); ?>
<?php require_once('skipifemb.inc'); ?>
--FILE--
-<?php
- include "connect.inc";
- require('table.inc');
+<?php
+ include "connect.inc";
+ require('table.inc');
$bind_res = $id = null;
if (!($stmt = mysqli_stmt_init($link)) ||
!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test") ||
!mysqli_stmt_execute($stmt) ||
- !($result = mysqli_stmt_result_metadata($stmt)) ||
- !mysqli_stmt_bind_result($stmt, $id, $bind_res) ||
- !($fields = mysqli_fetch_fields($result))) {
+ !($result = mysqli_stmt_result_metadata($stmt)) ||
+ !mysqli_stmt_bind_result($stmt, $id, $bind_res) ||
+ !($fields = mysqli_fetch_fields($result))) {
printf("FAIL 1\n");
- }
+ }
while (mysqli_stmt_fetch($stmt)) {
;
}
mysqli_free_result($result);
mysqli_stmt_close($stmt);
-
+
if (!($stmt = mysqli_stmt_init($link)) ||
!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test") ||
!mysqli_stmt_execute($stmt) ||
- !($result = mysqli_stmt_result_metadata($stmt)) ||
- !mysqli_stmt_bind_result($stmt, $id, $bind_res)) {
+ !($result = mysqli_stmt_result_metadata($stmt)) ||
+ !mysqli_stmt_bind_result($stmt, $id, $bind_res)) {
printf("FAIL 2\n");
}
print "OK: 1\n";
@@ -39,9 +39,9 @@
}
mysqli_free_result($result);
mysqli_stmt_close($stmt);
-
- mysqli_close($link);
- print "done!";
+
+ mysqli_close($link);
+ print "done!";
?>
--EXPECTF--
OK: 1
Modified: trunk/tests/ext/mysqli/mysqli_stmt_field_count.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_stmt_field_count.phpt 2007-07-20 14:45:38 UTC (rev 809)
+++ trunk/tests/ext/mysqli/mysqli_stmt_field_count.phpt 2007-07-20 14:59:00 UTC (rev 810)
@@ -5,78 +5,78 @@
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- include "connect.inc";
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_field_count()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_field_count($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- $stmt = mysqli_stmt_init($link);
- if (!is_null($tmp = mysqli_stmt_field_count($stmt)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (mysqli_stmt_prepare($stmt, ''))
- printf("[004] Prepare should fail for an empty statement\n");
- if (!is_null($tmp = mysqli_stmt_field_count($stmt)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT 1'))
- printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (1 !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[007] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT 1, 2'))
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (2 !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[009] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test'))
- printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (2 !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[011] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT label FROM test') ||
- !mysqli_stmt_execute($stmt))
- printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (1 !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[013] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
-
- $label = null;
- if (mysqli_stmt_bind_param($stmt, "s", $label))
- printf("[014] expected error - got ok\n");
- while (mysqli_stmt_fetch($stmt))
- if (1 !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[015] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_prepare($stmt, 'INSERT INTO test(id) VALUES (100)'))
- printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (0 !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[017] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_prepare($stmt, 'UPDATE test SET label = "z" WHERE id = 1') ||
- !mysqli_stmt_execute($stmt))
- printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- ;
- if (0 !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[019] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_stmt_close($stmt);
-
- if (mysqli_stmt_prepare($stmt, 'SELECT id FROM test'))
- printf("[020] Prepare should fail, statement has been closed\n");
- if (!is_null($tmp = mysqli_stmt_field_count($stmt)))
- printf("[011] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
-
- print "done!";
+ include "connect.inc";
+
+ $tmp = NULL;
+ $link = NULL;
+
+ if (!is_null($tmp = @mysqli_stmt_field_count()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_stmt_field_count($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ require('table.inc');
+
+ $stmt = mysqli_stmt_init($link);
+ if (!is_null($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (mysqli_stmt_prepare($stmt, ''))
+ printf("[004] Prepare should fail for an empty statement\n");
+ if (!is_null($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT 1'))
+ printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (1 !== ($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[007] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT 1, 2'))
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (2 !== ($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[009] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test'))
+ printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (2 !== ($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[011] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT label FROM test') ||
+ !mysqli_stmt_execute($stmt))
+ printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (1 !== ($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[013] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+
+ $label = null;
+ if (mysqli_stmt_bind_param($stmt, "s", $label))
+ printf("[014] expected error - got ok\n");
+ while (mysqli_stmt_fetch($stmt))
+ if (1 !== ($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[015] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_prepare($stmt, 'INSERT INTO test(id) VALUES (100)'))
+ printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (0 !== ($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[017] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_prepare($stmt, 'UPDATE test SET label = "z" WHERE id = 1') ||
+ !mysqli_stmt_execute($stmt))
+ printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (0 !== ($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[019] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_stmt_close($stmt);
+
+ if (mysqli_stmt_prepare($stmt, 'SELECT id FROM test'))
+ printf("[020] Prepare should fail, statement has been closed\n");
+ if (!is_null($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[011] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_close($link);
+
+ print "done!";
?>
--EXPECTF--
Warning: mysqli_stmt_field_count(): invalid object or resource mysqli_stmt
@@ -88,4 +88,4 @@
Warning: mysqli_stmt_prepare(): Couldn't fetch mysqli_stmt in %s on line %d
Warning: mysqli_stmt_field_count(): Couldn't fetch mysqli_stmt in %s on line %d
-done!
+done!
\ No newline at end of file
Modified: trunk/tests/ext/mysqli/mysqli_stmt_free_result.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_stmt_free_result.phpt 2007-07-20 14:45:38 UTC (rev 809)
+++ trunk/tests/ext/mysqli/mysqli_stmt_free_result.phpt 2007-07-20 14:59:00 UTC (rev 810)
@@ -5,75 +5,75 @@
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- /*
- NOTE: no datatype tests here! This is done by
- mysqli_stmt_bind_result.phpt already. Restrict
- this test case to the basics.
- */
- include "connect.inc";
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_free_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_free_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- // stmt object status test
- if (NULL !== ($tmp = mysqli_stmt_free_result($stmt)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id"))
- printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (NULL !== ($tmp = mysqli_stmt_free_result($stmt)))
- printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_execute($stmt))
- printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (NULL !== ($tmp = mysqli_stmt_free_result($stmt)))
- printf("[008] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (false !== ($tmp = mysqli_stmt_store_result($stmt)))
- printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_stmt_close($stmt);
-
- if (!$stmt = mysqli_stmt_init($link))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id"))
- printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (true !== ($tmp = mysqli_stmt_store_result($stmt)))
- printf("[013] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (NULL !== ($tmp = mysqli_stmt_free_result($stmt)))
- printf("[014] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_stmt_close($stmt);
-
- if (NULL !== ($tmp = mysqli_stmt_free_result($stmt)))
- printf("[015] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
-
- print "done!";
+ /*
+ NOTE: no datatype tests here! This is done by
+ mysqli_stmt_bind_result.phpt already. Restrict
+ this test case to the basics.
+ */
+ include "connect.inc";
+
+ $tmp = NULL;
+ $link = NULL;
+
+ if (!is_null($tmp = @mysqli_stmt_free_result()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_stmt_free_result($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ require('table.inc');
+
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ // stmt object status test
+ if (NULL !== ($tmp = mysqli_stmt_free_result($stmt)))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id"))
+ printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (NULL !== ($tmp = mysqli_stmt_free_result($stmt)))
+ printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (NULL !== ($tmp = mysqli_stmt_free_result($stmt)))
+ printf("[008] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (false !== ($tmp = mysqli_stmt_store_result($stmt)))
+ printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_stmt_close($stmt);
+
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id"))
+ printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (true !== ($tmp = mysqli_stmt_store_result($stmt)))
+ printf("[013] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (NULL !== ($tmp = mysqli_stmt_free_result($stmt)))
+ printf("[014] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_stmt_close($stmt);
+
+ if (NULL !== ($tmp = mysqli_stmt_free_result($stmt)))
+ printf("[015] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_close($link);
+
+ print "done!";
?>
--EXPECTF--
Warning: mysqli_stmt_free_result(): invalid object or resource mysqli_stmt
in %s on line %d
Warning: mysqli_stmt_free_result(): Couldn't fetch mysqli_stmt in %s on line %d
-done!
+done!
\ No newline at end of file
Modified: trunk/tests/ext/mysqli/mysqli_stmt_get_result2.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_stmt_get_result2.phpt 2007-07-20 14:45:38 UTC (rev 809)
+++ trunk/tests/ext/mysqli/mysqli_stmt_get_result2.phpt 2007-07-20 14:59:00 UTC (rev 810)
@@ -10,11 +10,11 @@
NOTE: no datatype tests here! This is done by
mysqli_stmt_bind_result.phpt already. Restrict
this test case to the basics.
- */
+ */
include "connect.inc";
$tmp = NULL;
- $link = NULL;
+ $link = NULL;
if (!is_null($tmp = @mysqli_stmt_get_result()))
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
@@ -32,121 +32,120 @@
if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 1"))
printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' !=
get_class($res)) {
- printf("[007] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
- while ($row = mysqli_fetch_assoc($res))
- var_dump($row);
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
-
- if (false !== ($res = mysqli_stmt_get_result($stmt))) {
- printf("[008] boolean/false got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
-
- mysqli_stmt_execute($stmt);
- if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' !=
get_class($res)) {
- printf("[009] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
- while ($row = mysqli_fetch_assoc($res))
- var_dump($row);
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
-
+ if (!mysqli_stmt_execute($stmt))
+ printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' !=
get_class($res)) {
+ printf("[007] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+ while ($row = mysqli_fetch_assoc($res))
+ var_dump($row);
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+
+ if (false !== ($res = mysqli_stmt_get_result($stmt))) {
+ printf("[008] boolean/false got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+
+ mysqli_stmt_execute($stmt);
+ if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' !=
get_class($res)) {
+ printf("[009] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+ while ($row = mysqli_fetch_assoc($res))
+ var_dump($row);
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+
mysqli_stmt_close($stmt);
-
+
if (!($stmt = mysqli_stmt_init($link)) ||
- !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") ||
- !mysqli_stmt_execute($stmt))
- printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
$id = $label = null;
if (!mysqli_stmt_bind_result($stmt, $id, $label))
- printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_fetch($stmt))
- printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (false !== ($res = mysqli_stmt_get_result($stmt))) {
- printf("[013] boolean/false got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
-
- mysqli_stmt_close($stmt);
-
+ if (!mysqli_stmt_fetch($stmt))
+ printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (false !== ($res = mysqli_stmt_get_result($stmt))) {
+ printf("[013] boolean/false got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+
+ mysqli_stmt_close($stmt);
+
if (!($stmt = mysqli_stmt_init($link)) ||
- !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") ||
- !mysqli_stmt_execute($stmt))
+ !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") ||
+ !mysqli_stmt_execute($stmt))
printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' !=
get_class($res)) {
- printf("[015] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
-
- $id = $label = null;
+
+ if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' !=
get_class($res)) {
+ printf("[015] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+
+ $id = $label = null;
if (!mysqli_stmt_bind_result($stmt, $id, $label))
- printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_fetch($stmt))
- printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- mysqli_stmt_close($stmt);
-
+ printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_fetch($stmt))
+ printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ mysqli_stmt_close($stmt);
+
if (!($stmt = mysqli_stmt_init($link)) ||
- !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") ||
- !mysqli_stmt_execute($stmt))
+ !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") ||
+ !mysqli_stmt_execute($stmt))
printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' !=
get_class($res)) {
- printf("[019] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
-
- $id = $label = null;
+
+ if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' !=
get_class($res)) {
+ printf("[019] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+
+ $id = $label = null;
if (!mysqli_stmt_bind_result($stmt, $id, $label))
- printf("[020] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $row = mysqli_fetch_assoc($res);
- if (NULL !== $id || NULL !== $label)
- printf("[021] Bound variables should not have been set\n");
- mysqli_free_result($res);
-
- mysqli_stmt_close($stmt);
-
+ printf("[020] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $row = mysqli_fetch_assoc($res);
+ if (NULL !== $id || NULL !== $label)
+ printf("[021] Bound variables should not have been set\n");
+ mysqli_free_result($res);
+
+ mysqli_stmt_close($stmt);
+
if (!($stmt = mysqli_stmt_init($link)) ||
- !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") ||
- !mysqli_stmt_execute($stmt))
+ !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") ||
+ !mysqli_stmt_execute($stmt))
printf("[022] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' !=
get_class($res)) {
- printf("[023] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
- if (!in_array($res->type, array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT))) {
- printf("[024] Unknown result set type %s\n", $res->type);
- }
- if ($res->type !== MYSQLI_STORE_RESULT)
- printf("[025] Expecting int/%d got %s/%s", MYSQLI_STORE_RESULT,
gettype($res->type), $res->type);
-
- mysqli_free_result($res);
- mysqli_stmt_close($stmt);
+ if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' !=
get_class($res)) {
+ printf("[023] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+ if (!in_array($res->type, array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT))) {
+ printf("[024] Unknown result set type %s\n", $res->type);
+ }
+ if ($res->type !== MYSQLI_STORE_RESULT)
+ printf("[025] Expecting int/%d got %s/%s", MYSQLI_STORE_RESULT, gettype($res->type),
$res->type);
+
+ mysqli_free_result($res);
+ mysqli_stmt_close($stmt);
mysqli_close($link);
-
+
if (NULL !== ($res = mysqli_stmt_get_result($stmt))) {
- printf("[022] Expecting NULL got %s/%s\n",
- gettype($res), $res);
- }
-
- print "done!\n";
+ printf("[022] Expecting NULL got %s/%s\n",
+ gettype($res), $res);
+ }
+
+ print "done!";
?>
--EXPECTF--
array(2) {
@@ -185,4 +184,4 @@
[017] [2014] Commands out of sync; you can't run this command now
Warning: mysqli_stmt_get_result(): Couldn't fetch mysqli_stmt in %s on line %d
-done!
+done!
\ No newline at end of file
| Thread |
|---|
| • PHP mysqlnd svn commit: r810 - trunk/tests/ext/mysqli | uwendel | 20 Jul |