From 28cd9681c8cc345c88ad12fdd3d434f0c8f29e15 Mon Sep 17 00:00:00 2001
From: Johannes Meyer <johannes.meyer@netways.de>
Date: Thu, 3 Dec 2015 13:50:01 +0100
Subject: [PATCH] DbQuery: Add method union()

---
 library/Icinga/Data/Db/DbQuery.php | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/library/Icinga/Data/Db/DbQuery.php b/library/Icinga/Data/Db/DbQuery.php
index 39f8032de..f5b730dce 100644
--- a/library/Icinga/Data/Db/DbQuery.php
+++ b/library/Icinga/Data/Db/DbQuery.php
@@ -577,4 +577,18 @@ class DbQuery extends SimpleQuery
         $this->select->joinNatural($name, $cols, $schema);
         return $this;
     }
+
+    /**
+     * Add a UNION clause to the query
+     *
+     * @param   array   $select     Select clauses for the union
+     * @param   string  $type       Type of UNION to use
+     *
+     * @return  $this
+     */
+    public function union($select = array(), $type = Zend_Db_Select::SQL_UNION)
+    {
+        $this->select->union($select, $type);
+        return $this;
+    }
 }