Closed (fixed)
Project:
Documentation
Component:
Developer Guide
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
1 Feb 2006 at 09:00 UTC
Updated:
9 Nov 2006 at 00:20 UTC
I am not understanding the use of the drupal function db_rewite_sql.What is basically does.Can that functionality cannot be acheived bu db_query().
Comments
Comment #1
piersonr commentedI'm also unclear about this. I've searched the forums, and the only answer I could find was on the writing secure code page.
On the documentation for db_rewrite_sql it says:
Are "listing queries" any query where you will be outputting several nodes via pager_query?
If so, the db_rewrite_sql page should link to pager_query and vice versa, with an explanation of their relationship.
Comment #2
mcurry commented+1
Drupal experts, lend a hand!
When + why are we expected to use it?
Comment #3
pwolanin commentedthe answer depends on whether you are writing a snippet to put in a single page/block on your specific site, or whether you are writing core or contrib module code that's supposed to be generally usable.
In the first case, if you are not using any access control modules or similar to control who can see content, then it's probably not necessary (or even useful), but you may want to anyhow in case you install access control in the future.
In the latter case, you should use it essentially any time you are making a query, especially any content-related query (node, terms, comment, etc). The exception would be for queries doing internal module work but not showing any content to users (e.g. a cron task), or perhaps queries for administrative pages where the user is expected to already have full privileges and/or it is necessary to show an unfiltered list.
look through the core code and I think you'll get a sense of it.
Comment #4
mcurry commentedThank you - that's exactly what I wanted to know.
Comment #5
pwolanin commented