[icinga-checkins] icinga.org: icingaweb2-module-director/master: Db: fetchActivityLogIdByChecksum - one more helper

git at icinga.org git at icinga.org
Wed Feb 24 12:21:25 CET 2016


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

Author: Thomas Gelf <thomas at gelf.net>
Date:   Wed Feb 24 11:38:11 2016 +0100

Db: fetchActivityLogIdByChecksum - one more helper

---

 library/Director/Db.php |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/library/Director/Db.php b/library/Director/Db.php
index e9cb242..b1b0eb7 100644
--- a/library/Director/Db.php
+++ b/library/Director/Db.php
@@ -194,6 +194,16 @@ class Db extends DbConnection
         }
     }
 
+    public function fetchActivityLogIdByChecksum($checksum)
+    {
+        if ($this->getDbType() === 'pgsql') {
+            $checksum = new Zend_Db_Expr("\\x" . bin2hex($checksum));
+        }
+
+        $sql = 'SELECT id FROM director_activity_log WHERE checksum = ?';
+        return $this->db()->fetchOne($sql, $checksum);
+    }
+
     public function fetchActivityLogEntry($checksum)
     {
         if ($this->getDbType() === 'pgsql') {



More information about the icinga-checkins mailing list