CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Using search, how to display the full SQL that got the result?
Pages: [1]

Author Topic: Using search, how to display the full SQL that got the result?  (Read 699 times)

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Using search, how to display the full SQL that got the result?
April 11, 2010, 11:15:49 pm
I'm a bit stumped, and I guess I'm not looking in the right place.  I'm using Advanced Search or Find Contributions and getting a set of results.  I want to see the exact SQL query that is being run to get those results.

I've tried setting debugging on with...
  1. smartyDebug=1
  2. define('CIVICRM_DAO_DEBUG', 1); in civicrm.settings.php
  3. CRM_Core_Error::debug('query', $query); added to packages/DB/DataObject.php

The last one displayed a whole lot of queries, alright, but none of them were the executed search query.

I've read the docs and spent about an hour trying to find a way to show that query....what am I missing?

Thanks,
Stoob
Try CiviTeacher: the online video tutorial CiviCRM learning library.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Using search, how to display the full SQL that got the result?
April 12, 2010, 08:24:37 am

on my local machine, i have mysql query logging enabled, so i can check queries at any time. this uses a lot of disk space, so do empty the log file periodicallt


alternatively, change 3 to CRM_Core_Error::debug_var('query', $query);

the queries will get logged in CiviCRM.log file

lobo

p.s> in 3.1 we've introduce a new constant: CIVICRM_DEBUG_LOG_QUERY which basically does the debug_var for all civi queries

A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: Using search, how to display the full SQL that got the result?
April 14, 2010, 01:01:17 pm
Thanks for the response.

However the only action that produced any result for my environment is still:
 
Quote
3. CRM_Core_Error::debug('query', $query); added to packages/DB/DataObject.php

Rather than spend all day debugging my environment or why CiviCRM.log doesn't seem to be updating at all, much less with mysql queries, I'm just going to try to get my sysadmin to enable mysql logs directly, and purge them when they get too large.

Try CiviTeacher: the online video tutorial CiviCRM learning library.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Using search, how to display the full SQL that got the result?

This forum was archived on 2017-11-26.