Welcome Guest, Not a member yet? Register   Sign In
active record query caching does not work like in the user guide
#1

Hi
i run with CI-2.2.1 on a 1and1 "unlimited" linux web hosting, everything is fine until now, i'm very happy with CI.
i wanted to try query caching to save some lines in my code but query caching creates a session_id field in my query :

my table is :
Code:
mysql> describe ap_client ;
+----------+--------------+------+-----+---------+----------------+
| Field    | Type         | Null | Key | Default | Extra          |
+----------+--------------+------+-----+---------+----------------+
| id       | int(11)      | NO   | PRI | NULL    | auto_increment |
| email    | varchar(128) | NO   |     | NULL    |                |
| civilite | varchar(5)   | NO   |     |         |                |
| nom      | varchar(128) | NO   |     | NULL    |                |
| prenom   | varchar(128) | NO   |     | NULL    |                |
| tel      | varchar(18)  | NO   |     | NULL    |                |
| rs       | varchar(255) | NO   |     | NULL    |                |
| idtarif  | int(11)      | NO   |     | 0       |                |
| deleted  | tinyint(4)   | NO   |     | 0       |                |
+----------+--------------+------+-----+---------+----------------+
9 rows in set (0.00 sec)

the php is :
PHP Code:
$this->db->start_cache() ;
$this->db->select('*')->from('client')->order_by($this->admintab->order_by()) ; 
$this->db->stop_cache() ;
$count $this->db->count_all_results() ;

$paginConfig = array(
    
'base_url' => base_url('/clients/page/'),
    
'total_rows' => $count,
    
'per_page' => 20,
    
'num_links' => 5
) ;
$this->load->library('pagination') ;
$this->pagination->initialize($paginConfig) ;
        
if(
$this->uri->segment(3)) $this->db->limit($this->uri->segment(3),$paginConfig['per_page']) ;
else 
$this->db->limit($paginConfig['per_page']) ;

$query $this->db->get() ;
$clients $query->result() ;

$this->db->flush_cache() ; 

and this render an error like

Code:
A Database Error Occurred

Error Number: 1054

Unknown column 'session_id' in 'where clause'

SELECT COUNT(*) AS `numrows` FROM (`ap_client`) WHERE `session_id` = 'f78ce30a6bc8447dccb6877b9dead165' AND `session_id` = 'f78ce30a6bc8447dccb6877b9dead165' ORDER BY `nom` desc

Filename: /homepages/39/d561186525/htdocs/app-dev/application-2.2/controllers/clients.php

Line Number: 53

where

Line Number 53>
PHP Code:
$count $this->db->count_all_results() ; 

Did i do something wrong, or i miss some configuration somewhere ?
where does this session_id field come from ?
I'm a lazy boy lol i have a lot more 'wheres' to add in these querys, query caching would be nice if it works.
Reply


Messages In This Thread
active record query caching does not work like in the user guide - by tomasoma - 02-17-2015, 03:32 AM



Theme © iAndrew 2016 - Forum software by © MyBB