From a484328df2f6c4477b145069f86e24741760136a Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Tue, 2 Sep 2014 20:01:50 +0200 Subject: [PATCH] Improved importer performance --- .../system/exporter/AbstractExporter.class.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/wcfsetup/install/files/lib/system/exporter/AbstractExporter.class.php b/wcfsetup/install/files/lib/system/exporter/AbstractExporter.class.php index 3cb263c3ea..54082eea0a 100644 --- a/wcfsetup/install/files/lib/system/exporter/AbstractExporter.class.php +++ b/wcfsetup/install/files/lib/system/exporter/AbstractExporter.class.php @@ -181,4 +181,21 @@ abstract class AbstractExporter implements IExporter { return true; } + + /** + * Gets the max value of a specific column. + * + * @param string $tableName + * @param string $columnName + * @return integer + */ + protected function __getMaxID($tableName, $columnName) { + $sql = "SELECT MAX(".$columnName.") AS maxID + FROM ".$tableName; + $statement = $this->database->prepareStatement($sql); + $statement->execute(); + $row = $statement->fetchArray(); + if ($row !== false) return $row['maxID']; + return 0; + } } -- 2.20.1