summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/pdo/pdo_driver.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-06-24 21:44:00 +0200
committerAndrey Andreev <narf@bofh.bg>2012-06-24 21:44:00 +0200
commit271056648bf8cc5da575c6c507f743b24c47ceca (patch)
treefa16aa487530c47c57abab03ba14fb8879108aad /system/database/drivers/pdo/pdo_driver.php
parent3b0130d97409bc0d983aa812b50e579cc53b8e48 (diff)
Add pdo_sqlite subdriver
Diffstat (limited to 'system/database/drivers/pdo/pdo_driver.php')
-rw-r--r--system/database/drivers/pdo/pdo_driver.php45
1 files changed, 3 insertions, 42 deletions
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index 9fbdfdd55..b16ca8219 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -151,20 +151,6 @@ class CI_DB_pdo_driver extends CI_DB {
$this->dsn .= 'database='.$this->database.';';
}
}
- elseif ($this->subdriver === 'sqlite' && $this->dsn === 'sqlite:')
- {
- if ($this->database !== ':memory')
- {
- if ( ! file_exists($this->database))
- {
- show_error('Invalid DB Connection string for PDO SQLite');
- }
-
- $this->dsn .= (strpos($this->database, DIRECTORY_SEPARATOR) !== 0) ? DIRECTORY_SEPARATOR : '';
- }
-
- $this->dsn .= $this->database;
- }
// Add charset to the DSN, if needed
if ( ! empty($this->char_set) && in_array($this->subdriver, array('4D', 'sybase', 'mssql', 'dblib')))
@@ -378,15 +364,7 @@ class CI_DB_pdo_driver extends CI_DB {
*/
protected function _list_tables($prefix_limit = FALSE)
{
- if ($this->subdriver === 'sqlite')
- {
- // Analog function to show all tables in sqlite
- $sql = "SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%'";
- }
- else
- {
- $sql = 'SHOW TABLES FROM '.$this->escape_identifiers($this->database);
- }
+ $sql = 'SHOW TABLES FROM '.$this->escape_identifiers($this->database);
if ($prefix_limit !== FALSE AND $this->dbprefix !== '')
{
@@ -423,12 +401,6 @@ class CI_DB_pdo_driver extends CI_DB {
*/
protected function _field_data($table)
{
- if ($this->subdriver === 'sqlite')
- {
- // Analog function for sqlite
- return 'PRAGMA table_info('.$this->escape_identifiers($table).')';
- }
-
return 'SELECT TOP 1 FROM '.$this->escape_identifiers($table);
}
@@ -544,19 +516,8 @@ class CI_DB_pdo_driver extends CI_DB {
*/
protected function _limit($sql, $limit, $offset)
{
- if ($this->subdriver === 'cubrid' OR $this->subdriver === 'sqlite')
- {
- $offset = ($offset == 0) ? '' : $offset.', ';
-
- return $sql.'LIMIT '.$offset.$limit;
- }
- else
- {
- $sql .= 'LIMIT '.$limit;
- $sql .= ($offset > 0) ? ' OFFSET '.$offset : '';
-
- return $sql;
- }
+ $offset = ($offset == 0) ? '' : $offset.', ';
+ return $sql.'LIMIT '.$offset.$limit;
}
}