From 77bb36ca78f168f2bd23fe01cf7bb68bf319aee8 Mon Sep 17 00:00:00 2001 From: ray176 Date: Mon, 12 Aug 2013 11:51:12 +0200 Subject: [PATCH] Fix MySQLDatabaseEditor --- .../system/database/editor/MySQLDatabaseEditor.class.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/lib/system/database/editor/MySQLDatabaseEditor.class.php b/wcfsetup/install/files/lib/system/database/editor/MySQLDatabaseEditor.class.php index 7b5306ed93..ebf9406c37 100644 --- a/wcfsetup/install/files/lib/system/database/editor/MySQLDatabaseEditor.class.php +++ b/wcfsetup/install/files/lib/system/database/editor/MySQLDatabaseEditor.class.php @@ -34,18 +34,17 @@ class MySQLDatabaseEditor extends DatabaseEditor { public function getColumns($tableName) { $columns = array(); $regex = new Regex('([a-z]+)\(([0-9]+)\)', Regex::CASE_INSENSITIVE); - + $sql = "SHOW COLUMNS FROM ".$tableName; $statement = $this->dbObj->prepareStatement($sql); $statement->execute(); while ($row = $statement->fetchArray()) { $regex->match($row['Type']); $typeMatches = $regex->getMatches(); - if(empty($typeMatches)) continue; - + $columns[] = array('name' => $row['Field'], 'data' => array( - 'type' => $typeMatches[1], - 'length' => $typeMatches[2], + 'type' => ((empty($typeMatches)) ? $row['Type'] : $typeMatches[1]), + 'length' => ((empty($typeMatches)) ? '' : $typeMatches[2]), 'notNull' => (($row['Null'] == 'YES') ? false : true), 'key' => (($row['Key'] == 'PRI') ? 'PRIMARY' : (($row['Key'] == 'UNI') ? 'UNIQUE' : '')), 'default' => $row['Default'], -- 2.20.1