Commit 60183257 authored by Son Nguyen's avatar Son Nguyen
Browse files

Fix the bug when the Mysql database collation is not set to ci



Bug #1326174

Change-Id: I2ff391b74533092b9c2e0aeaa8a34ed5059d1119
Signed-off-by: default avatarSon Nguyen <son.nguyen@catalyst.net.nz>
parent 5a06868b
......@@ -3816,9 +3816,11 @@ function check_case_sensitive($a, $table) {
$db = get_config('dbname');
$table = get_config('dbprefix') . $table;
$result = get_records_sql_array("SHOW TABLE STATUS IN `$db` WHERE Name = ?", array($table));
if (is_array($result) && count($result) === 1 && preg_match('/_ci/', $result[0]->Collation)) {
$b = array_unique(array_map('strtolower', $a));
$a = array_intersect_key($a, array_flip(array_keys($b)));
if (is_array($result) && count($result) === 1) {
if (preg_match('/_ci/', $result[0]->Collation)) {
$b = array_unique(array_map('strtolower', $a));
$a = array_intersect_key($a, array_flip(array_keys($b)));
}
}
else {
throw new SQLException($table . " is not found or can not be accessed, check log for errors.");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment