peter z Fri Aug 12 17:54:20 -0400 2011

Subject: PDO options

There seems to be no support for specifying custom PDO connection options, I had to hack Connection.php:

static $PDO_OPTIONS = array(
PDO::ATTR_CASE => PDO::CASE_LOWER,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL,
PDO::ATTR_STRINGIFY_FETCHES => false,
PDO::MYSQL_ATTR_INIT_COMMAND=> 'SET NAMES utf8' );

Adding ;charset=utf8 to connection DSN didnt work for MySQL. Non-UTF8 attribute values on models silently breaks to_json() func which will return NULL for non-utf8 values.

There really should be a way to specify additional PDO options, or alternatively support character sets both for connection and models values. Dang.

Peter


Clay vanSchalkwijk Wed Sep 14 00:14:19 -0400 2011

You can pass in the character set in the connection string of the config, e.g. mysql://user:pass@localhost/db?charset=utf8. This is patched and in the ar/master branch (nightly build).

(1-1/1)