Improved importer performance
authorMarcel Werk <burntime@woltlab.com>
Tue, 2 Sep 2014 18:01:50 +0000 (20:01 +0200)
committerMarcel Werk <burntime@woltlab.com>
Tue, 2 Sep 2014 18:01:50 +0000 (20:01 +0200)
wcfsetup/install/files/lib/system/exporter/AbstractExporter.class.php

index 3cb263c3ea8a01485d82ff01aa91bbc48db23ddd..54082eea0aef471485558f146be63811f9243241 100644 (file)
@@ -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;
+       } 
 }