Make KML module MySQL 4.0 compatible: rewrite queries without subqueries

maartenzam - May 25, 2007 - 19:33
Project:KML module
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi there,

I tried to get the KML module to work but I got 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 'SELECT l.eid FROM drupallocation l WHERE l.source != 0 AND l.ty query: SELECT n.nid, n.created FROM drupalnode n WHERE n.status = 1 AND n.vid IN (SELECT l.eid FROM drupallocation l WHERE l.source != 0 AND l.type = 'node' AND l.eid = n.vid) AND n.nid = 1 in /files/vitis-tct/www.florisla.be/maarten/drupal/includes/database.mysql.inc on line 172.

and the KMLs didn't contain latitude and longitude (see uploaded file)

I relogged in and the error message was gone, but the KML still doesn't contain lat/long.

I noticed a similar problem reported at http://drupal.org/node/132418, but the suggested solution (install latest version of location module) doesn't apply becaus I'm already running the latest versions (Drupal 5.1, location 5.x-1.x-dev, KML 5.x-1.x-dev).

Any suggestions? Thanks

PS: can I do something about the strange date and time of this post?

AttachmentSize
nodes_0.txt199 bytes

#1

maartenzam - May 25, 2007 - 19:35

I'm sorry, please don't mind my PS. Stupid mistake...

#2

maartenzam - July 30, 2007 - 01:41

I found out what caused the error. The kml-module uses a sql-query with a subquery to get the nodes with location data:

$nodes = db_query("SELECT n.nid, n.created FROM {node} n WHERE n.status = 1 AND n.vid IN (SELECT l.eid FROM {location} l WHERE l.source != 0 AND l.type = 'node' AND l.eid = n.vid) AND n.nid = %d", $b);

And the mysql on my webserver is version 4.0.25 and subqueries are only supported since version 4.1. Has anyone any idea how I could rewrite the query without using the subquery?

Thanks

#3

maartenzam - July 30, 2007 - 01:46
Title:Unknown column 'l.eid' and no coordinates in .kml files BIS» SQL syntax error: rewrite query without subquery requested

Changed the title to a more appropriate one.

#4

geodaniel - September 10, 2008 - 11:43
Title:SQL syntax error: rewrite query without subquery requested» Make KML module MySQL 4.0 compatible: rewrite queries without subqueries
Version:5.x-1.x-dev» 6.x-1.x-dev
Category:support request» feature request
Assigned to:maartenzam» Anonymous
 
 

Drupal is a registered trademark of Dries Buytaert.