From: Tim Otten Date: Mon, 10 Nov 2014 21:19:49 +0000 (-0800) Subject: CRM_Core_Error - Add debug_query_result() helper X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=d090b80b079e29e374474ae7ed4c86375ffc5588;p=civicrm-core.git CRM_Core_Error - Add debug_query_result() helper --- diff --git a/CRM/Core/Error.php b/CRM/Core/Error.php index e3cb5a4d7b..609506f88a 100644 --- a/CRM/Core/Error.php +++ b/CRM/Core/Error.php @@ -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 *