[Dbix-class] Problems with DBIx:: and SQL JOIN's
Peter Rabbitson
rabbit+dbic at rabbit.us
Mon Jun 8 17:46:09 GMT 2009
Tommy Butler wrote:
> Friends,
>
> I'm having serious pains getting DBIx::Class to JOIN on anything. I'm
> dealing with one situation in particular, but my problems are not
> limited to this. I'd like to learn how to fix this one problem so I can
> go on to fix others. In the description of my problem I will provide
> the SQL query (which works), the DBIx::Class code call (which doesn't
> work), and the schemata that correctly correspond to my database tables.
>
> Could someone provide some insight or a few lines of working code for
> the query I'm trying to make? Your help is so much appreciated. I am
> very confident that my attempts, including the example I provide here,
> are very far from correct.
>
> (The Problem) =================================================
> The query below seems very straightforward no? And yet in DBIx::Class
> it has become an insurmountable chore for me. I've spent more time
> fiddling around with this specific issue than I'd ever admit. Following
> the official documentation has only led to more and more confusion. =>(
> http://search.cpan.org/~ribasushi/DBIx-Class-0.08103/lib/DBIx/Class/Manual/Joining.pod#USING_JOINS
> ). I'm now asking for help at PerlMonks.org and on the DBIx::Class
> mailing list.
>
> (The Query) ==================================================
> select * from users join user_roles on (user_roles. user_id = id) join
> roles on (roles.id = role_id) where username like '%foo%';
>
> (The Perl Code) =================================================
> #You may well note from my code below that my use of DBIx::Class is
> through the Catalyst framework.
> # The code below fails with a very long stack trace which basically says
> that my SQL syntax is wrong.
^^ we need at least the beginning of this stack trace, so we can see what
the actual error is
More information about the DBIx-Class
mailing list