Mysql warning syntax error when argument missing and « Use empty text » selected

goudal - April 3, 2008 - 08:12
Project:Views
Version:5.x-1.6
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

Well : I setup a view with one argument (I have tried either with vocabulary term or node id).
If I select : default page not found, everything is ok
If I select : use empty text, I have the following error :

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 'LEFT JOIN i18n_node i18n ON node.nid = i18n.nid WHERE (i18n.language ='fr' OR i' at line 1 query: pager_query LEFT JOIN i18n_node i18n ON node.nid = i18n.nid WHERE (i18n.language ='fr' OR i18n.language ='' OR i18n.language IS NULL) in /opt/www/htdocs/Drupal2/includes/database.mysql.inc on line 173.

It seems that in the views_build_view the call to
$query = db_rewrite_sql($info['query'], 'node');
when $info['query] is empty, does not return an empyt query.

I have just added a test :
if ($info['query']) {
$query = db_rewrite_sql($info['query'], 'node');
}

Well I guess that this is really a db_rewrite_sql problem which should NOT return bad queries :)

#1

mx16 - June 6, 2008 - 11:05

Thanks, it realy helped! I had similar problem, except warnings were not shown when I was logged in as first (and only) user.

#2

peashooter - June 19, 2008 - 14:11

I have exactly the same problem as mx16 and goudal

I'm filtering a view (with organic groups) and when I ask it to use 'empty text' it gives the above SQL error.

It doesn't give the warnings when logged in as first user.

How exactly do you fix this?

Cheers

#3

peashooter - June 20, 2008 - 14:55

cheers, just changed this is views.module

will this be incorporated into the next release?

 
 

Drupal is a registered trademark of Dries Buytaert.