@@ -29,41 +29,41 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | class MySqlTools { |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * @param Connection $connection |
|
| 34 | - * @return bool |
|
| 35 | - */ |
|
| 36 | - public function supports4ByteCharset(IDBConnection $connection) { |
|
| 37 | - $variables = ['innodb_file_per_table' => 'ON']; |
|
| 38 | - if (!$this->isMariaDBWithLargePrefix($connection)) { |
|
| 39 | - $variables['innodb_file_format'] = 'Barracuda'; |
|
| 40 | - $variables['innodb_large_prefix'] = 'ON'; |
|
| 41 | - } |
|
| 32 | + /** |
|
| 33 | + * @param Connection $connection |
|
| 34 | + * @return bool |
|
| 35 | + */ |
|
| 36 | + public function supports4ByteCharset(IDBConnection $connection) { |
|
| 37 | + $variables = ['innodb_file_per_table' => 'ON']; |
|
| 38 | + if (!$this->isMariaDBWithLargePrefix($connection)) { |
|
| 39 | + $variables['innodb_file_format'] = 'Barracuda'; |
|
| 40 | + $variables['innodb_large_prefix'] = 'ON'; |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - foreach ($variables as $var => $val) { |
|
| 44 | - $result = $connection->executeQuery("SHOW VARIABLES LIKE '$var'"); |
|
| 45 | - $row = $result->fetch(); |
|
| 46 | - $result->closeCursor(); |
|
| 47 | - if ($row === false) { |
|
| 48 | - return false; |
|
| 49 | - } |
|
| 50 | - if (strcasecmp($row['Value'], $val) !== 0) { |
|
| 51 | - return false; |
|
| 52 | - } |
|
| 53 | - } |
|
| 54 | - return true; |
|
| 55 | - } |
|
| 43 | + foreach ($variables as $var => $val) { |
|
| 44 | + $result = $connection->executeQuery("SHOW VARIABLES LIKE '$var'"); |
|
| 45 | + $row = $result->fetch(); |
|
| 46 | + $result->closeCursor(); |
|
| 47 | + if ($row === false) { |
|
| 48 | + return false; |
|
| 49 | + } |
|
| 50 | + if (strcasecmp($row['Value'], $val) !== 0) { |
|
| 51 | + return false; |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | + return true; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - protected function isMariaDBWithLargePrefix(IDBConnection $connection) { |
|
| 58 | - $result = $connection->executeQuery('SELECT VERSION()'); |
|
| 59 | - $row = strtolower($result->fetchColumn()); |
|
| 60 | - $result->closeCursor(); |
|
| 57 | + protected function isMariaDBWithLargePrefix(IDBConnection $connection) { |
|
| 58 | + $result = $connection->executeQuery('SELECT VERSION()'); |
|
| 59 | + $row = strtolower($result->fetchColumn()); |
|
| 60 | + $result->closeCursor(); |
|
| 61 | 61 | |
| 62 | - if ($row === false) { |
|
| 63 | - return false; |
|
| 64 | - } |
|
| 62 | + if ($row === false) { |
|
| 63 | + return false; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - return strpos($row, 'maria') && version_compare($row, '10.3', '>=') || |
|
| 67 | - strpos($row, 'maria') === false && version_compare($row, '8.0', '>='); |
|
| 68 | - } |
|
| 66 | + return strpos($row, 'maria') && version_compare($row, '10.3', '>=') || |
|
| 67 | + strpos($row, 'maria') === false && version_compare($row, '8.0', '>='); |
|
| 68 | + } |
|
| 69 | 69 | } |