Details
- 
    Type:
Bug
 - 
    Status: Done/Fixed
 - 
    Priority:
Major
 - 
    Resolution: Fixed/Completed
 - 
    Affects Version/s: 1.7
 - 
    Fix Version/s: 1.7
 - 
    Component/s: Core CiviCRM
 - 
    Labels:None
 
Description
When synchronizing CiviCRM with Drupal user base, I receive the following error:
Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )
    [code] => -2
    [message] => DB Error: syntax error
    [mode] => 16
    [debug_info] => 
SELECT    civicrm_contact.id as contact_id,
          civicrm_contact.domain_id as domain_id,
          civicrm_contact.hash as hash,
          civicrm_contact.contact_type as contact_type,
          civicrm_contact.contact_sub_type as contact_sub_type
FROM      civicrm_contact
LEFT JOIN civicrm_location ON ( civicrm_location.entity_table = 'civicrm_contact' AND
                                civicrm_contact.id  = civicrm_location.entity_id AND 
                                civicrm_location.is_primary = 1 )
LEFT JOIN civicrm_email    ON ( civicrm_location.id = civicrm_email.location_id   AND civicrm_email.is_primary = 1    )
WHERE     civicrm_email.email = 'nancy.o'regan@nscc.ca' AND civicrm_contact.domain_id = 1 [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 'regan@nscc.ca' AND civicrm_contact.domain_id = 1' at line 11]
    [type] => db_error
    [user_info] => 
SELECT    civicrm_contact.id as contact_id,
          civicrm_contact.domain_id as domain_id,
          civicrm_contact.hash as hash,
          civicrm_contact.contact_type as contact_type,
          civicrm_contact.contact_sub_type as contact_sub_type
FROM      civicrm_contact
LEFT JOIN civicrm_location ON ( civicrm_location.entity_table = 'civicrm_contact' AND
                                civicrm_contact.id  = civicrm_location.entity_id AND 
                                civicrm_location.is_primary = 1 )
LEFT JOIN civicrm_email    ON ( civicrm_location.id = civicrm_email.location_id   AND civicrm_email.is_primary = 1    )
WHERE     civicrm_email.email = 'nancy.o'regan@nscc.ca' AND civicrm_contact.domain_id = 1 [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 'regan@nscc.ca' AND civicrm_contact.domain_id = 1' at line 11]
    [to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="
SELECT    civicrm_contact.id as contact_id,
          civicrm_contact.domain_id as domain_id,
          civicrm_contact.hash as hash,
          civicrm_contact.contact_type as contact_type,
          civicrm_contact.contact_sub_type as contact_sub_type
FROM      civicrm_contact
LEFT JOIN civicrm_location ON ( civicrm_location.entity_table = 'civicrm_contact' AND
                                civicrm_contact.id  = civicrm_location.entity_id AND 
                                civicrm_location.is_primary = 1 )
LEFT JOIN civicrm_email    ON ( civicrm_location.id = civicrm_email.location_id   AND civicrm_email.is_primary = 1    )
WHERE     civicrm_email.email = 'nancy.o'regan@nscc.ca' AND civicrm_contact.domain_id = 1 [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 'regan@nscc.ca' AND civicrm_contact.domain_id = 1' at line 11]"]
)