Changeset 2435

Show
Ignore:
Timestamp:
04/18/2008 08:12:19 AM
Author:
tof
Message:

Fixed #833

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/HISTORY

    r2432 r2435  
    3939ENH: Ticket#757 - TDateFormat and TNumberFormat now implement IDataRenderer (Qiang) 
    4040ENH: Ticket#783 - Added date/time type support to soap implementation (Hongliang) 
    41 ENH: Ticket#800 - Added database connection charset for MySql (donkee) 
     41ENH: Ticket#800,#833 - Added database connection charset for MySql and PgSql (donkee) 
    4242ENH: Active Record supports multiple foreign references of the same table (Wei) 
    4343ENH: Added TDbCommand.queryColumn() (Qiang) 
  • trunk/framework/Data/TDbConnection.php

    r2432 r2435  
    2828 * and {@link setPassword Password}. 
    2929 * 
    30  * Since 3.1.2, the connection charset can be set (for MySQL databases only) using the {@link setCharset Charset} property. 
     30 * Since 3.1.2, the connection charset can be set (for MySQL and PostgreSQL databases only)  
     31 * using the {@link setCharset Charset} property. The value of this property is database dependant. 
     32 * e.g. for mysql, you can use 'latin1' for cp1252 West European, 'utf8' for unicode, ...  
    3133 *  
    3234 * The following example shows how to create a TDbConnection instance and establish 
     
    101103         * @param string The user name for the DSN string. 
    102104         * @param string The password for the DSN string. 
    103          * @param string Charset used for DB Connection (MySql only). If not set, will use the default charset of your database server 
     105         * @param string Charset used for DB Connection (MySql & pgsql only). If not set, will use the default charset of your database server 
    104106         * @see http://www.php.net/manual/en/function.PDO-construct.php 
    105107         */ 
     
    201203                        case 'mysql': 
    202204                                $stmt = $this->_pdo->prepare('SET CHARACTER SET ?'); 
    203                                 $stmt->execute(array($this->_charset)); 
    204205                        break; 
    205                 } 
     206                        case 'pgsql': 
     207                                $stmt = $this->_pdo->prepare('SET client_encoding TO ?'); 
     208                        break; 
     209                } 
     210                $stmt->execute(array($this->_charset)); 
    206211        } 
    207212