[development] db_rewrite_sql question
Jeremy Epstein
jazepstein at gmail.com
Wed Aug 16 02:04:45 UTC 2006
Hi Dave,
I think that you brought the 'cid' issue to my attention before. I am
willing to let 'cid' be changed to 'cat_id' or 'category_id', in order
to fix this problem. As far as I'm concerned, if a particular field
name is already 'taken' by a core module, then a contrib module (such
as category) should respect that.
Having said that, I believe there are examples of field name conflicts
even within core. For example, 'fid' is used both as 'file ID' (by the
'files' table), and as 'field ID' (by the 'profile_fields' table).
IMHO, the most sensible route to take is to accept that field name
conflicts are inevitable, and to make sure that db_rewrite_sql is able
to handle them (and to improve db_rewrite_sql if it can't handle
them).
Cheers,
Jaza.
On 8/16/06, Dave Cohen <drupal at dave-cohen.com> wrote:
> Nedjo,
>
> I was hoping it would not come to that. But it looks like the only solution
> that does not require changes in other people's modules. Thanks,
>
> -Dave
>
> On Tuesday 15 August 2006 15:33, Nedjo Rogers wrote:
> > > What's a module to do when it recieves two calls to hook_db_rewrite_sql;
> > > in
> > > both cases $primary_field is 'cid' and $primary_table is 'c', but in one
> > > case
> > > the query needs re-writing and in the other it does not?
> >
> > You could, awkwardly, test the full $query for your table's name and alias,
> > e.g.
> >
> > if (strstr($query, '{category} c')) {
> >
> > }
>
More information about the development
mailing list