From 52023085f4ba830954f92840dd38a6c949459d0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Lorenzo=20Rodr=C3=ADguez?= Date: Thu, 14 Oct 2010 23:32:07 -0430 Subject: [PATCH] Using the PDO conenction inside DboMysql::getCharsetName() --- cake/libs/model/datasources/dbo/dbo_mysql.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cake/libs/model/datasources/dbo/dbo_mysql.php b/cake/libs/model/datasources/dbo/dbo_mysql.php index 6f7ca6e55..02d8b2229 100644 --- a/cake/libs/model/datasources/dbo/dbo_mysql.php +++ b/cake/libs/model/datasources/dbo/dbo_mysql.php @@ -815,11 +815,12 @@ class DboMysql extends DboMysqlBase { * @param string $name Collation name * @return string Character set name */ - function getCharsetName($name) { - if ((bool)version_compare(mysql_get_server_info($this->connection), "5", ">=")) { - $cols = $this->query('SELECT CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.COLLATIONS WHERE COLLATION_NAME= ' . $this->value($name) . ';'); - if (isset($cols[0]['COLLATIONS']['CHARACTER_SET_NAME'])) { - return $cols[0]['COLLATIONS']['CHARACTER_SET_NAME']; + public function getCharsetName($name) { + if ((bool)version_compare($this->getVersion(), "5", ">=")) { + $r = $this->_execute('SELECT CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.COLLATIONS WHERE COLLATION_NAME = ?', array($name)); + $cols = $r->fetchArray(); + if (isset($cols['COLLATIONS']['CHARACTER_SET_NAME'])) { + return $cols['COLLATIONS']['CHARACTER_SET_NAME']; } } return false;