Make sure we have a DB connection before setting its charset

This commit is contained in:
Zach Copley 2009-06-18 19:19:19 +00:00
parent bde571728d
commit e0fb15c185

View File

@ -242,6 +242,7 @@ class Memcached_DataObject extends DB_DataObject
if (common_config('db', 'type') == 'mysql' &&
common_config('db', 'utf8')) {
$conn = $DB->connection;
if (!empty($conn)) {
if ($DB instanceof DB_mysqli) {
mysqli_set_charset($conn, 'utf8');
} else if ($DB instanceof DB_mysql) {
@ -249,6 +250,8 @@ class Memcached_DataObject extends DB_DataObject
}
}
}
}
return $result;
}
}