summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/sqlite
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-06-06 13:12:15 +0200
committerAndrey Andreev <narf@bofh.bg>2012-06-06 13:12:15 +0200
commit968690491f625ddf59a5136b55ae1b9a2cf98a9a (patch)
tree6bc3eff6e8ec3ecae925ac3ff5c9542888f160f4 /system/database/drivers/sqlite
parent58dc75471c25f33b059967ffb515eedc08e86a0b (diff)
parent6683c3c872952ae16d98c89ef474e5522897592a (diff)
Merge upstream branch and some changes for better readability
Diffstat (limited to 'system/database/drivers/sqlite')
-rw-r--r--system/database/drivers/sqlite/sqlite_driver.php34
-rw-r--r--system/database/drivers/sqlite/sqlite_forge.php24
2 files changed, 19 insertions, 39 deletions
diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php
index 983b5fa58..cb8c0dd8b 100644
--- a/system/database/drivers/sqlite/sqlite_driver.php
+++ b/system/database/drivers/sqlite/sqlite_driver.php
@@ -255,35 +255,6 @@ class CI_DB_sqlite_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * "Count All" query
- *
- * Generates a platform-specific query string that counts all records in
- * the specified database
- *
- * @param string
- * @return int
- */
- public function count_all($table = '')
- {
- if ($table == '')
- {
- return 0;
- }
-
- $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;
- }
-
- $query = $query->row();
- $this->_data_seek(0);
- return (int) $query->numrows;
- }
-
- // --------------------------------------------------------------------
-
- /**
* List table query
*
* Generates a platform-specific query string so that the table names can be fetched
@@ -429,12 +400,11 @@ class CI_DB_sqlite_driver extends CI_DB {
/**
* Close DB Connection
*
- * @param resource
* @return void
*/
- protected function _close($conn_id)
+ protected function _close()
{
- @sqlite_close($conn_id);
+ @sqlite_close($this->conn_id);
}
}
diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php
index 0a1c156be..f6dd49043 100644
--- a/system/database/drivers/sqlite/sqlite_forge.php
+++ b/system/database/drivers/sqlite/sqlite_forge.php
@@ -103,18 +103,28 @@ class CI_DB_sqlite_forge extends CI_DB_forge {
{
$attributes = array_change_key_case($attributes, CASE_UPPER);
- $sql .= "\n\t".$this->db->protect_identifiers($field)
- .' '.$attributes['TYPE']
+ $sql .= "\n\t".$this->db->protect_identifiers($field).' '.$attributes['TYPE'];
- .( ! empty($attributes['CONSTRAINT']) ? '('.$attributes['CONSTRAINT'].')' : '')
+ empty($attributes['CONSTRAINT']) OR $sql .= '('.$attributes['CONSTRAINT'].')';
- .(( ! empty($attributes['UNSIGNED']) && $attributes['UNSIGNED'] === TRUE) ? ' UNSIGNED' : '')
+ if ( ! empty($attributes['UNSIGNED']) && $attributes['UNSIGNED'] === TRUE)
+ {
+ $sql .= ' UNSIGNED';
+ }
- .(isset($attributes['DEFAULT']) ? ' DEFAULT \''.$attributes['DEFAULT'].'\'' : '')
+ if (isset($attributes['DEFAULT']))
+ {
+ $sql .= " DEFAULT'".$attributes['DEFAULT']."'";
+ }
- .(( ! empty($attributes['NULL']) && $attributes['NULL'] === TRUE) ? ' NULL' : ' NOT NULL')
- .(( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE) ? ' AUTO_INCREMENT' : '');
+ $sql .= ( ! empty($attributes['NULL']) && $attributes['NULL'] === TRUE)
+ ? ' NULL' : ' NOT NULL';
+
+ if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE)
+ {
+ $sql .= ' AUTO_INCREMENT';
+ }
}
// don't add a comma on the end of the last field