]> git.mxchange.org Git - friendica.git/blobdiff - include/dba.php
Merge remote-tracking branch 'upstream/develop' into 1610-performance
[friendica.git] / include / dba.php
index a9ed9e5a051bcd2e554828d5c5cca4e38f490b03..c7b598f2d68e09ed2f3a9ead81d25d23f00d7265 100644 (file)
@@ -108,6 +108,23 @@ class dba {
                return $return;
        }
 
+       /**
+        * @brief Returns the number of rows
+        *
+        * @return string
+        */
+       public function num_rows() {
+               if (!$this->result)
+                       return 0;
+
+               if ($this->mysqli) {
+                       $return = $this->result->num_rows;
+               } else {
+                       $return = mysql_num_rows($this->result);
+               }
+               return $return;
+       }
+
        public function q($sql, $onlyquery = false) {
                global $a;
 
@@ -126,6 +143,8 @@ class dba {
 
                $stamp1 = microtime(true);
 
+               $sql = "/*".$a->callstack()." */ ".$sql;
+
                if($this->mysqli)
                        $result = @$this->db->query($sql);
                else