summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/sqlite
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-03-09 13:31:13 +0100
committerAndrey Andreev <narf@bofh.bg>2012-03-09 13:31:13 +0100
commit4b4363871256df9009bb4245def8f89420331cfd (patch)
tree3d611272a20f7fb7d8f936b4e1bd8b0ba98f6715 /system/database/drivers/sqlite
parent342ad538e9b0bb037a4c266fb3a58218f3317e3f (diff)
parentc016a1102e2a77e0c27b9656c19a0460df24dfb6 (diff)
Merge upstream branch
Diffstat (limited to 'system/database/drivers/sqlite')
-rw-r--r--system/database/drivers/sqlite/sqlite_driver.php33
-rw-r--r--system/database/drivers/sqlite/sqlite_forge.php3
2 files changed, 16 insertions, 20 deletions
diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php
index 8116cfb18..568a6b6b3 100644
--- a/system/database/drivers/sqlite/sqlite_driver.php
+++ b/system/database/drivers/sqlite/sqlite_driver.php
@@ -134,13 +134,15 @@ class CI_DB_sqlite_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * Version number query string
+ * Database version number
*
* @return string
*/
- public function _version()
+ public function version()
{
- return sqlite_libversion();
+ return isset($this->data_cache['version'])
+ ? $this->data_cache['version']
+ : $this->data_cache['version'] = sqlite_libversion();
}
// --------------------------------------------------------------------
@@ -312,7 +314,7 @@ class CI_DB_sqlite_driver extends CI_DB {
return 0;
}
- $query = $this->query($this->_count_string.$this->_protect_identifiers('numrows').' FROM '.$this->_protect_identifiers($table, TRUE, NULL, FALSE));
+ $query = $this->query($this->_count_string.$this->protect_identifiers('numrows').' FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE));
if ($query->num_rows() == 0)
{
return 0;
@@ -379,25 +381,18 @@ class CI_DB_sqlite_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * The error message string
+ * Error
*
- * @return string
- */
- protected function _error_message()
- {
- return sqlite_error_string(sqlite_last_error($this->conn_id));
- }
-
- // --------------------------------------------------------------------
-
- /**
- * The error message number
+ * Returns an array containing code and message of the last
+ * database error that has occured.
*
- * @return int
+ * @return array
*/
- protected function _error_number()
+ public function error()
{
- return sqlite_last_error($this->conn_id);
+ $error = array('code' => sqlite_last_error($this->conn_id));
+ $error['message'] = sqlite_error_string($error['code']);
+ return $error;
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php
index 99766878b..7d847e340 100644
--- a/system/database/drivers/sqlite/sqlite_forge.php
+++ b/system/database/drivers/sqlite/sqlite_forge.php
@@ -81,7 +81,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge {
$sql = 'CREATE TABLE ';
// IF NOT EXISTS added to SQLite in 3.3.0
- if ($if_not_exists === TRUE && version_compare($this->db->_version(), '3.3.0', '>=') === TRUE)
+ if ($if_not_exists === TRUE && version_compare($this->db->version(), '3.3.0', '>=') === TRUE)
{
$sql .= 'IF NOT EXISTS ';
}
@@ -206,6 +206,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge {
{
return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name);
}
+
}
/* End of file sqlite_forge.php */