From: Nicolas Boisselier Date: Wed, 6 Jan 2016 02:43:59 +0000 (+0000) Subject: SQL_CALC_FOUND_ROWS only when where X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=1b008b7370340bcee3e8c4fd2ab37423691c6c87;p=nb.git SQL_CALC_FOUND_ROWS only when where --- diff --git a/lib/php/db/table.php b/lib/php/db/table.php index 20bbef3a..7f1b8bc3 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -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);