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) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Error in Search?
Pages: [1]

Author Topic: Error in Search?  (Read 700 times)

vshura

  • I post occasionally
  • **
  • Posts: 59
  • Karma: 1
  • CiviCRM version: 4.6.0
  • CMS version: Wordpress 4.1.1
Error in Search?
August 02, 2010, 08:36:27 am
Hi,

I recently installed a clean copy of CiviCRM 3.1.5 on Drupal, imported the contacts, then a few days ago upgraded to 3.2.0.  But I'm having what I think is a bug with the search facility.

When I go to search builder, I enter, say,

Individual    Gender     =     Male
Individual    Email     IS NOT NULL

I get the following error:

Code: [Select]
Sorry. A non-recoverable error has occurred.

DB Error: syntax error

Database Error Code: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''' ) AND contact_a.contact_type IN ('Individual') ) ) AND (contact_a.is_delete' at line 1, 1064

Return to home page.

Error Details:

Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -2
    [message] => DB Error: syntax error
    [mode] => 16
    [debug_info] => SELECT DISTINCT UPPER(LEFT(contact_a.sort_name, 1)) as sort_name  FROM civicrm_contact contact_a LEFT JOIN civicrm_email ON (contact_a.id = civicrm_email.contact_id AND civicrm_email.is_primary = 1)  LEFT JOIN civicrm_option_group option_group_gender ON (option_group_gender.name = 'gender') LEFT JOIN civicrm_option_value gender ON (contact_a.gender_id = gender.value AND option_group_gender.id = gender.option_group_id)  WHERE  (  ( LOWER(gender.label) = 'male' AND  ( civicrm_email.email IS NOT NULL '' ) AND contact_a.contact_type IN ('Individual') )  )  AND (contact_a.is_deleted = 0)    [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''' ) AND contact_a.contact_type IN ('Individual') )  )  AND (contact_a.is_delete' at line 1]
    [type] => DB_Error
    [user_info] => SELECT DISTINCT UPPER(LEFT(contact_a.sort_name, 1)) as sort_name  FROM civicrm_contact contact_a LEFT JOIN civicrm_email ON (contact_a.id = civicrm_email.contact_id AND civicrm_email.is_primary = 1)  LEFT JOIN civicrm_option_group option_group_gender ON (option_group_gender.name = 'gender') LEFT JOIN civicrm_option_value gender ON (contact_a.gender_id = gender.value AND option_group_gender.id = gender.option_group_id)  WHERE  (  ( LOWER(gender.label) = 'male' AND  ( civicrm_email.email IS NOT NULL '' ) AND contact_a.contact_type IN ('Individual') )  )  AND (contact_a.is_deleted = 0)    [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''' ) AND contact_a.contact_type IN ('Individual') )  )  AND (contact_a.is_delete' at line 1]
    [to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="SELECT DISTINCT UPPER(LEFT(contact_a.sort_name, 1)) as sort_name  FROM civicrm_contact contact_a LEFT JOIN civicrm_email ON (contact_a.id = civicrm_email.contact_id AND civicrm_email.is_primary = 1)  LEFT JOIN civicrm_option_group option_group_gender ON (option_group_gender.name = 'gender') LEFT JOIN civicrm_option_value gender ON (contact_a.gender_id = gender.value AND option_group_gender.id = gender.option_group_id)  WHERE  (  ( LOWER(gender.label) = 'male' AND  ( civicrm_email.email IS NOT NULL '' ) AND contact_a.contact_type IN ('Individual') )  )  AND (contact_a.is_deleted = 0)    [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''' ) AND contact_a.contact_type IN ('Individual') )  )  AND (contact_a.is_delete' at line 1]"]
)

I can't seem to log in to the demo to test it out - I've been using demo and demo as username and password - so I can't replicate it there.

But I did go to the sandbox site and replicate the error there:

Code: [Select]

Sorry. A non-recoverable error has occurred.

DB Error: syntax error

Database Error Code: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''' ) AND contact_a.contact_type IN ('Individual') ) ) AND (contact_a.is_delete' at line 1, 1064

Return to home page.

Error Details:

Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -2
    [message] => DB Error: syntax error
    [mode] => 16
    [debug_info] => SELECT DISTINCT UPPER(LEFT(contact_a.sort_name, 1)) as sort_name  FROM civicrm_contact contact_a LEFT JOIN civicrm_email ON (contact_a.id = civicrm_email.contact_id AND civicrm_email.is_primary = 1)  LEFT JOIN civicrm_option_group option_group_gender ON (option_group_gender.name = 'gender') LEFT JOIN civicrm_option_value gender ON (contact_a.gender_id = gender.value AND option_group_gender.id = gender.option_group_id)  WHERE  (  ( LOWER(gender.label) = 'male' AND  ( civicrm_email.email IS NOT NULL '' ) AND contact_a.contact_type IN ('Individual') )  )  AND (contact_a.is_deleted = 0)    [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''' ) AND contact_a.contact_type IN ('Individual') )  )  AND (contact_a.is_delete' at line 1]
    [type] => DB_Error
    [user_info] => SELECT DISTINCT UPPER(LEFT(contact_a.sort_name, 1)) as sort_name  FROM civicrm_contact contact_a LEFT JOIN civicrm_email ON (contact_a.id = civicrm_email.contact_id AND civicrm_email.is_primary = 1)  LEFT JOIN civicrm_option_group option_group_gender ON (option_group_gender.name = 'gender') LEFT JOIN civicrm_option_value gender ON (contact_a.gender_id = gender.value AND option_group_gender.id = gender.option_group_id)  WHERE  (  ( LOWER(gender.label) = 'male' AND  ( civicrm_email.email IS NOT NULL '' ) AND contact_a.contact_type IN ('Individual') )  )  AND (contact_a.is_deleted = 0)    [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''' ) AND contact_a.contact_type IN ('Individual') )  )  AND (contact_a.is_delete' at line 1]
    [to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="SELECT DISTINCT UPPER(LEFT(contact_a.sort_name, 1)) as sort_name  FROM civicrm_contact contact_a LEFT JOIN civicrm_email ON (contact_a.id = civicrm_email.contact_id AND civicrm_email.is_primary = 1)  LEFT JOIN civicrm_option_group option_group_gender ON (option_group_gender.name = 'gender') LEFT JOIN civicrm_option_value gender ON (contact_a.gender_id = gender.value AND option_group_gender.id = gender.option_group_id)  WHERE  (  ( LOWER(gender.label) = 'male' AND  ( civicrm_email.email IS NOT NULL '' ) AND contact_a.contact_type IN ('Individual') )  )  AND (contact_a.is_deleted = 0)    [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''' ) AND contact_a.contact_type IN ('Individual') )  )  AND (contact_a.is_delete' at line 1]"]
)

It does seem to work ok in both places when I choose

Individual     Email    !=  

Is this a bug?  Or am I using the search incorrectly?  As far as I can remember, it worked in previous versions...
[/code][/code]

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: Error in Search?
August 02, 2010, 09:34:11 am

i fixed the demo, so you can now try there

I dont think we've modified search builder in the recent past (other than a few bug fixes). if this issue is important to you, please consider investigating and submitting a patch that fixes the problem. If you are not a developer, consider hiring someone from http://civicrm.org/professional/

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

vshura

  • I post occasionally
  • **
  • Posts: 59
  • Karma: 1
  • CiviCRM version: 4.6.0
  • CMS version: Wordpress 4.1.1
Re: Error in Search?
August 12, 2010, 07:55:00 am
Hi lobo,

Apologies for the delay in replying to you.

On the demo, if you try a search builder

Individuals -> Email -> IS NULL ->

or

Individuals -> Email -> IS NOT NULL ->

you will get an error.  Surely this is an error?  It seems something that would be used from time to time, to see how many people are on a mailing list, for example...  As I've said, you can use work-around

Individuals -> Email !=

but 'IS NOT NULL' seems to be more elegant.  I'll submit it to the JIRA Page.

VS


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: Error in Search?
August 12, 2010, 08:03:54 am

thanx for filing the issue

if you can check the code and file a patch that fixes the issue, that would be great and ensure the fix is made for 3.2.2

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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Error in Search?

This forum was archived on 2017-11-26.