[Dbix-class] JOIN question

Bernhard Graf dbic2 at augensalat.de
Tue Nov 28 17:16:26 GMT 2006


/me wrote:

> Anthony Hinsinger wrote:
> > { table1.key => { '!=' => table2.key } }

> Anthony, you are right.

Sorry Anthony, I must correct myself - you are not right.

The above form indeed fails to build a working SQL query, but if it 
would, it would probably not do what you want, because "table2.key" 
would be inserted verbatim:

  table1.key != "table2.key"

> For the moment { 'table1.key' => \'!=table2.key' } does the job.

So this is actually the only valid way to compare two fields in the 
from-attribute.

The question still is how to modify the code to support constant values 
to express something like

  { 'table1.key' => \'!=table2.key', 'table1.maximum => {'<', 23}}

that should result in

  table1.key != table2.key AND table1.maximum < "23"
-- 
Bernhard Graf



More information about the Dbix-class mailing list