summaryrefslogtreecommitdiff
path: root/classes/Memcached_DataObject.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-04-26 12:13:49 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-04-26 12:13:49 -0400
commit84072aa5cf6124d59a06a7f0a7945c00ee2836da (patch)
treee86aa02a9744eb76f4a0e8e670d0ebecc8ca1f11 /classes/Memcached_DataObject.php
parent5e7664e25f6c4b93d32bc1ef33463c09205ff679 (diff)
run 'set names' after each connection to deal with UTF8 correctly
Diffstat (limited to 'classes/Memcached_DataObject.php')
-rw-r--r--classes/Memcached_DataObject.php16
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;
+ }
}