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

Dennis Daupert ddaupert at gmail.com
Fri Apr 24 14:12:51 GMT 2009


On Fri, Apr 24, 2009 at 9:42 AM, Rob Kinyon <rob.kinyon at gmail.com> wrote:

>
> That second query is most certainly NOT what you want. That would be a
> cartesian join - bad stuff. DBIC's query is doing exactly the right
> thing based on your relationships and what I can figure from your
> description. At this point, I'm willing to bet that your data isn't
> what you think it is. Specifically, that files 2036 and 2033 aren't
> associated with documents belonging to project 94. In other words, the
> subroutine coming up with 2033 and 2036 is broken somehow.
>

I hope you didn't bet too much :-) Here are entries from my three tables:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
sqlite> select * from docs where project_id =3D 94;
825|94|Installation Manual|Installation Manual Summary|1|
826|94|Installation Manual|upload test 4|1|
827|94|Installation Manual|make_full_upload_path test|1|
828|94|Installation Manual|quick upload test|1|
829|94|Configuration Guide|Configuration Guide Summary|1|
830|94|Configuration Guide|Configuration Guide Summary|1|
831|94|Configuration Guide|Configuration Guide Summary|1|
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
sqlite> select * from files where project_id =3D 94;
2030|94|825|Start_Here|Installation_Manual.draft0.doc|
2031|94|826|Start_Here|Installation_Manual.draft1.doc|
2032|94|827|Start_Here|Installation_Manual.draft2.doc|
*2033|94|828|Start_Here|Installation_Manual.draft3.doc|*
2034|94|829|Configuration|Configuration_Guide.draft0.doc|
2035|94|830|Configuration|Configuration_Guide.draft1.doc|
*2036|94|831|Configuration|Configuration_Guide.draft2.doc|*
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
sqlite> select * from doc_files where file_id >=3D 2030;
825|2030
826|2031
827|2032
828|2033
829|2034
830|2035
831|2036
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

The subroutine that came up with 2033 and 2036 is correct;
given the data, there are only two files in the data set whose
data I want to display on the final template. I'm just a bit lost
on how to get there.

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


More information about the DBIx-Class mailing list