[Dbix-class] Can I get help composing a query?

Dennis Daupert ddaupert at gmail.com
Fri Apr 24 13:11:53 GMT 2009


On Fri, Apr 24, 2009 at 4:40 AM, Peter Rabbitson
<rabbit+dbic at rabbit.us<rabbit%2Bdbic at rabbit.us>
> wrote:

>
> For starters search takes a reference as the first argument. So
> the above should be:
>
> ...->search ({ project_id =3D> $pr_id})->...
>
> The rest seems fine. Use $c->model ('HdeDB')->storage->debug (1)
> or DBIC_TRACE=3D1 to output the actual sql on STDERR - it will help a
> lot with figuring out what is going (or not) on.
>

Thanks for your help, Peter.

I get this STDERR output from the query I posted:

SELECT doc_files.doc_id, doc_files.file_id
FROM docs me
LEFT JOIN doc_files doc_files
ON ( doc_files.doc_id =3D me.id )
WHERE ( ( ( doc_id IN ( ?, ? ) )
AND ( project_id =3D ? ) ) ): '2036', '2033', '94'

That looks all wrong. I need something like this
(pseudo-sql coming up):

SELECT docs.* files.*
FROM docs, files
WHERE project_id =3D ?
AND doc_id IN ( ?, ? )

I hope that makes sense.

/dennis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20090424/512=
635b7/attachment.htm


More information about the DBIx-Class mailing list