I get this error when using field_attach_update():

PDOException: SQLSTATE[42000]: Syntax error or access violation: 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 ')' at line 1:

INSERT INTO {field_data_field_event_link} (entity_type, entity_id, revision_id, bundle, delta, language, field_event_link_url, field_event_link_title, field_event_link_attributes) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, ); Array
(
    [:db_insert_placeholder_0] => node
    [:db_insert_placeholder_1] => 302
    [:db_insert_placeholder_2] => 302
    [:db_insert_placeholder_3] => event
    [:db_insert_placeholder_4] => 0
    [:db_insert_placeholder_5] => und
    [:db_insert_placeholder_6] => http://google.com
    [:db_insert_placeholder_7] => Google
)

in field_sql_storage_field_storage_write() (line 426 of /Users/tim/www/d7/modules/field/modules/field_sql_storage/field_sql_storage.module).

I think this is related to attributes being an array. This caused other issues over here as well: #1053820: Upgrade from link module 7.x-1.0-alpha2 to -alpha3 causes persistent error messages.

Comments

jcfiala’s picture

Status: Active » Postponed (maintainer needs more info)

Can you give me more information on what you were doing, and how to reproduce this error?

tim.plunkett’s picture

No clue what I was doing, that's my fault for filing a poor bug report. I'm going to leave this postponed in case I can replicate it, otherwise I'll close it in a week or so.

sachbearbeiter’s picture

subscribe

sachbearbeiter’s picture

http://drupal.org/node/1194694 here is a reference to this issue

dqd’s picture

Priority: Major » Normal
Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

can't reproduce the issue with latest dev. From maintainer requested info didn't arrive since 2 months. I close the issue. If somebody can reproduce it and can give more details how the issue occurs, feel free to reopen it.

chrsnlsn’s picture

Hello I am getting an error that I feel is related It is an ajax error and looks like this
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /system/ajax
StatusText: Service unavailable (with message)
ResponseText: PDOException: SQLSTATE[42000]: Syntax error or access violation: 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 ')' at line 1: INSERT INTO {field_data_field_test_link} (entity_type, entity_id, revision_id, bundle, delta, language, field_test_link_url, field_test_link_title, field_test_link_attributes) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, ); Array
(
[:db_insert_placeholder_0] => node
[:db_insert_placeholder_1] => 6973
[:db_insert_placeholder_2] => 6972
[:db_insert_placeholder_3] => test_type
[:db_insert_placeholder_4] => 0
[:db_insert_placeholder_5] => und
[:db_insert_placeholder_6] => http://google.com
[:db_insert_placeholder_7] => http://google.com
)
in field_sql_storage_field_storage_write() (line 448 of /path/modules/field/modules/field_sql_storage/field_sql_storage.module).

It occurs only when I have a cck link field in a node that is being Fivestar rated. I came across this discussion
http://drupal.org/node/1330952
where it looks like they decided contrib modules needed to clean the data before calling a function such as
field_attach_update($entity_type, $entity);

I'm guessing the cleanup in my case would be in the Fivestar rating module before this function is called? If this is the case can you point me in the right direction as to what exactly I need to do to the field prior to the
field_attach_update() call?
Thanks

ericduran’s picture

Status: Closed (cannot reproduce) » Active

I'm opening this back up.

In fivestar this is an issue when used with the link module. We used to manually call field_attach_update on the entity but over at #1393812: AJAX / SQL error - one solution I ended up unsetting everything except my field which had more issues that it solved.

I'll look into the core and this issue.

ericduran’s picture

Category: bug » support
Status: Active » Fixed

Actually after looking into this, I realized this is not a bug report and actually should be categorized as a Support request.

Also marking this as fixed.

In short if you manually decided to call field_attach_update make sure to also call field_attach_presave since it's the same process core does, and Link module actually adds some defaults in there.

Sorry for the noise.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.