When calling Visitors Location Map with admin/reports/visitorinfo I am getting a red error message like that one ....
"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 'WHERE (n.language ='en' OR n.language ='' OR n.language IS NULL) LIMIT 0, 200' at line 1 query: SELECT * FROM visitorinfo order by csid desc WHERE (n.language ='en' OR n.language ='' OR n.language IS NULL) LIMIT 0, 200 in /home/jadajadajada/public_html/blablabla/sites/all/modules/visitorinfo/visitorinfo.module on line 75."
with the Visitors Location Map just underneath that read error message, but the map does not show a single visitor location .... and never changes this "Last 1 visitor locations." note just above the global map.
visitors are arriving at the site so that is not the problem ...
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | visitorinfo-issue-668042.patch.zip | 571 bytes | twooten |
| #3 | visitorinfo-issue#668042.patch.zip | 571 bytes | twooten |
| #1 | visitorinfo-issue#668042.patch | 776 bytes | twooten |
Comments
Comment #1
twooten commentedI believe that is due to my use (mis-use is probably more accurate), of the db_rewrite_sql() function. From what I have been able to determine, it is supposed to be used in circumstances such as when you are doing a node listing, when other conditions need to be tested as well. For instance, the node module modifies queries for node listings to filter nodes protected by access fields. So basically what that means is that you would use db_rewrite_sql() if you were producing a listing of nodes but some of those nodes should only be shown to certain users. db_rewrite_sql()'s usage would ensure that those access rules were observed.
I believe the particular error above is due to calling db_rewrite_sql() with the wrong number of arguments. Those arguments are apparently needed when certain other modules are actually performing a rewrite of the sql. But as I think about it, I realize that I do not need to use that function, a simple db_query_range() would work just fine. The documentation for the database abstraction layer says regarding db_rewrite_sql() 'Use it for listing queries'. That's not what I am doing. db_query_range() is better suited since it 'runs a limited-range query in the active database'.
I was able to recreate an error very similar on another site. Applying this patch seemed to clear up the problem.
Comment #2
bavarian commentedis it just me post-christmas-drunk to experience this patch as weird, as a link to drupal-main-site ?
or is there a textfile behind this patch-link or not ?
thanks for your attempt anyway ....
Comment #3
twooten commentedAwesome... I uploaded a .patch file. Let's try again with a .zip
Ok, nope that didn't work either. Something I should know about uploading files here?
Tim
Comment #4
bavarian commentedWeird ... but there is no rush !
Comment #5
twooten commentedComment #6
twooten commentedthere we go. It was the '#' in the name. I should have known.
Comment #7
bavarian commentedwill check file later on ... managed to d-load it now !
thank you !
Comment #8
bavarian commentedoh ... it made a biiiiiig difference. on a first glance your patch did the trick and things seem to work the way they are supposed to work !
thank you !
Comment #9
dave reidI think actually you just need to use capital letters with your SQL commands (order by csid desc vs ORDER BY csid DESC). But yes, you should not be using db_rewrite_sql() unless you know that it's a query that should be using it (like on nodes, taxonomy terms, etc).
Comment #10
twooten commentedComment #11
twooten commented