summaryrefslogtreecommitdiffstats
path: root/system/database/drivers
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-03-20 13:23:10 +0100
committerAndrey Andreev <narf@bofh.bg>2012-03-20 13:23:10 +0100
commitfd70ceb017b13db3faf54fa43df850c1b82abedb (patch)
tree55c547a55b349e83db32a357a48040769027fd32 /system/database/drivers
parent5f2214f0526b823c92f308312d883147a4c9faed (diff)
parent55201acd0692f02eb5927f412db73b925b6ba738 (diff)
Merge upstream branch
Diffstat (limited to 'system/database/drivers')
-rw-r--r--system/database/drivers/cubrid/cubrid_driver.php2
-rw-r--r--system/database/drivers/cubrid/cubrid_forge.php2
-rw-r--r--system/database/drivers/cubrid/cubrid_result.php2
-rw-r--r--system/database/drivers/cubrid/cubrid_utility.php2
-rw-r--r--system/database/drivers/interbase/interbase_driver.php2
-rw-r--r--system/database/drivers/interbase/interbase_forge.php2
-rw-r--r--system/database/drivers/interbase/interbase_result.php2
-rw-r--r--system/database/drivers/interbase/interbase_utility.php2
-rw-r--r--system/database/drivers/mssql/mssql_driver.php2
-rw-r--r--system/database/drivers/mssql/mssql_forge.php2
-rw-r--r--system/database/drivers/mssql/mssql_result.php2
-rw-r--r--system/database/drivers/mssql/mssql_utility.php2
-rw-r--r--system/database/drivers/mysql/mysql_driver.php22
-rw-r--r--system/database/drivers/mysql/mysql_forge.php2
-rw-r--r--system/database/drivers/mysql/mysql_result.php2
-rw-r--r--system/database/drivers/mysql/mysql_utility.php2
-rw-r--r--system/database/drivers/mysqli/mysqli_driver.php22
-rw-r--r--system/database/drivers/mysqli/mysqli_forge.php31
-rw-r--r--system/database/drivers/mysqli/mysqli_result.php2
-rw-r--r--system/database/drivers/mysqli/mysqli_utility.php2
-rw-r--r--system/database/drivers/oci8/oci8_driver.php2
-rw-r--r--system/database/drivers/oci8/oci8_forge.php2
-rw-r--r--system/database/drivers/oci8/oci8_result.php2
-rw-r--r--system/database/drivers/oci8/oci8_utility.php2
-rw-r--r--system/database/drivers/odbc/odbc_driver.php2
-rw-r--r--system/database/drivers/odbc/odbc_forge.php2
-rw-r--r--system/database/drivers/odbc/odbc_result.php2
-rw-r--r--system/database/drivers/odbc/odbc_utility.php2
-rw-r--r--system/database/drivers/pdo/pdo_driver.php23
-rw-r--r--system/database/drivers/pdo/pdo_forge.php2
-rw-r--r--system/database/drivers/pdo/pdo_result.php45
-rw-r--r--system/database/drivers/pdo/pdo_utility.php2
-rw-r--r--system/database/drivers/postgre/postgre_driver.php14
-rw-r--r--system/database/drivers/postgre/postgre_forge.php2
-rw-r--r--system/database/drivers/postgre/postgre_result.php2
-rw-r--r--system/database/drivers/postgre/postgre_utility.php2
-rw-r--r--system/database/drivers/sqlite/sqlite_driver.php2
-rw-r--r--system/database/drivers/sqlite/sqlite_forge.php2
-rw-r--r--system/database/drivers/sqlite/sqlite_result.php2
-rw-r--r--system/database/drivers/sqlite/sqlite_utility.php2
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_driver.php2
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_forge.php2
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_result.php2
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_utility.php2
44 files changed, 144 insertions, 89 deletions
diff --git a/system/database/drivers/cubrid/cubrid_driver.php b/system/database/drivers/cubrid/cubrid_driver.php
index 3c0850ad3..244707395 100644
--- a/system/database/drivers/cubrid/cubrid_driver.php
+++ b/system/database/drivers/cubrid/cubrid_driver.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/cubrid/cubrid_forge.php b/system/database/drivers/cubrid/cubrid_forge.php
index 76002cb38..7d606ea36 100644
--- a/system/database/drivers/cubrid/cubrid_forge.php
+++ b/system/database/drivers/cubrid/cubrid_forge.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/cubrid/cubrid_result.php b/system/database/drivers/cubrid/cubrid_result.php
index 4c0fede10..a7eeb8a39 100644
--- a/system/database/drivers/cubrid/cubrid_result.php
+++ b/system/database/drivers/cubrid/cubrid_result.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/cubrid/cubrid_utility.php b/system/database/drivers/cubrid/cubrid_utility.php
index 750c0d8dd..a13c0a5e4 100644
--- a/system/database/drivers/cubrid/cubrid_utility.php
+++ b/system/database/drivers/cubrid/cubrid_utility.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/interbase/interbase_driver.php b/system/database/drivers/interbase/interbase_driver.php
index bacb6688c..a9a647202 100644
--- a/system/database/drivers/interbase/interbase_driver.php
+++ b/system/database/drivers/interbase/interbase_driver.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/interbase/interbase_forge.php b/system/database/drivers/interbase/interbase_forge.php
index 023d278ce..f46043569 100644
--- a/system/database/drivers/interbase/interbase_forge.php
+++ b/system/database/drivers/interbase/interbase_forge.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/interbase/interbase_result.php b/system/database/drivers/interbase/interbase_result.php
index 4b15eee20..5bf0c902d 100644
--- a/system/database/drivers/interbase/interbase_result.php
+++ b/system/database/drivers/interbase/interbase_result.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/interbase/interbase_utility.php b/system/database/drivers/interbase/interbase_utility.php
index 76a0497c1..a88055ee0 100644
--- a/system/database/drivers/interbase/interbase_utility.php
+++ b/system/database/drivers/interbase/interbase_utility.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php
index 39b84f9c6..b6b64cc44 100644
--- a/system/database/drivers/mssql/mssql_driver.php
+++ b/system/database/drivers/mssql/mssql_driver.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/mssql/mssql_forge.php b/system/database/drivers/mssql/mssql_forge.php
index ec97805ac..4a8089bb1 100644
--- a/system/database/drivers/mssql/mssql_forge.php
+++ b/system/database/drivers/mssql/mssql_forge.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/mssql/mssql_result.php b/system/database/drivers/mssql/mssql_result.php
index bba2e6243..b205ce2d1 100644
--- a/system/database/drivers/mssql/mssql_result.php
+++ b/system/database/drivers/mssql/mssql_result.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/mssql/mssql_utility.php b/system/database/drivers/mssql/mssql_utility.php
index be6ed5bb0..28f34b999 100644
--- a/system/database/drivers/mssql/mssql_utility.php
+++ b/system/database/drivers/mssql/mssql_utility.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index cd1763751..ba646d226 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
@@ -144,14 +144,11 @@ class CI_DB_mysql_driver extends CI_DB {
* Set client character set
*
* @param string
- * @param string
* @return bool
*/
- protected function _db_set_charset($charset, $collation)
+ protected function _db_set_charset($charset)
{
- return function_exists('mysql_set_charset')
- ? @mysql_set_charset($charset, $this->conn_id)
- : @mysql_query("SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'", $this->conn_id);
+ return @mysql_set_charset($charset, $this->conn_id);
}
// --------------------------------------------------------------------
@@ -289,18 +286,7 @@ class CI_DB_mysql_driver extends CI_DB {
return $str;
}
- if (function_exists('mysql_real_escape_string') && is_resource($this->conn_id))
- {
- $str = mysql_real_escape_string($str, $this->conn_id);
- }
- elseif (function_exists('mysql_escape_string'))
- {
- $str = mysql_escape_string($str);
- }
- else
- {
- $str = addslashes($str);
- }
+ $str = is_resource($this->conn_id) ? mysql_real_escape_string($str, $this->conn_id) : addslashes($str);
// escape LIKE condition wildcards
if ($like === TRUE)
diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php
index a907b20fa..004a5a103 100644
--- a/system/database/drivers/mysql/mysql_forge.php
+++ b/system/database/drivers/mysql/mysql_forge.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/mysql/mysql_result.php b/system/database/drivers/mysql/mysql_result.php
index 5a65d9c72..cec28dc2d 100644
--- a/system/database/drivers/mysql/mysql_result.php
+++ b/system/database/drivers/mysql/mysql_result.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/mysql/mysql_utility.php b/system/database/drivers/mysql/mysql_utility.php
index 952f887fe..d716b004a 100644
--- a/system/database/drivers/mysql/mysql_utility.php
+++ b/system/database/drivers/mysql/mysql_utility.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index d06119a13..f38b94c13 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
@@ -144,14 +144,11 @@ class CI_DB_mysqli_driver extends CI_DB {
* Set client character set
*
* @param string
- * @param string
* @return bool
*/
- protected function _db_set_charset($charset, $collation)
+ protected function _db_set_charset($charset)
{
- return function_exists('mysqli_set_charset')
- ? @mysqli_set_charset($this->conn_id, $charset)
- : @mysqli_query($this->conn_id, "SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'");
+ return @mysqli_set_charset($this->conn_id, $charset);
}
// --------------------------------------------------------------------
@@ -289,18 +286,7 @@ class CI_DB_mysqli_driver extends CI_DB {
return $str;
}
- if (function_exists('mysqli_real_escape_string') && is_object($this->conn_id))
- {
- $str = mysqli_real_escape_string($this->conn_id, $str);
- }
- elseif (function_exists('mysql_escape_string'))
- {
- $str = mysql_escape_string($str);
- }
- else
- {
- $str = addslashes($str);
- }
+ $str = is_object($this->conn_id) ? mysqli_real_escape_string($this->conn_id, $str) : addslashes($str);
// escape LIKE condition wildcards
if ($like === TRUE)
diff --git a/system/database/drivers/mysqli/mysqli_forge.php b/system/database/drivers/mysqli/mysqli_forge.php
index 744525f02..9cb1a0c70 100644
--- a/system/database/drivers/mysqli/mysqli_forge.php
+++ b/system/database/drivers/mysqli/mysqli_forge.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
@@ -86,9 +86,32 @@ class CI_DB_mysqli_forge extends CI_DB_forge {
$sql .= "\n\t".$this->db->protect_identifiers($field)
.( ! empty($attributes['NAME']) ? ' '.$this->db->protect_identifiers($attributes['NAME']).' ' : '')
- .( ! empty($attributes['TYPE']) ? ' '.$attributes['TYPE'] : '')
- .( ! empty($attributes['CONSTRAINT']) ? '('.$attributes['CONSTRAINT'].')' : '')
- .(( ! empty($attributes['UNSIGNED']) && $attributes['UNSIGNED'] === TRUE) ? ' UNSIGNED' : '')
+ ;
+
+ if ( ! empty($attributes['TYPE']))
+ {
+ $sql .= ' '.$attributes['TYPE'];
+
+ if ( ! empty($attributes['CONSTRAINT']))
+ {
+ switch (strtolower($attributes['TYPE']))
+ {
+ case 'decimal':
+ case 'float':
+ case 'numeric':
+ $sql .= '('.implode(',', $attributes['CONSTRAINT']).')';
+ break;
+ case 'enum':
+ case 'set':
+ $sql .= '("'.implode('","', $attributes['CONSTRAINT']).'")';
+ break;
+ default:
+ $sql .= '('.$attributes['CONSTRAINT'].')';
+ }
+ }
+ }
+
+ $sql .= (( ! empty($attributes['UNSIGNED']) && $attributes['UNSIGNED'] === TRUE) ? ' UNSIGNED' : '')
.(isset($attributes['DEFAULT']) ? " DEFAULT '".$attributes['DEFAULT']."'" : '')
.(( ! empty($attributes['NULL']) && $attributes['NULL'] === TRUE) ? ' NULL' : ' NOT NULL')
.(( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE) ? ' AUTO_INCREMENT' : '');
diff --git a/system/database/drivers/mysqli/mysqli_result.php b/system/database/drivers/mysqli/mysqli_result.php
index 8b909cc56..f135f4d46 100644
--- a/system/database/drivers/mysqli/mysqli_result.php
+++ b/system/database/drivers/mysqli/mysqli_result.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/mysqli/mysqli_utility.php b/system/database/drivers/mysqli/mysqli_utility.php
index 3fdc5c723..650ddfd18 100644
--- a/system/database/drivers/mysqli/mysqli_utility.php
+++ b/system/database/drivers/mysqli/mysqli_utility.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php
index 8db6c1286..070d58a34 100644
--- a/system/database/drivers/oci8/oci8_driver.php
+++ b/system/database/drivers/oci8/oci8_driver.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php
index 48f98d022..7fcc8094d 100644
--- a/system/database/drivers/oci8/oci8_forge.php
+++ b/system/database/drivers/oci8/oci8_forge.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php
index 383b9f1a0..6f1b8b4c1 100644
--- a/system/database/drivers/oci8/oci8_result.php
+++ b/system/database/drivers/oci8/oci8_result.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/oci8/oci8_utility.php b/system/database/drivers/oci8/oci8_utility.php
index d60f98bc4..62dfb2f3c 100644
--- a/system/database/drivers/oci8/oci8_utility.php
+++ b/system/database/drivers/oci8/oci8_utility.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php
index 2575f431d..acc2838e3 100644
--- a/system/database/drivers/odbc/odbc_driver.php
+++ b/system/database/drivers/odbc/odbc_driver.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/odbc/odbc_forge.php b/system/database/drivers/odbc/odbc_forge.php
index 51addf03d..acc2cadee 100644
--- a/system/database/drivers/odbc/odbc_forge.php
+++ b/system/database/drivers/odbc/odbc_forge.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/odbc/odbc_result.php b/system/database/drivers/odbc/odbc_result.php
index de2c58cb9..d19fa247e 100644
--- a/system/database/drivers/odbc/odbc_result.php
+++ b/system/database/drivers/odbc/odbc_result.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/odbc/odbc_utility.php b/system/database/drivers/odbc/odbc_utility.php
index bae3fe853..c146c1785 100644
--- a/system/database/drivers/odbc/odbc_utility.php
+++ b/system/database/drivers/odbc/odbc_utility.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index c8732ac3c..658a3d5a0 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
@@ -561,6 +561,11 @@ class CI_DB_pdo_driver extends CI_DB {
// Analog function to show all tables in postgre
$sql = "SELECT * FROM information_schema.tables WHERE table_schema = 'public'";
}
+ elseif ($this->pdodriver == '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->database."`";
@@ -603,6 +608,22 @@ class CI_DB_pdo_driver extends CI_DB {
*/
function _field_data($table)
{
+ if ($this->pdodriver == 'mysql' or $this->pdodriver == 'pgsql')
+ {
+ // Analog function for mysql and postgre
+ return 'SELECT * FROM '.$this->_from_tables($table).' LIMIT 1';
+ }
+ elseif ($this->pdodriver == 'oci')
+ {
+ // Analog function for oci
+ return 'SELECT * FROM '.$this->_from_tables($table).' WHERE ROWNUM <= 1';
+ }
+ elseif ($this->pdodriver == 'sqlite')
+ {
+ // Analog function for sqlite
+ return 'PRAGMA table_info('.$this->_from_tables($table).')';
+ }
+
return 'SELECT TOP 1 FROM '.$this->_from_tables($table);
}
diff --git a/system/database/drivers/pdo/pdo_forge.php b/system/database/drivers/pdo/pdo_forge.php
index b4ddca5fe..87b638570 100644
--- a/system/database/drivers/pdo/pdo_forge.php
+++ b/system/database/drivers/pdo/pdo_forge.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/pdo/pdo_result.php b/system/database/drivers/pdo/pdo_result.php
index c333abc40..384b753da 100644
--- a/system/database/drivers/pdo/pdo_result.php
+++ b/system/database/drivers/pdo/pdo_result.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
@@ -160,9 +160,48 @@ class CI_DB_pdo_result extends CI_DB_result {
try
{
- for($i = 0; $i < $this->num_fields(); $i++)
+ if (strpos($this->result_id->queryString, 'PRAGMA') !== FALSE)
{
- $data[] = $this->result_id->getColumnMeta($i);
+ foreach ($this->result_array() as $field)
+ {
+ preg_match('/([a-zA-Z]+)(\(\d+\))?/', $field['type'], $matches);
+
+ $F = new stdClass();
+ $F->name = $field['name'];
+ $F->type = ( ! empty($matches[1])) ? $matches[1] : NULL;
+ $F->default = NULL;
+ $F->max_length = ( ! empty($matches[2])) ? preg_replace('/[^\d]/', '', $matches[2]) : NULL;
+ $F->primary_key = (int) $field['pk'];
+ $F->pdo_type = NULL;
+
+ $data[] = $F;
+ }
+ }
+ else
+ {
+ for($i = 0, $max = $this->num_fields(); $i < $max; $i++)
+ {
+ $field = $this->result_id->getColumnMeta($i);
+
+ $F = new stdClass();
+ $F->name = $field['name'];
+ $F->type = $field['native_type'];
+ $F->default = NULL;
+ $F->pdo_type = $field['pdo_type'];
+
+ if ($field['precision'] < 0)
+ {
+ $F->max_length = NULL;
+ $F->primary_key = 0;
+ }
+ else
+ {
+ $F->max_length = ($field['len'] > 255) ? 0 : $field['len'];
+ $F->primary_key = (int) ( ! empty($field['flags']) && in_array('primary_key', $field['flags']));
+ }
+
+ $data[] = $F;
+ }
}
return $data;
diff --git a/system/database/drivers/pdo/pdo_utility.php b/system/database/drivers/pdo/pdo_utility.php
index 971ec8803..c278c5172 100644
--- a/system/database/drivers/pdo/pdo_utility.php
+++ b/system/database/drivers/pdo/pdo_utility.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index 133861f9f..ab561add4 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
@@ -45,7 +45,7 @@ class CI_DB_postgre_driver extends CI_DB {
protected $_escape_char = '"';
// clause and character used for LIKE escape sequences
- protected $_like_escape_str = ' ESCAPE \'%s\' ';
+ protected $_like_escape_str = " ESCAPE '%s' ";
protected $_like_escape_chr = '!';
/**
@@ -328,8 +328,8 @@ class CI_DB_postgre_driver extends CI_DB {
// escape LIKE condition wildcards
if ($like === TRUE)
{
- return str_replace(array('%', '_', $this->_like_escape_chr),
- array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr),
+ return str_replace(array($this->_like_escape_chr, '%', '_'),
+ array($this->_like_escape_chr.$this->_like_escape_chr, $this->_like_escape_chr.'%', $this->_like_escape_chr.'_'),
$str);
}
@@ -353,7 +353,7 @@ class CI_DB_postgre_driver extends CI_DB {
/**
* Insert ID
*
- * @return int
+ * @return string
*/
public function insert_id()
{
@@ -535,7 +535,7 @@ class CI_DB_postgre_driver extends CI_DB {
* This function implicitly groups FROM tables so there is no confusion
* about operator precedence in harmony with SQL standards
*
- * @param string table name
+ * @param array
* @return string
*/
protected function _from_tables($tables)
@@ -638,7 +638,7 @@ class CI_DB_postgre_driver extends CI_DB {
* @param string the limit clause
* @return string
*/
- protected function _delete($table, $where = array(), $like = array())
+ protected function _delete($table, $where = array(), $like = array(), $limit = FALSE)
{
if (count($where) > 0 OR count($like) > 0)
{
diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php
index 6030adf38..c98116ab6 100644
--- a/system/database/drivers/postgre/postgre_forge.php
+++ b/system/database/drivers/postgre/postgre_forge.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/postgre/postgre_result.php b/system/database/drivers/postgre/postgre_result.php
index 2cfa997e7..20c575fd8 100644
--- a/system/database/drivers/postgre/postgre_result.php
+++ b/system/database/drivers/postgre/postgre_result.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/postgre/postgre_utility.php b/system/database/drivers/postgre/postgre_utility.php
index 1e9580389..d2c0079c6 100644
--- a/system/database/drivers/postgre/postgre_utility.php
+++ b/system/database/drivers/postgre/postgre_utility.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php
index 91598ab0f..55d9bfdb8 100644
--- a/system/database/drivers/sqlite/sqlite_driver.php
+++ b/system/database/drivers/sqlite/sqlite_driver.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php
index 4f379d96f..7fc531463 100644
--- a/system/database/drivers/sqlite/sqlite_forge.php
+++ b/system/database/drivers/sqlite/sqlite_forge.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/sqlite/sqlite_result.php b/system/database/drivers/sqlite/sqlite_result.php
index 74c0dc549..ac2235cbc 100644
--- a/system/database/drivers/sqlite/sqlite_result.php
+++ b/system/database/drivers/sqlite/sqlite_result.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/sqlite/sqlite_utility.php b/system/database/drivers/sqlite/sqlite_utility.php
index 8fefcd9e2..9f9ddca44 100644
--- a/system/database/drivers/sqlite/sqlite_utility.php
+++ b/system/database/drivers/sqlite/sqlite_utility.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php
index 5c90cb4f2..5e920cbe8 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_driver.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/sqlsrv/sqlsrv_forge.php b/system/database/drivers/sqlsrv/sqlsrv_forge.php
index 152192241..cd061dd23 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_forge.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_forge.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/sqlsrv/sqlsrv_result.php b/system/database/drivers/sqlsrv/sqlsrv_result.php
index 1ee19c2d1..52d338a30 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_result.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_result.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
diff --git a/system/database/drivers/sqlsrv/sqlsrv_utility.php b/system/database/drivers/sqlsrv/sqlsrv_utility.php
index e96df96f9..44e6fafeb 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_utility.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_utility.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*