Hi,

On Jul 19, 2007, at 11:55 AM, Jon Schutz wrote:


Why do you need it to be in the join? whats the difference between:

ph_topics me LEFT JOIN ph_watchers watchers ON ( watchers.topic_id =
me.id AND watchers.user_id = ? )

and

ph_topics me LEFT JOIN ph_watchers watchers ON ( watchers.topic_id =
me.id ) WHERE watchers.user_id = 5


First case produces a result row for every row in ph_topics.

Second case produces a result row only where watchers.user_id = 5.

One wonders though if the original poster wouldn't prefer the second
case.

No I want the first case. The watchers table has a row for each user/ topic that is being watched.

I want to know, for all topics in my query which ones are being watched.


In answer to the original question, I believe the parameter '5' could be
passed through as a bind variable; see

http://search.cpan.org/~mstrout/DBIx-
Class-0.08003/lib/DBIx/Class/Manual/ Cookbook.pod#Arbitrary_SQL_through_a_custom_ResultSource

hmms.. I'll have to experiment.

Thanks for the tip.

Best regards,
--
Pedro Melo
Blog: http://www.simplicidade.org/notes/
XMPP ID: [EMAIL PROTECTED]
Use XMPP!



_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to