summaryrefslogtreecommitdiff
path: root/classes/Memcached_DataObject.php
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@controlyourself.ca>2009-05-29 00:10:23 +0000
committerSarven Capadisli <csarven@controlyourself.ca>2009-05-29 00:10:23 +0000
commita456ceb47c5019acd8d8766be274eda955a58125 (patch)
tree2a9589380e899d9d9e80e100ceab88b823e242c9 /classes/Memcached_DataObject.php
parent244149e0225970b76596b79758566ae5bb9fc806 (diff)
parentdaf845dbe67a909e2bc9e039d3c2ccc560345b4d (diff)
Merge branch '0.7.x' into 0.8.x
Diffstat (limited to 'classes/Memcached_DataObject.php')
-rw-r--r--classes/Memcached_DataObject.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php
index 5f71f716b..52ad4100f 100644
--- a/classes/Memcached_DataObject.php
+++ b/classes/Memcached_DataObject.php
@@ -227,4 +227,22 @@ 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];
+ if (common_config('db', 'utf8')) {
+ $DB->query('SET NAMES "utf8"');
+ }
+ }
+ return $result;
+ }
}