№ 1754 В разделе "Программирование" от November 24th, 2009,
CodeIgniter and SQL_CALC_FOUND_ROWS problem solved! I patched
DB_active_rec.php today. Now I have ability to use
SQL_CALC_FOUND_ROWS in my programs. If you use pages on your site, this function realy speed up it. With
db->count_all* you send two big queries to DB, but with SQL_CALC_FOUND_ROWS solution you send only one big and one tiny.
$CI =& get_instance(); $CI->db->select('title, body'); $CI->db->SQL_CALC_FOUND_ROWS(); $CI->db->from('posts'); $query = $CI->db->get(); //All done, we got result. Now getting rows count $count = $CI->db->query('SELECT FOUND_ROWS() as rowcount'); $count = $count->result();