CRM_Core_Error - Add debug_query_result() helper
authorTim Otten <totten@civicrm.org>
Mon, 10 Nov 2014 21:19:49 +0000 (13:19 -0800)
committerTim Otten <totten@civicrm.org>
Tue, 11 Nov 2014 00:21:17 +0000 (16:21 -0800)
CRM/Core/Error.php

index e3cb5a4d7bb711185d96135fb9e1ccdb87afc69b..609506f88a83c74ceff6dd20b0c453c3ad3c8e25 100644 (file)
@@ -613,6 +613,20 @@ class CRM_Core_Error extends PEAR_ErrorStack {
     }
   }
 
+  /**
+   * Execute a query and log the results.
+   *
+   * @param string $query
+   */
+  static function debug_query_result($query) {
+    $dao = CRM_Core_DAO::executeQuery($query);
+    $results = array();
+    while ($dao->fetch()) {
+      $results[] = (array)$dao;
+    }
+    CRM_Core_Error::debug_var('dao result', array('query' => $query, 'results' => $results));
+  }
+
   /**
    * Obtain a reference to the error log
    *