summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/pdo
diff options
context:
space:
mode:
authorTimothy Warren <tim@timshomepage.net>2011-10-07 15:51:49 +0200
committerTimothy Warren <tim@timshomepage.net>2011-10-07 15:51:49 +0200
commit3351275b1c80c9d4ec2e6fa551c3cee3a0e47b27 (patch)
tree90f28e864dd5248c0c08f7856125b8f5bf02368d /system/database/drivers/pdo
parente7608b264443bb9803e580f884c44fef46d00fba (diff)
Revert "Added check for quote mark"
Diffstat (limited to 'system/database/drivers/pdo')
-rw-r--r--system/database/drivers/pdo/pdo_driver.php26
1 files changed, 21 insertions, 5 deletions
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index 750c02e27..1a84404bb 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -313,10 +313,7 @@ class CI_DB_pdo_driver extends CI_DB {
$str = $this->conn_id->quote($str);
//If there are duplicated quotes, trim them away
- if(strpos($str, "'") === 0)
- {
- $str = substr($str, 1, -1);
- }
+ $str = substr($str, 1, -1);
// escape LIKE condition wildcards
if ($like === TRUE)
@@ -352,7 +349,25 @@ class CI_DB_pdo_driver extends CI_DB {
*/
function insert_id($name=NULL)
{
- return $this->conn_id->lastInsertId($name);
+ //Convenience method for postgres insertid
+ if(strpos($this->hostname, 'pgsql') !== FALSE)
+ {
+ $v = $this->_version();
+
+ $table = func_num_args() > 0 ? func_get_arg(0) : NULL;
+
+ if ($table == NULL && $v >= '8.1')
+ {
+ $sql='SELECT LASTVAL() as ins_id';
+ }
+ $query = $this->query($sql);
+ $row = $query->row();
+ return $row->ins_id;
+ }
+ else
+ {
+ return $this->conn_id->lastInsertId($name);
+ }
}
// --------------------------------------------------------------------
@@ -403,6 +418,7 @@ class CI_DB_pdo_driver extends CI_DB {
if ($prefix_limit !== FALSE AND $this->dbprefix != '')
{
+ //$sql .= " LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr);
return FALSE; // not currently supported
}