Author Topic: DB syntax error when running gift aid report  (Read 2551 times)

Offline Chelcone

  • I post occasionally
  • **
  • Posts: 82
  • Karma: 1
  • CiviCRM version: 3.4.0
  • CMS version: Drupal 6.*
  • MySQL version: MySQL 5.*
DB syntax error when running gift aid report
« on: October 07, 2011, 01:08:59 am »
Hi Everyone.

I have just managed to solve the issue with my gift aid module and the update for CiviCRM comes out for 3.4.6 so i tested it on my test server worked ok, didnt check the gift aid module module though. I went to run the Gift Aid batch and got to the point of confirming the results and creating the batch and got this error:

Code: [Select]
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 's Ford EASTLEIGH, SO53 5RT ', 'SO53 5RT', 55.00, 13.75)' at line 3, 1064
Additional Details:

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

    [code] => -2
    [message] => DB Error: syntax error
    [mode] => 16
    [debug_info] => REPLACE INTO civicrm_value_gift_aid_submission
(entity_id, eligible_for_gift_aid, name, address, post_code, amount, gift_aid_amount)
VALUES (48172, 1, 'Mrs. Patricia Grant', '3 Maytree Road
Chandler's Ford
EASTLEIGH, SO53 5RT
',
       'SO53 5RT', 55.00, 13.75) [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 's Ford
EASTLEIGH, SO53 5RT
',
       'SO53 5RT', 55.00, 13.75)' at line 3]
    [type] => DB_Error
    [user_info] => REPLACE INTO civicrm_value_gift_aid_submission
(entity_id, eligible_for_gift_aid, name, address, post_code, amount, gift_aid_amount)
VALUES (48172, 1, 'Mrs. Patricia Grant', '3 Maytree Road
Chandler's Ford
EASTLEIGH, SO53 5RT
',
       'SO53 5RT', 55.00, 13.75) [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 's Ford
EASTLEIGH, SO53 5RT
',
       'SO53 5RT', 55.00, 13.75)' at line 3]
    [to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="REPLACE INTO civicrm_value_gift_aid_submission
(entity_id, eligible_for_gift_aid, name, address, post_code, amount, gift_aid_amount)
VALUES (48172, 1, 'Mrs. Patricia Grant', '3 Maytree Road
Chandler's Ford
EASTLEIGH, SO53 5RT
',
       'SO53 5RT', 55.00, 13.75) [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 's Ford
EASTLEIGH, SO53 5RT
',
       'SO53 5RT', 55.00, 13.75)' at line 3]"]
)

Can anyone tell me what this means?

Thank you

Chel
« Last Edit: October 07, 2011, 01:23:02 am by Chelcone »

Offline Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 14732
  • Karma: 440
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: DB syntax error when running gift aid report
« Reply #1 on: October 07, 2011, 07:46:48 am »

Seems like the query does not use civicrm parameters to escape Strings etc

giftaid is a community contributed and supported module. Would be great if you can investigate and figure out a patch for this issue. Should be a fairly easy project to get into.

Ping us on IRC if u have any questions / need help getting started

lobo
Found this reply helpful? Contribute NOW and help improve CiviCRM with the Make it Happen! initiative.

Offline Chelcone

  • I post occasionally
  • **
  • Posts: 82
  • Karma: 1
  • CiviCRM version: 3.4.0
  • CMS version: Drupal 6.*
  • MySQL version: MySQL 5.*
Re: DB syntax error when running gift aid report
« Reply #2 on: October 07, 2011, 08:02:11 am »
I have no experience coding. I have a very very limited knowledge of PHP.

I have sent a message to Michael McAndrew to see if he knows anything because a lot of charities that are UK based and use that module are going to run into issues. This is an issue directly with CiviCRM version 3.4.6 and this module. Anyone that does the upgrade is going to run into it. If I had the knowledge I would do it just to help everyone else out.

Chelcone

Offline Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 14732
  • Karma: 440
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: DB syntax error when running gift aid report
« Reply #3 on: October 07, 2011, 08:17:33 am »

i have patched it here:

http://svn.civicrm.org/tools/branches/v3.4/drupal/modules/civicrm_giftaid/GiftAid/Utils/Contribution.php

u can replace that file in your distribution or wait for the next release

there are other non-coding ways you can contribute and help improve civi. More ideas here:

http://en.flossmanuals.net/civicrm/civicrm-community/civicommunity/

lobo
Found this reply helpful? Contribute NOW and help improve CiviCRM with the Make it Happen! initiative.

Offline Chelcone

  • I post occasionally
  • **
  • Posts: 82
  • Karma: 1
  • CiviCRM version: 3.4.0
  • CMS version: Drupal 6.*
  • MySQL version: MySQL 5.*
Re: DB syntax error when running gift aid report
« Reply #4 on: October 10, 2011, 01:14:18 am »
Thank you lobo.

I replaced the file in the module where it says in the SVN link. and i get this error when i try and run the batch.

Code: [Select]
Sorry. A non-recoverable error has occurred.
is not of type String

Any ideas?

Thank you for helping with this.

Offline Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 14732
  • Karma: 440
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: DB syntax error when running gift aid report
« Reply #5 on: October 10, 2011, 06:10:35 am »

i fixed a bug in the new code. can u re-download the file and see if it works

lobo
Found this reply helpful? Contribute NOW and help improve CiviCRM with the Make it Happen! initiative.

Offline Chelcone

  • I post occasionally
  • **
  • Posts: 82
  • Karma: 1
  • CiviCRM version: 3.4.0
  • CMS version: Drupal 6.*
  • MySQL version: MySQL 5.*
Re: DB syntax error when running gift aid report
« Reply #6 on: October 10, 2011, 07:01:38 am »
Used the same link as above and i still got the same error  ???

Code: [Select]
Sorry. A non-recoverable error has occurred.
is not of type String

Offline Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 14732
  • Karma: 440
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: DB syntax error when running gift aid report
« Reply #7 on: October 10, 2011, 07:26:18 am »

sorry cant help anymore since we dont really use giftaid.

Would be great if someone using that module can take a look and figure out whats happening

lobo
Found this reply helpful? Contribute NOW and help improve CiviCRM with the Make it Happen! initiative.

Offline Chelcone

  • I post occasionally
  • **
  • Posts: 82
  • Karma: 1
  • CiviCRM version: 3.4.0
  • CMS version: Drupal 6.*
  • MySQL version: MySQL 5.*
Re: DB syntax error when running gift aid report
« Reply #8 on: October 10, 2011, 07:46:08 am »
is there a way of rolling back the database version? i have backups of the data but its since the upgrade. If i put the mysql files into a new server with the old version of Civi will the data still read?

Is there anyone we can pull in to look at this? i did message Michael who made the module but i have had no reply.

Offline Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 14732
  • Karma: 440
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: DB syntax error when running gift aid report
« Reply #9 on: October 10, 2011, 07:58:47 am »

Sorry, cant help here. Maybe someone else from the UK using the module will show up and be able to debug and patch

I think it will be a relatively easy thing to patch and fix

lobo
Found this reply helpful? Contribute NOW and help improve CiviCRM with the Make it Happen! initiative.

Offline myles

  • I post frequently
  • ***
  • Posts: 233
  • Karma: 11
Re: DB syntax error when running gift aid report
« Reply #10 on: January 23, 2012, 06:52:26 am »
I've been attempting to debug, but netbeans/xdebug is now hanging ("reporting error - unable to set watch on files in template_c" - though just why it is attempting to remains a mystery) - and so am I - hanging that is.

Offline Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 951
  • Karma: 42
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: DB syntax error when running gift aid report
« Reply #11 on: February 01, 2012, 09:33:09 am »
Hey there,

Wasn't just me that made this module.  Was a community effort inc. people from Circle Interactive, Millertech, core team and others.  If you can post more on the problems you are having others might be able to help...

Offline LindseyM

  • I post frequently
  • ***
  • Posts: 178
  • Karma: 5
  • CiviCRM version: 4.1.5
  • CMS version: Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3.6
Re: DB syntax error when running gift aid report
« Reply #12 on: February 03, 2012, 06:46:25 am »
We're looking into using the Gift Aid module later this year.  Please can someone let me know if it's set up to work with Drupal 7?  Thanks.

Offline Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 14732
  • Karma: 440
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: DB syntax error when running gift aid report
« Reply #13 on: February 03, 2012, 07:38:47 am »

GiftAid is currently in a state of limbo, both the D6 version. Dont think anyone has ported it to D7 (which should be a minor task, IMO)

As i mentioned in another forum topic, it would be nice if a group of UK firms / orgs using GiftAid (hopefully other orgs than our normal suspects), would help support and maintain the module.

lindsey, care to lead that charge?

lobo
Found this reply helpful? Contribute NOW and help improve CiviCRM with the Make it Happen! initiative.

Offline LindseyM

  • I post frequently
  • ***
  • Posts: 178
  • Karma: 5
  • CiviCRM version: 4.1.5
  • CMS version: Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3.6
Re: DB syntax error when running gift aid report
« Reply #14 on: February 03, 2012, 09:50:34 am »
Hi lobo - will email you :)