cvs: peardoc /en/package/database/db-dataobject/db-dataobject count.xml
| From: | Christian Weiske | Date: | Mon, 03 Mar 2008 21:17:17 +0000 |
| Subject: | cvs: peardoc /en/package/database/db-dataobject/db-dataobject count.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-10547@lists.php.net to get a copy of this message | ||
cweiske Mon Mar 3 21:17:17 2008 UTC
Modified files:
/peardoc/en/package/database/db-dataobject/db-dataobject count.xml
Log:
fix bug #13192: typing error in PEAR manual
http://cvs.php.net/viewvc.cgi/peardoc/en/package/database/db-dataobject/db-dataobject/count.xml?r1=1.9&r2=1.10&diff_format=u
Index: peardoc/en/package/database/db-dataobject/db-dataobject/count.xml
diff -u peardoc/en/package/database/db-dataobject/db-dataobject/count.xml:1.9
peardoc/en/package/database/db-dataobject/db-dataobject/count.xml:1.10
--- peardoc/en/package/database/db-dataobject/db-dataobject/count.xml:1.9 Wed Jan 9 23:05:05 2008
+++ peardoc/en/package/database/db-dataobject/db-dataobject/count.xml Mon Mar 3 21:17:16 2008
@@ -1,4 +1,4 @@
-<!-- $Revision: 1.9 $ -->
+<!-- $Revision: 1.10 $ -->
<refentry id="package.database.db-dataobject.db-dataobject.count">
<refnamediv>
<refname>->count()</refname>
@@ -6,83 +6,83 @@
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
-
+
<funcprototype>
<funcdef>int
<function>$DB_DataObject->count</function></funcdef>
<paramdef>string|boolean
<parameter><optional>$countWhat|$whereAddOnly</optional></parameter></paramdef>
<paramdef>boolean
<parameter><optional>$whereAddOnly</optional></parameter></paramdef>
-
+
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1 id="package.database.db-dataobject.db-dataobject.count.desc">
&title.desc;
<para>
- It performs a select count() request on the tables key
- column and returns the number of resulting rows.
- The default condition applied to the count() is
+ It performs a select count() request on the tables key
+ column and returns the number of resulting rows.
+ The default condition applied to the count() is
a combination of the object variables and whereAdd settings. If
- the constant DB_DATAOBJECT_WHEREADD_ONLY is passed in as the first
+ the constant DB_DATAOBJECT_WHEREADD_ONLY is passed in as the first
parameter then only the whereAdd settings will be used.
-
-
+
+
</para>
- </refsect1>
-
+ </refsect1>
+
<refsect1 id="package.database.db-dataobject.db-dataobject.count.parameter">
&title.param;
<para>
<itemizedlist>
-
+
<listitem>
<para>
<parameter>string $countWhat</parameter> - by default count will count on the
primary key,
- if you need to count something else, if you just say DISTINCT,
+ if you need to count something else, if you just say DISTINCT,
it will count the primiary key prefixed with distinct, or put your own value in
(don't forget to escape it if necessary)
-
+
</para>
- </listitem>
-
+ </listitem>
+
<listitem>
<para>
- <parameter>boolean $useWhereAddOnly</parameter> - use only the
+ <parameter>boolean $useWhereAddOnly</parameter> - use only the
whereAdd conditions (by default, count will only use both the object settings and
- the whereAdd conditions)
+ the whereAdd conditions)
</para>
- </listitem>
-
+ </listitem>
+
</itemizedlist>
</para>
- </refsect1>
-
-
+ </refsect1>
+
+
<refsect1 id="package.database.db-dataobject.db-dataobject.count.return">
&title.returns;
<para>
<parameter>int|false</parameter> - number of results or false on an error
</para>
- </refsect1>
-
-
-
+ </refsect1>
+
+
+
<refsect1 id="package.database.db-dataobject.db-dataobject.count.note">
- &title.note;
-
+ &title.note;
+
¬e.notstatic;
-
-
-
+
+
+
<simpara></simpara>
- </refsect1>
-
+ </refsect1>
+
<refsect1 id="package.database.db-dataobject.db-dataobject.count.example">
&title.example;
<example>
<title>Various examples of using count()</title>
<programlisting role="php">
- <![CDATA[
-<?php
+ <![CDATA[
+<?php
/* using property values */
$person = new DataObjects_Person;
@@ -103,38 +103,38 @@
/* using whereOnly */
$person = new DataObjects_Person;
$person->name = "test";
-$person->whereAdd("name like '%test%");
+$person->whereAdd("name like '%test%'");
$total = $person->count(DB_DATAOBJECT_WHEREADD_ONLY);
echo "There are {$total} names in the database";
?>
-]]>
+]]>
</programlisting>
</example>
<example>
<title>Resulting SQL </title>
<programlisting>
- <![CDATA[
-SELECT count(person.id) AS DATAOBJECT_NUM
- FROM person
+ <![CDATA[
+SELECT count(person.id) AS DATAOBJECT_NUM
+ FROM person
WHERE person.name = 'test';
-SELECT count(DISTINCT name) AS DATAOBJECT_NUM
+SELECT count(DISTINCT name) AS DATAOBJECT_NUM
FROM person;
-SELECT count(DISTINCT person.id) AS DATAOBJECT_NUM
+SELECT count(DISTINCT person.id) AS DATAOBJECT_NUM
FROM person;
-SELECT count(person.id) AS DATAOBJECT_NUM
- FROM person
+SELECT count(person.id) AS DATAOBJECT_NUM
+ FROM person
WHERE name like '%test%';
-]]>
+]]>
</programlisting>
- </example>
- </refsect1>
+ </example>
+ </refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables: