Welcome Guest, Not a member yet? Register   Sign In
DB_Cache ignores queryvars [PATCH]
#2

[eluser]mark17[/eluser]
A quick patch for this problem is switching two sequentiel codeblocks in DB_Driver.php starting at line #270;

OLD CODE:
Code:
// Is query caching enabled?  If the query is a "read type"

        // we will load the caching class and return the previously

        // cached query if it exists

        if ($this->cache_on == TRUE AND stristr($sql, 'SELECT'))

        {

            if ($this->_cache_init())

            {

                $this->load_rdriver();

                if (FALSE !== ($cache = $this->CACHE->read($sql)))

                {

                    return $cache;

                }

            }

        }

        

        // Compile binds if needed

        if ($binds !== FALSE)

        {

            $sql = $this->compile_binds($sql, $binds);

        }


PATCH CODE:
Code:
// Compile binds if needed

        if ($binds !== FALSE)

        {

            $sql = $this->compile_binds($sql, $binds);

        }


        // Is query caching enabled?  If the query is a "read type"

        // we will load the caching class and return the previously

        // cached query if it exists

        if ($this->cache_on == TRUE AND stristr($sql, 'SELECT'))

        {

            if ($this->_cache_init())

            {

                $this->load_rdriver();

                if (FALSE !== ($cache = $this->CACHE->read($sql)))

                {

                    return $cache;

                }

            }

        }

This will parse the prepared statement _before_ attempting to compile a filename in DB_Cache itself. I cannot understand that this has been around for quite some time without anyone noticing. Of course, this old behaviour will never surface in altering the state of the data but will result in loss in performance when relying on it.

Please submit this patch in future versions.


Messages In This Thread
DB_Cache ignores queryvars [PATCH] - by El Forum - 09-03-2008, 02:14 AM
DB_Cache ignores queryvars [PATCH] - by El Forum - 09-03-2008, 02:40 AM
DB_Cache ignores queryvars [PATCH] - by El Forum - 10-08-2008, 06:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB