diff options
author | tof <> | 2008-04-18 13:12:19 +0000 |
---|---|---|
committer | tof <> | 2008-04-18 13:12:19 +0000 |
commit | 8897ba06f7b959db228aaf8b7d7ec5d50a11ae70 (patch) | |
tree | 3c19e1215baf812310154d467b63d7bdd7a486ce /framework/Data/TDbConnection.php | |
parent | a54dcaa9d7fbdc7a3f14d33ef3cf36feb29f9f39 (diff) |
Fixed #833
Diffstat (limited to 'framework/Data/TDbConnection.php')
-rw-r--r-- | framework/Data/TDbConnection.php | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/framework/Data/TDbConnection.php b/framework/Data/TDbConnection.php index 08a8695a..2f5a0358 100644 --- a/framework/Data/TDbConnection.php +++ b/framework/Data/TDbConnection.php @@ -27,7 +27,9 @@ Prado::using('System.Data.TDbCommand'); * specifying {@link setConnectionString ConnectionString}, {@link setUsername Username}
* and {@link setPassword Password}.
* - * Since 3.1.2, the connection charset can be set (for MySQL databases only) using the {@link setCharset Charset} property. + * Since 3.1.2, the connection charset can be set (for MySQL and PostgreSQL databases only) + * using the {@link setCharset Charset} property. The value of this property is database dependant. + * e.g. for mysql, you can use 'latin1' for cp1252 West European, 'utf8' for unicode, ... *
* The following example shows how to create a TDbConnection instance and establish
* the actual connection:
@@ -100,7 +102,7 @@ class TDbConnection extends TComponent * @param string The Data Source Name, or DSN, contains the information required to connect to the database.
* @param string The user name for the DSN string.
* @param string The password for the DSN string. - * @param string Charset used for DB Connection (MySql only). If not set, will use the default charset of your database server
+ * @param string Charset used for DB Connection (MySql & pgsql only). If not set, will use the default charset of your database server
* @see http://www.php.net/manual/en/function.PDO-construct.php
*/
public function __construct($dsn='',$username='',$password='', $charset='')
@@ -200,9 +202,12 @@ class TDbConnection extends TComponent { case 'mysql': $stmt = $this->_pdo->prepare('SET CHARACTER SET ?'); - $stmt->execute(array($this->_charset)); + break; + case 'pgsql': + $stmt = $this->_pdo->prepare('SET client_encoding TO ?'); break; } + $stmt->execute(array($this->_charset)); } /**
|