Download & Extend

Missing curlies around table names and query style (inner joins)

Project:Similar Nodes
Version:5.x-1.1
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:needs review

Issue Summary

Curly brackets have been left out at line 137. Critical bug that could wreck multi-site installs.

137c137
< $build_q = 'INSERT INTO {similarnodes} (nid,tid,weight) SELECT n.nid, tn.tid, "%d" as weight FROM node n , term_node tn , term_data dt WHERE n.nid = tn.nid AND tn.tid = dt.tid AND dt.vid = %d';
---
> $build_q = 'INSERT INTO {similarnodes} (nid,tid,weight) SELECT n.nid, tn.tid, "%d" as weight FROM {node} n , {term_node} tn , {term_data} dt WHERE n.nid = tn.nid AND tn.tid = dt.tid AND dt.vid = %d';

Comments

#1

Title:Missing curlies around table names» Missing curlies around table names and query style (inner joins)
Status:active» needs review

Here's a patch to fix this and also to fix the query style. Drupal standard is to use "INNER JOIN" instead of doing joins inside of the WHERE clause.

AttachmentSize
286627_similarnodes_curlies_sql_style.patch 1.12 KB

#2

+1

Though the patch is missing curlies on term_data :)

nobody click here