5 star voting api view creates mysql error.

vitovonantwon - December 22, 2007 - 07:20
Project:Views
Version:5.x-1.6
Component:Views Data
Category:bug report
Priority:normal
Assigned:Unassigned
Status:duplicate
Description

I posted this in the 5 star module issue help section. But I'm thinking this could be a views issue. My reasoning.

The error happens only on pages with views. Other parts of the site remain unaffected. Basically I am using the 5 star module and voting api to display pages with content that is voting api average 50 or greater. Periodically, I check the site and there is a mysql error on the views page and or block. (on the forum page.) the site is www.nyclightwave.com

Below is the link to the other issue I created on the 5 star module. I'm now thinking this is actually a views issues.
I clear the error by, going to admin/module disable the 5 star module. Goto Views/tools/ clear cache. Re-enable the 5star module and it's ok. When the mysql error happens. If you go back to views and edit the TOPVOte view I created, the voting api is no longer a choice.

http://drupal.org/node/201161

#1

vitovonantwon - December 27, 2007 - 02:13

installed the development module. Clearing the cache also clears the mysql error.

Antonio

#2

vitovonantwon - January 3, 2008 - 23:04

user warning: 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 '>= '50') ORDER BY ASC LIMIT 0, 15' at line 1 query: SELECT DISTINCT(node.nid), value, node.title AS node_title, node.changed AS node_changed, votingapi_cache_vote_percent_average.value AS votingapi_cache_vote_percent_average_value FROM node node WHERE (node.status = '1') AND (.value >= '50') ORDER BY ASC LIMIT 0, 15 in /home/pojack1/public_html/learntheinternet/youcan/includes/database.mysql.inc on line 172

Ok I was able to reproduce this error on another site. I think I know what it is now.
The above error started to happen after I added a new category of "tags". I allowed it to use terms from forums and images.
After that, I started getting the mysql error.

So I think this error will happen if you do the following.

Install druapl 5.5
Modules:
5 star, voting api, views
create some content.
Rate it.
Create a view using the 5 star content to show only nodes that have a 50 or better score.
Mysql error happens in the block or view I named 'topvote'

here is the code exported from views.

$view = new stdClass();
$view->name = 'topvote';
$view->description = 'Posts are Listed in the order of Greatest Users Votes on Posts';
$view->access = array (
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = 'TopVotes';
$view->page_header = '';
$view->page_header_format = '4';
$view->page_footer = '';
$view->page_footer_format = '4';
$view->page_empty = '';
$view->page_empty_format = '4';
$view->page_type = 'list';
$view->url = 'TopVote';
$view->use_pager = TRUE;
$view->nodes_per_page = '30';
$view->block = TRUE;
$view->block_title = '';
$view->block_header = '';
$view->block_header_format = '4';
$view->block_footer = '';
$view->block_footer_format = '4';
$view->block_empty = '';
$view->block_empty_format = '4';
$view->block_type = 'list';
$view->nodes_per_block = '15';
$view->block_more = FALSE;
$view->block_use_page_header = FALSE;
$view->block_use_page_footer = FALSE;
$view->block_use_page_empty = FALSE;
$view->sort = array (
array (
'tablename' => 'votingapi_cache_vote_percent_average',
'field' => 'value',
'sortorder' => 'ASC',
'options' => '',
),
);
$view->argument = array (
);
$view->field = array (
array (
'tablename' => 'node',
'field' => 'title',
'label' => '',
'handler' => 'views_handler_field_nodelink',
'options' => 'link',
),
array (
'tablename' => 'votingapi_cache_vote_percent_average',
'field' => 'value',
'label' => '',
'handler' => 'fivestar_views_value_display_handler',
),
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),
array (
'tablename' => 'votingapi_cache_vote_percent_average',
'field' => 'value',
'operator' => '>=',
'options' => '',
'value' => '50',
),
);
$view->exposed_filter = array (
);
$view->requires = array(votingapi_cache_vote_percent_average, node);
$views[$view->name] = $view;

#3

catch - January 9, 2008 - 20:24
Status:active» duplicate

This looks related to: http://drupal.org/node/197895

#4

vitovonantwon - January 12, 2008 - 06:09

This isn't related. The problem started in 5.1 I upgraded to 5.5 to see if the problem went away.

#5

vitovonantwon - January 12, 2008 - 06:21

The problem didn't start happening until I added a category called tags.

Using these module:
Views 5.x-1.6
Views Bonus Pack 5.x-1.1
Views Tabs 5.x-1.x-dev (2007-Aug-08)
Voting API 5.x-1.5
Token 5.x-1.9
Fivestar 5.x-1.11-beta2

Also to replicate the problem Try this.
Goto Admin/category Add in a category of tags. Then allow these settings.

On my other site I didn't get any errors until I added this Admin/category. Tags.

I enabled several Types like forum and image.
Hierarchy:Multiple
Enabled:
Related terms
Free tagging
Multiple select

The problem only occors on the views pages.
View export located here: http://drupal.org/node/201161

After that I the view stopped working. I would reset the cache and the error goes away.
But adding new content, or editing older content would cause the problem again.

Hope that helps.
Antonio

#6

vitovonantwon - January 18, 2008 - 12:34

This is a voting api problem.

patch here.
http://drupal.org/node/189311

 
 

Drupal is a registered trademark of Dries Buytaert.