[development] Making a whole site location aware - a design question

Scott McLewin drupal at mclewin.com
Wed Aug 23 07:01:57 UTC 2006


Dave Cohen wrote:
> On Monday 21 August 2006 23:15, Scott McLewin wrote:
>> I've run into a condition where my nodes with
>> locative data filter exactly as I want them to based on location, but
>> nodes without locative data don't show up (I know why - it is because I
>> INNER JOINED them with the location table, which yields no result).
> Have you tried the following?
> $return['where'] = "a.longitude IS NULL OR your_where_clause_here";
Yes, but in looking back it didn't work because when I tried it I still 
had an inner join.  Switching to a LEFT OUTER JOIN got me up and 
running.  My bad for working with a bleary brain.

> Finally, I recommend you don't alias {location} to 'a'.  It's really not a 
> descriptive abbreviation, and likely to cause conflicts with some other 
> hook_db_rewrite_sql eventually.  Why not use 'location' and never have to 
> worry about that?
I picked "a" because that is what the location module uses for an alias 
to {location} and because I was unsure if I had to use "standard 
practice table names" within the hook_db_rewrite_sql.  I've convinced 
myself that I don't and have changed to a far-less-likely-to-conflict 
alias name.

Thanks a bunch for the suggestion on hook_db_rewrite_sql.  The 
documentation and threads on it that I'd found never quite made it clear 
why I'd use it.  A run at testing my site's logic with the location 
specific filtering in place looks good.


More information about the development mailing list