cvs: peardoc /en/package/database/db intro-fetch.xml
| From: | Daniel Convissor | Date: | Thu, 15 Apr 2004 07:19:49 +0000 |
| Subject: | cvs: peardoc /en/package/database/db intro-fetch.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-3481@lists.php.net to get a copy of this message | ||
danielc Thu Apr 15 03:19:49 2004 EDT
Modified files:
/peardoc/en/package/database/db intro-fetch.xml
Log:
Yank get*() comverage since now covered better in individual method docs.
http://cvs.php.net/diff.php/peardoc/en/package/database/db/intro-fetch.xml?r1=1.24&r2=1.25&ty=u
Index: peardoc/en/package/database/db/intro-fetch.xml
diff -u peardoc/en/package/database/db/intro-fetch.xml:1.24
peardoc/en/package/database/db/intro-fetch.xml:1.25
--- peardoc/en/package/database/db/intro-fetch.xml:1.24 Tue Apr 13 17:33:41 2004
+++ peardoc/en/package/database/db/intro-fetch.xml Thu Apr 15 03:19:48 2004
@@ -1,8 +1,8 @@
-<!-- $Revision: 1.24 $ -->
+<!-- $Revision: 1.25 $ -->
<refentry id="package.database.db.intro-fetch">
<refnamediv>
- <refname>Introduction - Fetch & Get</refname>
+ <refname>Introduction - Fetch</refname>
<refpurpose>Fetching rows from queries</refpurpose>
</refnamediv>
@@ -322,121 +322,6 @@
</para>
</refsect2>
- <refsect2 id="package.database.db.intro-fetch.desc.quick">
- <title>Quick Data Retrieving</title>
- <para>
- &class.db; provides some special ways to retrieve information
- from a query without the need of using
- <function>fetch*</function> and looping through results.
- </para>
- <para>
- <link linkend="package.database.db.db-common.getone">
- <function>getOne</function></link> retrieves the first result of the
- first column from a query
- <programlisting role="php">
- <![CDATA[
-<?php
-// Once you have a valid DB object named $db...
-$numrows = $db->getOne('select count(id) from clients');
-
-// Returns: 3
-?>
- ]]>
- </programlisting>
- </para>
- <para>
- <link
linkend="package.database.db.db-common.getrow"><function>getRow</function>
- </link> returns the first row as an array.
- <programlisting role="php">
- <![CDATA[
-<?php
-// Once you have a valid DB object named $db...
-$row =& $db->getRow('select name, address from clients');
-
-if (DB::isError($row)) {
- die($row->getMessage());
-}
-
-echo $row['name'] . ', ' . $row['address'] . "\n";
-}
-?>
- ]]>
- </programlisting>
- </para>
- <para>
- <link linkend="package.database.db.db-common.getcol">
- <function>getCol</function></link> returns an array with the data
- of the selected column. It accepts the column number to retrieve
- as the second parameter.
- <programlisting role="php">
- <![CDATA[
-<?php
-// Once you have a valid DB object named $db...
-$data =& $db->getCol('SELECT name FROM clients');
-/*
- * Returns:
- * array(
- * 0 => 'Stig',
- * 1 => 'Jon',
- * 2 => 'Colin'
- * )
- */
-?>
- ]]>
- </programlisting>
- </para>
- <para>
- <link linkend="package.database.db.db-common.getassoc">
- <function>getAssoc</function></link> fetches the entire result set
- of a query and return it as an associative array using the
- first column as the key.
- <programlisting role="php">
- <![CDATA[
-<?php
-// Once you have a valid DB object named $db...
-$data =& $db->getAssoc('SELECT name, surname, phone FROM mytable');
-/*
- * Returns:
- * array(
- * 'Peter' => array('Smith', '944679408'),
- * 'Tomas' => array('Cox', '944679408'),
- * 'Richard' => array('Merz', '944679408')
- * )
- */
-?>
- ]]>
- </programlisting>
- </para>
- <para>
- <link linkend="package.database.db.db-common.getall">
- <function>getAll</function></link>
- fetches all the rows returned from a query-
- <programlisting role="php">
- <![CDATA[
-<?php
-// Once you have a valid DB object named $db...
-$data =& $db->getAll('SELECT id, text, date FROM mytable');
-/*
- * Returns:
- * array(
- * 0 => array('4', 'four', '2004'),
- * 1 => array('5', 'five', '2005'),
- * 2 => array('6', 'six', '2006')
- * )
- */
-?>
- ]]>
- </programlisting>
- </para>
- <para>
- The <function>get*</function> family methods will do all the
- dirty job for you, this is: launch the query, fetch the data
- and free the result. Please note that as all PEAR DB functions
- they will return a &class.db-error; object
- on errors.
- </para>
- </refsect2>
-
<refsect2 id="package.database.db.intro-fetch.desc.more">
<title>Getting More Information From Query Results</title>
<para>