From 063f5963b01f9c19a2ed070d9e3aa077a2515c21 Mon Sep 17 00:00:00 2001
From: Andrey Andreev <narf@bofh.bg>
Date: Mon, 27 Feb 2012 12:20:52 +0200
Subject: Fixed a db_set_charset() bug

---
 system/database/drivers/pdo/pdo_driver.php | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

(limited to 'system/database/drivers/pdo')

diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index de2b0abeb..fea54e502 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -288,21 +288,6 @@ class CI_DB_pdo_driver extends CI_DB {
 
 	// --------------------------------------------------------------------
 
-	/**
-	 * Set client character set
-	 *
-	 * @access	public
-	 * @param	string
-	 * @param	string
-	 * @return	resource
-	 */
-	function db_set_charset($charset, $collation)
-	{
-		return TRUE;
-	}
-
-	// --------------------------------------------------------------------
-
 	/**
 	 * Version number query string
 	 *
@@ -950,4 +935,4 @@ class CI_DB_pdo_driver extends CI_DB {
 }
 
 /* End of file pdo_driver.php */
-/* Location: ./system/database/drivers/pdo/pdo_driver.php */
\ No newline at end of file
+/* Location: ./system/database/drivers/pdo/pdo_driver.php */
-- 
cgit v1.2.3-24-g4f1b


From ed7408282e9fded97ade222f98b43623a0f17d22 Mon Sep 17 00:00:00 2001
From: Andrey Andreev <narf@bofh.bg>
Date: Thu, 1 Mar 2012 16:37:08 +0200
Subject: Fix PDO's _version() method where it used to return client version
 instead of the server one

---
 system/database/drivers/pdo/pdo_driver.php | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

(limited to 'system/database/drivers/pdo')

diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index de2b0abeb..44e93a042 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -306,12 +306,11 @@ class CI_DB_pdo_driver extends CI_DB {
 	/**
 	 * Version number query string
 	 *
-	 * @access	public
 	 * @return	string
 	 */
-	function _version()
+	protected function _version()
 	{
-		return $this->conn_id->getAttribute(PDO::ATTR_CLIENT_VERSION);
+		return $this->conn_id->getAttribute(PDO::ATTR_SERVER_VERSION);
 	}
 
 	// --------------------------------------------------------------------
@@ -950,4 +949,4 @@ class CI_DB_pdo_driver extends CI_DB {
 }
 
 /* End of file pdo_driver.php */
-/* Location: ./system/database/drivers/pdo/pdo_driver.php */
\ No newline at end of file
+/* Location: ./system/database/drivers/pdo/pdo_driver.php */
-- 
cgit v1.2.3-24-g4f1b


From a39d699f90feb359ab994b3d77d71006060afecc Mon Sep 17 00:00:00 2001
From: Andrey Andreev <narf@bofh.bg>
Date: Thu, 1 Mar 2012 19:11:39 +0200
Subject: Fix a bug in PDO's insert_id() (PostgreSQL-specific)

---
 system/database/drivers/pdo/pdo_driver.php | 32 +++++++++---------------------
 1 file changed, 9 insertions(+), 23 deletions(-)

(limited to 'system/database/drivers/pdo')

diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index 44e93a042..dd803aba1 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -509,33 +509,19 @@ class CI_DB_pdo_driver extends CI_DB {
 
 	/**
 	 * Insert ID
-	 * 
-	 * @access	public
-	 * @return	integer
+	 *
+	 * @return	int
 	 */
-	function insert_id($name=NULL)
+	public function insert_id($name = NULL)
 	{
-		if ($this->pdodriver == 'pgsql')
-		{
-			//Convenience method for postgres insertid
-			$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
+		if ($this->pdodriver === 'pgsql' && $name === NULL && $this->_version() >= '8.1')
 		{
-			return $this->conn_id->lastInsertId($name);
+			$query = $this->query('SELECT LASTVAL() AS ins_id');
+			$query = $query->row();
+			return $query->ins_id;
 		}
+
+		return $this->conn_id->lastInsertId($name);
 	}
 
 	// --------------------------------------------------------------------
-- 
cgit v1.2.3-24-g4f1b