summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-04-26 13:16:59 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-04-26 13:16:59 -0400
commit698228acb9a6262f2fb4e0c82118249aa94cc0f8 (patch)
treea710f9e1296e6dae9e970c0ca1f0dbba77377a60
parent86770ccde7914219a0a572ced6dd21fa65566e1d (diff)
Revert "Revert "run 'set names' after each connection to deal with UTF8 correctly""
This reverts commit 86770ccde7914219a0a572ced6dd21fa65566e1d.
-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;
+ }
}