From a0b4a16f5c76de62deae3b66ace067d6d118c6f4 Mon Sep 17 00:00:00 2001 From: Philip Olson Date: Fri, 9 Dec 2011 03:47:42 +0000 Subject: [PATCH] Documented 5.4+ MySQLi_Result iterator support git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@320713 c90b9560-bf6c-de11-be94-00142212c4b1 --- appendices/migration54.xml | 6 +++ reference/mysqli/mysqli_result.xml | 31 ++++++++++++++ .../mysqli/mysqli_result/fetch-assoc.xml | 40 +++++++++++++++++++ 3 files changed, 77 insertions(+) diff --git a/appendices/migration54.xml b/appendices/migration54.xml index 5e74e40f38..9b7944626f 100644 --- a/appendices/migration54.xml +++ b/appendices/migration54.xml @@ -424,6 +424,12 @@ Changes in extension behaviour, and new features: + + + MySQLi_Result now implements + Traversable. + + diff --git a/reference/mysqli/mysqli_result.xml b/reference/mysqli/mysqli_result.xml index 99b6abcd12..5ae52c887f 100644 --- a/reference/mysqli/mysqli_result.xml +++ b/reference/mysqli/mysqli_result.xml @@ -12,6 +12,32 @@ Represents the result set obtained from a query against the database. + + + &Changelog; + + + + &Changelog; + + + + &Version; + &Description; + + + + + 5.4.0 + + Iterator support was added, as MySQLi_Result + now implements Traversable. + + + + +
+ @@ -27,6 +53,11 @@ MySQLi_Result + + + Traversable + + diff --git a/reference/mysqli/mysqli_result/fetch-assoc.xml b/reference/mysqli/mysqli_result/fetch-assoc.xml index acc07278cd..e7b7eafdf3 100644 --- a/reference/mysqli/mysqli_result/fetch-assoc.xml +++ b/reference/mysqli/mysqli_result/fetch-assoc.xml @@ -122,6 +122,46 @@ Arvada (USA) Cape Coral (USA) Green Bay (USA) Santa Clara (USA) +]]> + + + + A <classname>MySQLi_Result</classname> example comparing <classname>iterator</classname> usage + +query('SELECT user,host FROM mysql.user') as $row ) { + printf("'%s'@'%s'\n", $row['user'], $row['host']); +} + +echo "\n==================\n"; + +// Not using iterators +$result = $c->query('SELECT user,host FROM mysql.user'); +while ($row = $result->fetch_assoc()) { + printf("'%s'@'%s'\n", $row['user'], $row['host']); +} + +?> +]]> + + &example.outputs.similar; + +