cvs: peardoc /en/package/database/mdb2 intro-fetch.xml
| From: | Lukas Smith | Date: | Sat, 19 Aug 2006 20:36:58 +0000 |
| Subject: | cvs: peardoc /en/package/database/mdb2 intro-fetch.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-8313@lists.php.net to get a copy of this message | ||
lsmith Sat Aug 19 20:36:58 2006 UTC
Modified files:
/peardoc/en/package/database/mdb2 intro-fetch.xml
Log:
- added documentation for bindColumn()
http://cvs.php.net/viewvc.cgi/peardoc/en/package/database/mdb2/intro-fetch.xml?r1=1.18&r2=1.19&diff_format=u
Index: peardoc/en/package/database/mdb2/intro-fetch.xml
diff -u peardoc/en/package/database/mdb2/intro-fetch.xml:1.18
peardoc/en/package/database/mdb2/intro-fetch.xml:1.19
--- peardoc/en/package/database/mdb2/intro-fetch.xml:1.18 Thu Aug 17 19:05:20 2006
+++ peardoc/en/package/database/mdb2/intro-fetch.xml Sat Aug 19 20:36:58 2006
@@ -1,14 +1,10 @@
<?xml version="1.0" encoding="iso-8859-1" ?>
-<!-- $Revision: 1.18 $ -->
+<!-- $Revision: 1.19 $ -->
<!--
todos:
-
-add information on the following methods:
-bindColumn()
-
-add information about custom result classes and wrappers
+- add information about custom result classes and wrappers
-->
@@ -434,6 +430,32 @@
]]>
</programlisting>
</example>
+
+ <example>
+ <title>
+ <ulink url="http://pear.php.net/package/MDB2/docs/latest/MDB2/MDB2_Result_Common.html#methodbindColumn">
+ <function>bindColumn</function></ulink> allows to bind a reference to
+ a user variable to a specific field inside the result set. This means that
+ when fetching the next row, this variable is automatically updated.
+ </title>
+ <programlisting role="php">
+ <![CDATA[
+<?php
+// Once you have a valid MDB2 object named $mdb2...
+$name = $address = null;
+$res =& $mdb2->query('SELECT id, name, address FROM clients', array('id'
=> 'integer'));
+$res->bindColumn('id', $name);
+// provide a type for the column not included in the query() call
+$res->bindColumn('id', $name, 'text');
+// but specifying a type is as always optional in MDB2
+$res->bindColumn('address', $address);
+while ($res->fetchRow()) {
+ echo "The address of '$name' (user id '$id') is
'$address'\n";
+}
+?>
+ ]]>
+ </programlisting>
+ </example>
</refsect2>
<refsect2 id="package.database.mdb2.intro-fetch.desc.convinience">