Do not allow invalid table alias in views integration

gerd riesselmann - June 27, 2007 - 11:52
Project:Voting API
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:won't fix
Description

The views integration builds table alias by concatenating the table name, the voting tag and the voting type. However, the voting tag may contain characters not allowed in table alias, like ":". This causes the views created to fail for obvious reasons, see http://drupal.org/node/140334.

The patch attached will strip off all non-word-characters from a table alias.

Attention: The patch attached will invalidate all recent views that contain votingapi related fields! As there is no regular expression replace in MySQL, it's difficult to update the DB. Depending on which modules are affected, one can try a char by char replacement:

UDPATE view_tablefield SET tablename = REPLACE(tablename, ':', '');
UDPATE view_tablefield SET tablename = REPLACE(tablename, ' ', '');

AttachmentSize
vapi_views_tablenames.patch964 bytes

#1

gerd riesselmann - June 27, 2007 - 11:55
Status:active» patch (code needs review)

#2

Paintbox - July 19, 2007 - 09:18

As I want to subscribe to this issue I am posting here. Any devs working on Voting API ?

#3

Eaton - June 6, 2008 - 00:28
Status:patch (code needs review)» won't fix

VotingAPI 1.x's views integration is rather jacked up, inherently. I'm very hesitant to pour more work into it as 2.x only fixes the issues by relying on more flexible Views 2 API features.

If anyone's interested in working on a backport of some of the new approaches from the Drupal 6 version, or in working on a 'better' implementation of Views integration for Drupal 5, please contact me directly; I'm interested in a co-maintainer.

 
 

Drupal is a registered trademark of Dries Buytaert.