EllisLab/CodeIgniter — Issue #751: no escape with ar cacheing
Author: dominik1337
Created: 2011-12-08 12:13:32+00:00
State: open

example:
$this->db->select('DATEDIFF(NOW(),date) AS days', FALSE);

...

$this->db->start_cache();
$this->db->where('category_id', $category);
$this->db->stop_cache();

...

result:
A Database Error Occurred

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM (`dmz_films`) WHERE `category_id` = '1' ORDER BY `id` desc LIMIT 2' at line 2

SELECT `id`, `name`, `url`, `thumb_cnt`, `category_id`, `views`, DATEDIFF(NOW(), `date)` AS days, TIME(date) AS time FROM (`dmz_films`) WHERE `category_id` = '1' ORDER BY `id` desc LIMIT 2

Filename: /home/tube/domains/porno3d.eu/public_html/models/m_movie.php

Line Number: 46

my quickfix:
DB_active_rec.php line 1962:
-$this->ar_no_escape = $this->ar_cache_no_escape;
+$this->ar_no_escape = array_merge($this->ar_no_escape, $this->ar_cache_no_escape);