cvs: phpdoc /en/reference/pdo/functions PDOStatement-rowCount.xml

From: Date: Sun, 21 Nov 2004 20:01:43 +0000
Subject: cvs: phpdoc /en/reference/pdo/functions PDOStatement-rowCount.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969365158@lists.php.net to get a copy of this message
dbs Sun Nov 21 15:01:43 2004 EDT Modified files: /phpdoc/en/reference/pdo/functions PDOStatement-rowCount.xml Log: Add brief docs and example. http://cvs.php.net/diff.php/phpdoc/en/reference/pdo/functions/PDOStatement-rowCount.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc/en/reference/pdo/functions/PDOStatement-rowCount.xml diff -u phpdoc/en/reference/pdo/functions/PDOStatement-rowCount.xml:1.2 phpdoc/en/reference/pdo/functions/PDOStatement-rowCount.xml:1.3 --- phpdoc/en/reference/pdo/functions/PDOStatement-rowCount.xml:1.2 Thu Nov 11 03:16:32 2004 +++ phpdoc/en/reference/pdo/functions/PDOStatement-rowCount.xml Sun Nov 21 15:01:42 2004 @@ -1,11 +1,11 @@ <?xml version='1.0' encoding='iso-8859-1'?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. --> <refentry id="function.PDOStatement-rowCount"> <refnamediv> <refname>PDOStatement::rowCount</refname> <refpurpose> - Returns the number of rows in a result set, or the number of rows affected by the last PDOStatement::execute() + Returns the number of rows affected by the last SQL statement </refpurpose> </refnamediv> <refsect1> @@ -15,12 +15,33 @@ <void/> </methodsynopsis> - &warn.undocumented.func; - <note> - <para> - Not always meaningful. - </para> - </note> + &warn.experimental.func; + <para> + <function>PDOStatement::rowCount</function> returns the number of + rows affected by the last DELETE, INSERT, or UPDATE statement + executed by the corresponding <literal>PDOStatement</literal> object. + </para> + <para> + If the last SQL statement executed by the associated + <literal>PDOStatement</literal> was a SELECT statement, some databases + may return the number of rows returned by that statement. However, this + behaviour is not guaranteed for all databases and should not be relied + on for portable applications. + </para> + <example><title>Return the number of deleted rows</title> + <programlisting role="php"> +<![CDATA[ +/* Delete all rows from the FRUIT table */ +$del = $dbh->prepare('DELETE FROM fruit'); +$del->execute(); + +/* Return number of rows that were deleted */ +print("Return number of rows that were deleted:\n"); +$count = $del->rowCount(); +print("Deleted $count rows.\n"); +]]> + </programlisting> + </example> </refsect1> </refentry>

« previous php.doc (#969365158) next »