Make KML module MySQL 4.0 compatible: rewrite queries without subqueries
| Project: | KML module |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
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?
| Attachment | Size |
|---|---|
| nodes_0.txt | 199 bytes |

#1
I'm sorry, please don't mind my PS. Stupid mistake...
#2
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
Changed the title to a more appropriate one.
#4