]> git.nbdom.net Git - nb.git/commitdiff
SQL_CALC_FOUND_ROWS only when where
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 6 Jan 2016 02:43:59 +0000 (02:43 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 6 Jan 2016 02:43:59 +0000 (02:43 +0000)
lib/php/db/table.php

index 20bbef3a717a17f6cfca9738221d8f653e220c0c..7f1b8bc38de462274755cfc8f9b1e47cb981f97f 100644 (file)
@@ -582,13 +582,15 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog.
   ******************************************************************/
   function rows($opt=array()) {
     
-    $select_count = ( (false and $this->db->type =='mysql') ? " SQL_CALC_FOUND_ROWS" : "");
     //
     // Select
     //
+    $where = $this->where_criterias($this->p(),$this->p('op'));
+    $select_count = ( (!$where and $this->db->type =='mysql') ? " SQL_CALC_FOUND_ROWS" : "");
+
     $sql = "SELECT$select_count *" . $this->select_extras();
     $sql .= " FROM ".$this->sql_name();
-    $where = $this->where_criterias($this->p(),$this->p('op'));
+
     $this->sql = $sql = $sql . $where;
     $this->debug($sql,1);