diff options
Diffstat (limited to 'system/libraries/Database.php')
-rw-r--r-- | system/libraries/Database.php | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/system/libraries/Database.php b/system/libraries/Database.php index d3716c59..38a38fbf 100644 --- a/system/libraries/Database.php +++ b/system/libraries/Database.php @@ -1,9 +1,9 @@ <?php defined('SYSPATH') or die('No direct script access.'); /** * Database wrapper. - * - * $Id: Database.php 4679 2009-11-10 01:45:52Z isaiah $ - * + * + * $Id: Database.php 4709 2009-12-10 05:09:35Z isaiah $ + * * @package Kohana * @author Kohana Team * @copyright (c) 2008-2009 Kohana Team @@ -11,10 +11,12 @@ */ abstract class Database_Core { - const SELECT = 1; - const INSERT = 2; - const UPDATE = 3; - const DELETE = 4; + const SELECT = 1; + const INSERT = 2; + const UPDATE = 3; + const DELETE = 4; + const CROSS_REQUEST = 5; + const PER_REQUEST = 6; protected static $instances = array(); @@ -350,11 +352,12 @@ abstract class Database_Core { * Clears the internal query cache. * * @param mixed clear cache by SQL statement, NULL for all, or TRUE for last query + * @param integer Type of cache to clear, Database::CROSS_REQUEST or Database::PER_REQUEST * @return Database */ - public function clear_cache($sql = NULL) + public function clear_cache($sql = NULL, $type = NULL) { - if ($this->cache instanceof Cache) + if ($this->cache instanceof Cache AND ($type == NULL OR $type == Database::CROSS_REQUEST)) { // Using cross-request Cache library if ($sql === TRUE) @@ -370,7 +373,7 @@ abstract class Database_Core { $this->cache->delete_all(); } } - elseif (is_array($this->cache)) + elseif (is_array($this->cache) AND ($type == NULL OR $type == Database::PER_REQUEST)) { // Using per-request memory cache if ($sql === TRUE) |