[icinga-checkins] icinga.org: icingaweb2-module-director/master: Db\Migration: use query for OPTIMIZE, not exec

git at icinga.org git at icinga.org
Tue Jul 26 13:51:26 CEST 2016


Module: icingaweb2-module-director
Branch: master
Commit: 193e860beb2f5e66296e46792b1eae869c58f45c
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=193e860beb2f5e66296e46792b1eae869c58f45c

Author: Thomas Gelf <thomas at gelf.net>
Date:   Tue Jul 26 13:43:18 2016 +0200

Db\Migration: use query for OPTIMIZE, not exec

This is required as OPTIMIZE returns data

---

 library/Director/Db/Migration.php |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/library/Director/Db/Migration.php b/library/Director/Db/Migration.php
index 3392a43..c85adf0 100644
--- a/library/Director/Db/Migration.php
+++ b/library/Director/Db/Migration.php
@@ -40,7 +40,11 @@ class Migration
 
         try {
             foreach ($queries as $query) {
-                $db->exec($query);
+                if (preg_match('/^OPTIMIZE /i', $query)) {
+                    $db->query($query);
+                } else {
+                    $db->exec($query);
+                }
             }
 
         } catch (Exception $e) {



More information about the icinga-checkins mailing list