[eluser]mark17[/eluser]
L.S.
Using DB_Cache at least in CI 1.6.2 will never work properly when using prepared statements including variables.
Code:
/**
* Retrieve a cached query
*
* The URI being requested will become the name of the cache sub-folder.
* An MD5 hash of the SQL statement will become the cache file name
*
* @access public
* @return string
*/
function read($sql)
{
print "$sql\n";
if ( ! $this->check_path())
{
return $this->db->cache_off();
}
At any time it will result in creating identical cachefilenames for e.g.
SELECT * FROM table WHERE field = ?; (? = 1)
SELECT * FROM table WHERE field = ?; (? = 2)
The system does _not_ pass parsed SQL statements to the cachesystem, therefore reading previously written cachefiles for the same query will result in yet another write since it cannot be read.
Writing cachefiles, however, does not suffer from this problem.
The calling code:
Code:
if (FALSE !== ($cache = $this->CACHE->read($sql)))
in DB_Driver clearly passes an unparsed query.
Regards,