Simplifying DboMysql::getCharsetName()

This commit is contained in:
José Lorenzo Rodríguez 2010-10-16 09:32:01 -04:30
parent 21f5707be7
commit a5f3f95e3a

View file

@ -394,9 +394,10 @@ class DboMysql extends DboSource {
public function getCharsetName($name) { public function getCharsetName($name) {
if ((bool)version_compare($this->getVersion(), "5", ">=")) { if ((bool)version_compare($this->getVersion(), "5", ">=")) {
$r = $this->_execute('SELECT CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.COLLATIONS WHERE COLLATION_NAME = ?', array($name)); $r = $this->_execute('SELECT CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.COLLATIONS WHERE COLLATION_NAME = ?', array($name));
$cols = $r->fetchArray(); $cols = $r->fetch();
if (isset($cols['COLLATIONS']['CHARACTER_SET_NAME'])) {
return $cols['COLLATIONS']['CHARACTER_SET_NAME']; if (isset($cols['CHARACTER_SET_NAME'])) {
return $cols['CHARACTER_SET_NAME'];
} }
} }
return false; return false;