diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-04-26 13:16:59 -0400 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-04-26 13:16:59 -0400 |
commit | 698228acb9a6262f2fb4e0c82118249aa94cc0f8 (patch) | |
tree | a710f9e1296e6dae9e970c0ca1f0dbba77377a60 /classes | |
parent | 86770ccde7914219a0a572ced6dd21fa65566e1d (diff) |
Revert "Revert "run 'set names' after each connection to deal with UTF8 correctly""
This reverts commit 86770ccde7914219a0a572ced6dd21fa65566e1d.
Diffstat (limited to 'classes')
-rw-r--r-- | classes/Memcached_DataObject.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php index 5f71f716b..877bbf2e0 100644 --- a/classes/Memcached_DataObject.php +++ b/classes/Memcached_DataObject.php @@ -227,4 +227,20 @@ class Memcached_DataObject extends DB_DataObject $c->set($ckey, $cached, MEMCACHE_COMPRESSED, $expiry); return new ArrayWrapper($cached); } + + // We overload so that 'SET NAMES "utf8"' is called for + // each connection + + function _connect() + { + global $_DB_DATAOBJECT; + $exists = !empty($this->_database_dsn_md5) && + isset($_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]); + $result = parent::_connect(); + if (!$exists) { + $DB = &$_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]; + $DB->query('SET NAMES "utf8"'); + } + return $result; + } } |