[BUGFIX] Avoid exceptions during indexing with indexed_search 05/52705/2
authorGeorg Ringer <georg.ringer@gmail.com>
Thu, 4 May 2017 12:29:05 +0000 (14:29 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Thu, 4 May 2017 13:01:44 +0000 (15:01 +0200)
The exception "you need to add at least one set of values before
generating the SQL" occurs if the bulkInsert is triggered with
empty values. A check must be done before trying the query.

Resolves: #81140
Releases: master, 8.7
Change-Id: Ia0fe09e49d8e4b8341bda64ee248284c7ca2f3bd
Reviewed-on: https://review.typo3.org/52705
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/indexed_search/Classes/Indexer.php

index 2753285..b0cebd2 100644 (file)
@@ -2191,7 +2191,9 @@ class Indexer
             ];
         }
 
-        $connectionPool->getConnectionForTable('index_rel')->bulkInsert('index_rel', $rows, $fields);
+        if (!empty($rows)) {
+            $connectionPool->getConnectionForTable('index_rel')->bulkInsert('index_rel', $rows, $fields);
+        }
     }
 
     /**