From: Evan Prodromou Date: Sun, 26 Apr 2009 17:16:59 +0000 (-0400) Subject: Revert "Revert "run 'set names' after each connection to deal with UTF8 correctly"" X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=698228acb9a6262f2fb4e0c82118249aa94cc0f8;p=quix0rs-gnu-social.git Revert "Revert "run 'set names' after each connection to deal with UTF8 correctly"" This reverts commit 86770ccde7914219a0a572ced6dd21fa65566e1d. --- diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php index 5f71f716b3..877bbf2e0f 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; + } }