0001-Instance-member-rather-than-class-attribute.patch
| system/libraries/drivers/Database.php | ||
|---|---|---|
| 11 | 11 |
*/ |
| 12 | 12 |
abstract class Database_Driver {
|
| 13 | 13 | |
| 14 |
static $query_cache;
|
|
| 14 |
protected $query_cache;
|
|
| 15 | 15 | |
| 16 | 16 |
/** |
| 17 | 17 |
* Connect to our database. |
| ... | ... | |
| 431 | 431 |
{
|
| 432 | 432 |
if (empty($sql)) |
| 433 | 433 |
{
|
| 434 |
self::$query_cache = array();
|
|
| 434 |
$this->query_cache = array();
|
|
| 435 | 435 |
} |
| 436 | 436 |
else |
| 437 | 437 |
{
|
| 438 |
unset(self::$query_cache[$this->query_hash($sql)]);
|
|
| 438 |
unset($this->query_cache[$this->query_hash($sql)]);
|
|
| 439 | 439 |
} |
| 440 | 440 | |
| 441 | 441 |
Kohana::log('debug', 'Database cache cleared: '.get_class($this));
|
| system/libraries/drivers/Database/Mssql.php | ||
|---|---|---|
| 89 | 89 |
{
|
| 90 | 90 |
$hash = $this->query_hash($sql); |
| 91 | 91 | |
| 92 |
if ( ! isset(self::$query_cache[$hash]))
|
|
| 92 |
if ( ! isset($this->query_cache[$hash]))
|
|
| 93 | 93 |
{
|
| 94 | 94 |
// Set the cached object |
| 95 |
self::$query_cache[$hash] = new Mssql_Result(mssql_query($sql, $this->link), $this->link, $this->db_config['object'], $sql);
|
|
| 95 |
$this->query_cache[$hash] = new Mssql_Result(mssql_query($sql, $this->link), $this->link, $this->db_config['object'], $sql);
|
|
| 96 | 96 |
} |
| 97 | 97 |
else |
| 98 | 98 |
{
|
| 99 | 99 |
// Rewind cached result |
| 100 |
self::$query_cache[$hash]->rewind();
|
|
| 100 |
$this->query_cache[$hash]->rewind();
|
|
| 101 | 101 |
} |
| 102 | 102 | |
| 103 | 103 |
// Return the cached query |
| 104 |
return self::$query_cache[$hash];
|
|
| 104 |
return $this->query_cache[$hash];
|
|
| 105 | 105 |
} |
| 106 | 106 | |
| 107 | 107 |
return new Mssql_Result(mssql_query($sql, $this->link), $this->link, $this->db_config['object'], $sql); |
| system/libraries/drivers/Database/Mysql.php | ||
|---|---|---|
| 89 | 89 |
{
|
| 90 | 90 |
$hash = $this->query_hash($sql); |
| 91 | 91 | |
| 92 |
if ( ! isset(self::$query_cache[$hash]))
|
|
| 92 |
if ( ! isset($this->query_cache[$hash]))
|
|
| 93 | 93 |
{
|
| 94 | 94 |
// Set the cached object |
| 95 |
self::$query_cache[$hash] = new Mysql_Result(mysql_query($sql, $this->link), $this->link, $this->db_config['object'], $sql);
|
|
| 95 |
$this->query_cache[$hash] = new Mysql_Result(mysql_query($sql, $this->link), $this->link, $this->db_config['object'], $sql);
|
|
| 96 | 96 |
} |
| 97 | 97 |
else |
| 98 | 98 |
{
|
| 99 | 99 |
// Rewind cached result |
| 100 |
self::$query_cache[$hash]->rewind();
|
|
| 100 |
$this->query_cache[$hash]->rewind();
|
|
| 101 | 101 |
} |
| 102 | 102 | |
| 103 | 103 |
// Return the cached query |
| 104 |
return self::$query_cache[$hash];
|
|
| 104 |
return $this->query_cache[$hash];
|
|
| 105 | 105 |
} |
| 106 | 106 | |
| 107 | 107 |
return new Mysql_Result(mysql_query($sql, $this->link), $this->link, $this->db_config['object'], $sql); |
| system/libraries/drivers/Database/Mysqli.php | ||
|---|---|---|
| 72 | 72 |
{
|
| 73 | 73 |
$hash = $this->query_hash($sql); |
| 74 | 74 | |
| 75 |
if ( ! isset(self::$query_cache[$hash]))
|
|
| 75 |
if ( ! isset($this->query_cache[$hash]))
|
|
| 76 | 76 |
{
|
| 77 | 77 |
// Set the cached object |
| 78 |
self::$query_cache[$hash] = new Kohana_Mysqli_Result($this->link, $this->db_config['object'], $sql);
|
|
| 78 |
$this->query_cache[$hash] = new Kohana_Mysqli_Result($this->link, $this->db_config['object'], $sql);
|
|
| 79 | 79 |
} |
| 80 | 80 |
else |
| 81 | 81 |
{
|
| 82 | 82 |
// Rewind cached result |
| 83 |
self::$query_cache[$hash]->rewind();
|
|
| 83 |
$this->query_cache[$hash]->rewind();
|
|
| 84 | 84 |
} |
| 85 | 85 | |
| 86 | 86 |
// Return the cached query |
| 87 |
return self::$query_cache[$hash];
|
|
| 87 |
return $this->query_cache[$hash];
|
|
| 88 | 88 |
} |
| 89 | 89 | |
| 90 | 90 |
return new Kohana_Mysqli_Result($this->link, $this->db_config['object'], $sql); |
| system/libraries/drivers/Database/Pgsql.php | ||
|---|---|---|
| 68 | 68 |
{
|
| 69 | 69 |
$hash = $this->query_hash($sql); |
| 70 | 70 | |
| 71 |
if ( ! isset(self::$query_cache[$hash]))
|
|
| 71 |
if ( ! isset($this->query_cache[$hash]))
|
|
| 72 | 72 |
{
|
| 73 | 73 |
// Set the cached object |
| 74 |
self::$query_cache[$hash] = new Pgsql_Result(pg_query($this->link, $sql), $this->link, $this->db_config['object'], $sql);
|
|
| 74 |
$this->query_cache[$hash] = new Pgsql_Result(pg_query($this->link, $sql), $this->link, $this->db_config['object'], $sql);
|
|
| 75 | 75 |
} |
| 76 | 76 |
else |
| 77 | 77 |
{
|
| 78 | 78 |
// Rewind cached result |
| 79 |
self::$query_cache[$hash]->rewind();
|
|
| 79 |
$this->query_cache[$hash]->rewind();
|
|
| 80 | 80 |
} |
| 81 | 81 | |
| 82 |
return self::$query_cache[$hash];
|
|
| 82 |
return $this->query_cache[$hash];
|
|
| 83 | 83 |
} |
| 84 | 84 | |
| 85 | 85 |
// Suppress warning triggered when a database error occurs (e.g., a constraint violation) |