#9 Should be fixed
authorCameron Ball <cameron@getapproved.com.au>
Tue, 24 Feb 2015 01:28:40 +0000 (09:28 +0800)
committerCameron Ball <cameron@getapproved.com.au>
Tue, 24 Feb 2015 01:28:40 +0000 (09:28 +0800)
DataAccess/DataMapper/DataMapper.php

index a4e474c..4b69b13 100644 (file)
@@ -147,16 +147,17 @@ class DataMapper implements IDataMapper
                     $query = substr($query, 0, -2);\r
                     $query .= sprintf(' WHERE id=%u', $info['id']);\r
                 } else {\r
+                    //The files table has hash and filename as a unique index.\r
+                    //Some packs share the same banner for every file, and we only\r
+                    //ever pull them out by hash. So this on duplicate thing saves\r
+                    //having loads of entries\r
                     $query = sprintf('INSERT INTO %s (%s) VALUES (%s)',\r
                     $info['table'],\r
                     implode(', ', array_keys($info['columns'])),\r
-                    implode(', ', $info['columns']));\r
+                    implode(', ', $info['columns'])) . ' ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id)';\r
                 }\r
-\r
-                //The files table has hash and filename as a unique index.\r
-                //Some packs share the same banner for every file, and we only\r
-                //ever pull them out by hash. So this saves having loads of entries\r
-                $queries[$index] = $query . ' ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id)';\r
+                \r
+                $queries[$index] = $query;\r
             }\r
 \r
            // if($queries['TYPE'] == AbstractPopulationHelper::QUERY_TYPE_CREATE)\r