summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-03-03 02:48:12 +0100
committerAndrey Andreev <narf@bofh.bg>2012-03-03 02:48:12 +0100
commit8e89df8f92444eb02dc73b6c3e66077a4fb3f710 (patch)
tree9336b4d9d564a1219285c53f942d1fde3e79a277
parent08856b8738ea4fc17b13986c9f2619383cb4a6e9 (diff)
Add db_set_charset() support for PostgreSQL and change its implementation for 'mysql'
-rw-r--r--system/database/drivers/mysql/mysql_driver.php2
-rw-r--r--system/database/drivers/postgre/postgre_driver.php13
-rw-r--r--user_guide_src/source/changelog.rst1
3 files changed, 15 insertions, 1 deletions
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index 7108a6db1..84f7791c7 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -147,7 +147,7 @@ class CI_DB_mysql_driver extends CI_DB {
* @param string
* @return bool
*/
- public function db_set_charset($charset, $collation)
+ protected function _db_set_charset($charset, $collation)
{
return function_exists('mysql_set_charset')
? @mysql_set_charset($charset, $this->conn_id)
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index d6681086a..8df90f6a4 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -147,6 +147,19 @@ class CI_DB_postgre_driver extends CI_DB {
// --------------------------------------------------------------------
/**
+ * Set client character set
+ *
+ * @param string
+ * @return bool
+ */
+ protected function _db_set_charset($charset)
+ {
+ return (pg_set_client_encoding($this->conn_id, $charset) === 0);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Database version number
*
* @return string
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index ca36ecd31..6f3b030a0 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -59,6 +59,7 @@ Release Date: Not Released
- Replaced the _error_message() and _error_number() methods with error(), that returns an array containing the last database error code and message.
- Improved version() implementation so that drivers that have a native function to get the version number don't have to be defined in the core DB_driver class.
- PostgreSQL driver now uses pg_version() to get the database version number, when possible.
+ - Added db_set_charset() support for PostgreSQL.
- Libraries