Download & Extend

Bug is probably in event upgrade script

Project:Flexinode
Version:4.6.x-1.x-dev
Component:Code
Category:bug report
Priority:minor
Assigned:Unassigned
Status:active

Issue Summary

This issue has appeared mostly for people upgrading to the new event system, and it's not evident at first that the problem is flexinode but I'm pretty sure it is:

http://drupal.org/node/20658

When I look at a flexinode event I see no content other than the event API start and end dates. It also generates an error in watchdog resembling this:

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 'FROM node n LEFT JOIN flexinode_data flexinode_5 ON n.nid = fle query: SELECT flexinode_5.textual_data AS flexinode_5, flexinode_2.textual_data AS flexinode_2, flexinode_3.textual_data AS flexinode_3, flexinode_4.textual_data AS flexinode_4, flexinode_4.numeric_data AS flexinode_4_format, FROM node n LEFT JOIN flexinode_data flexinode_5 ON n.nid = flexinode_5.nid AND flexinode_5.field_id = 5 LEFT JOIN flexinode_data flexinode_2 ON n.nid = flexinode_2.nid AND flexinode_2.field_id = 2 LEFT JOIN flexinode_data flexinode_3 ON n.nid = flexinode_3.nid AND flexinode_3.field_id = 3 LEFT JOIN flexinode_data flexinode_4 ON n.nid = flexinode_4.nid AND flexinode_4.field_id = 4 LEFT JOIN flexinode_data flexinode_1 ON n.nid = flexinode_1.nid AND flexinode_1.field_id = 1 WHERE n.nid = 139 in /home/gdelisle/public_html/includes/database.mysql.inc on line 66.

What's invalid about this query is the select, which is built when flexinode_load calls flexinode_invoke('db_select', $field); I traced it from there to the include files, but I wasn't able to think my way to a valid SQL call so I'm not able to solve the problem.

Marked as critical because this effectively breaks the event system.

Comments

#1

Title:Flexinode_load producing invalid sql query through flexinode_invoke» Bug is probably in event upgrade script
Priority:critical» minor

Upon further investigation I've found that I can get flexinodes to work and display properly when I create new types, but the ones created by the event_upgrade.php do not work. Decreasing severity but leaving it here because it's still a problem that needs to be addressed, though perhaps it's more of an event module issue.

#2

I've looked into the problem and it looks like the event upgrade script tries to treat the 'title' field as a flexinode field.

-Ankur

#3

The upgrade script tries to treat the title field as a flexinode field. Upgrading a 4.5 installation to 4.6, I got the following when querying the flexinode_field table:

+----------+----------+-------------+---------------+------------+-------------------+
| field_id | ctype_id | label           | default_value | field_type | options           |
+----------+----------+-------------+---------------+------------+-------------------+
|        1  |        1      |                 |                     |               | a:1:{i:0;s:0:"";}   |
|        2  |        1      | description |                     | textarea   |                       |
+----------+----------+-------------+---------------+------------+-------------------+

where ctype_id = 1 identifieds the flexinode for event.

My way of remedying the problem has been to query for the ctype_id where name = 'event' from the {flexinode_type} table and then using that ctype_id to do a delete from the flexinode_field table where label = ''.

-Ankur

#4

Hi Ankur,

I'm having the same problem with event.module...(I just upgraded from 4.5. to 4.6. and none of the events are showing).

I'm not sure how to implement what you just said..is there an SQL query that has to be run on the database?

Dub

#5

What I did was I ran the update and then, afterward, I logged into the mysql prompt and ran the query

DELETE FROM flexinode_field WHERE label = '';

The problem is that the event upgrade script tries to map *all* the fields of an event from forms.module fields to flexinode.module fields. Unfortunately, this also includes the standard node.module 'title' field. Because there is no other forms.module or flexinode.module field information associated with the 'title' field, flexinode gets confused in its query generation and at some point tries to turn a blank array entry into a part of a query. I don't exactly remember the exact details, but that blank field is the fault of flexinode thinking that the 'title' field is flexinode field, so the call to explode() (or whatever generates the query) ends up inserting an extra comma in the list of selected fields or something.

The query above should really be a part of the update (or better, the appropriate function in the update script should check to see if the current field being mapped from the event module forms.module field to the flexinode.module field is not named 'title').

-Ankur

nobody click here