Add db_set_charset() support for PostgreSQL and change its implementation for 'mysql'
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index 7108a6d..84f7791 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -147,7 +147,7 @@
* @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 d668108..8df90f6 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -147,6 +147,19 @@
// --------------------------------------------------------------------
/**
+ * 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 ca36ecd..6f3b030 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -59,6 +59,7 @@
- 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