Author: danydb
Date: 2013-09-19 16:22:22 +0200 (Thu, 19 Sep 2013)
New Revision: 5403

Modified:
   phpcompta/trunk/include/class_database.php
Log:
count accept a parameter, by default returns the number of rows of the last 
query

Modified: phpcompta/trunk/include/class_database.php
===================================================================
--- phpcompta/trunk/include/class_database.php  2013-09-19 12:08:00 UTC (rev 
5402)
+++ phpcompta/trunk/include/class_database.php  2013-09-19 14:22:22 UTC (rev 
5403)
@@ -347,17 +347,24 @@
         if ( $this->ret == false ) throw new Exception ('this->ret is empty');
         return pg_fetch_array($this->ret,$p_indice ) ;
     }
-    /*!@brief return the number of rows found by the last query,
-      synomym for count()*/
-    function size()
+    /*!@brief return the number of rows found by the last query, or the number
+     * of rows from $p_ret
+     * @param $p_ret is the result of a query, the default value is null, in 
that case
+     * it is related to the last query
+     * @note synomym for count()
+     */
+    function size($p_ret = null)
     {
-        return pg_NumRows($this->ret);
+        if ($p_ret == null )
+            return pg_NumRows($this->ret);
+        else
+            return pg_NumRows($p_ret);
     }
     /*!@brief return the number of rows found by the last query,
       synomym for size()*/
-    function count()
+    function count($p_ret=null)
     {
-        return pg_NumRows($this->ret);
+        return $this->size($p_ret);
     }
 
     /*!\brief loop to apply all the path to a folder or



---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu

_______________________________________________
Phpcompta  est un logiciel libre de comptabilité en ligne 
(http://www.phpcompta.eu)
Phpcompta-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/phpcompta-dev

Reply via email to