summaryrefslogtreecommitdiff
path: root/kohana/libraries/drivers/Database/Mysqli.php
diff options
context:
space:
mode:
Diffstat (limited to 'kohana/libraries/drivers/Database/Mysqli.php')
-rw-r--r--kohana/libraries/drivers/Database/Mysqli.php39
1 files changed, 13 insertions, 26 deletions
diff --git a/kohana/libraries/drivers/Database/Mysqli.php b/kohana/libraries/drivers/Database/Mysqli.php
index 13a81281..f15e4283 100644
--- a/kohana/libraries/drivers/Database/Mysqli.php
+++ b/kohana/libraries/drivers/Database/Mysqli.php
@@ -68,23 +68,23 @@ class Database_Mysqli_Driver extends Database_Mysql_Driver {
public function query($sql)
{
// Only cache if it's turned on, and only cache if it's not a write statement
- if ($this->db_config['cache'] AND ! preg_match('#\b(?:INSERT|UPDATE|REPLACE|SET)\b#i', $sql))
+ if ($this->db_config['cache'] AND ! preg_match('#\b(?:INSERT|UPDATE|REPLACE|SET|DELETE|TRUNCATE)\b#i', $sql))
{
$hash = $this->query_hash($sql);
- if ( ! isset(self::$query_cache[$hash]))
+ if ( ! isset($this->query_cache[$hash]))
{
// Set the cached object
- self::$query_cache[$hash] = new Kohana_Mysqli_Result($this->link, $this->db_config['object'], $sql);
+ $this->query_cache[$hash] = new Kohana_Mysqli_Result($this->link, $this->db_config['object'], $sql);
}
else
{
// Rewind cached result
- self::$query_cache[$hash]->rewind();
+ $this->query_cache[$hash]->rewind();
}
// Return the cached query
- return self::$query_cache[$hash];
+ return $this->query_cache[$hash];
}
return new Kohana_Mysqli_Result($this->link, $this->db_config['object'], $sql);
@@ -111,22 +111,6 @@ class Database_Mysqli_Driver extends Database_Mysql_Driver {
return $this->link->error;
}
- public function field_data($table)
- {
- $columns = array();
- $query = $this->link->query('SHOW COLUMNS FROM '.$this->escape_table($table));
-
- if (is_object($query))
- {
- while ($row = $query->fetch_object())
- {
- $columns[] = $row;
- }
- }
-
- return $columns;
- }
-
} // End Database_Mysqli_Driver Class
/**
@@ -299,12 +283,15 @@ class Kohana_Mysqli_Result extends Database_Result {
public function seek($offset)
{
- if ( ! $this->offsetExists($offset))
- return FALSE;
+ if ($this->offsetExists($offset) AND $this->result->data_seek($offset))
+ {
+ // Set the current row to the offset
+ $this->current_row = $offset;
- $this->result->data_seek($offset);
+ return TRUE;
+ }
- return TRUE;
+ return FALSE;
}
public function offsetGet($offset)
@@ -368,4 +355,4 @@ class Kohana_Mysqli_Statement {
$this->stmt->execute();
return $this->stmt;
}
-} \ No newline at end of file
+}