Skip to content

Commit

Permalink
Improve collation detection in MySQL drivers
Browse files Browse the repository at this point in the history
  • Loading branch information
mbabker committed Apr 3, 2016
1 parent 5e1e27d commit 38e3e73
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 28 deletions.
15 changes: 1 addition & 14 deletions src/Mysql/MysqlDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,20 +162,7 @@ public function getCollation()
{
$this->connect();

$tables = $this->getTableList();

$this->setQuery('SHOW FULL COLUMNS FROM ' . $tables[0]);
$array = $this->loadAssocList();

foreach ($array as $field)
{
if (!is_null($field['Collation']))
{
return $field['Collation'];
}
}

return null;
return $this->setQuery('SELECT @@collation_database;')->loadResult();
}

/**
Expand Down
15 changes: 1 addition & 14 deletions src/Mysqli/MysqliDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,20 +311,7 @@ public function getCollation()
{
$this->connect();

$tables = $this->getTableList();

$this->setQuery('SHOW FULL COLUMNS FROM ' . $tables[0]);
$array = $this->loadAssocList();

foreach ($array as $field)
{
if (!is_null($field['Collation']))
{
return $field['Collation'];
}
}

return null;
return $this->setQuery('SELECT @@collation_database;')->loadResult();
}

/**
Expand Down

0 comments on commit 38e3e73

Please sign in to comment.