Download & Extend

PDOException: SQLSTATE[42000] it seems that word 'range' is a keyword in some version of mysql

Project:Download Count
Version:7.x-3.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

The error message is as following:
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 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 'FROM download_count_cache download_count_cache WHERE (type = 'node') AND (id =' at line 1: SELECT date AS date, SUM(count) AS count, FROM_UNIXTIME(date, '%Y-%m') AS ranges, FROM_UNIXTIME(date, '%Y') AS FROM {download_count_cache} download_count_cache WHERE (type = :db_condition_placeholder_0) AND (id = :db_condition_placeholder_1) AND (fid = :db_condition_placeholder_2) GROUP BY ranges ORDER BY date DESC LIMIT 5 OFFSET 0

And it seems that word 'range' is a keyword in some version of mysql, and I change the 'range' to 'ranges' and now it works

Comments

#1

Status:active» fixed

nice catch! thanks for the issue. I fixed it by completely renaming 'range' to 'time_interval'.

http://drupalcode.org/project/download_count.git/commit/f19edfb

#2

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

#3

Hi WorldFallz,
I'm so glad that I helped improving this module, this is really nice module, thank you very much for your maintenance work!

nobody click here