Re: Query problem!

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Feb 17 2003 - 23:08:43 EST

  • Next message: Brandon Fouts\(Home\): "Fw: command-line tutorial not working in 1.0a6 and 1.0a5"

    Michael Schuldt wrote:
    > Hi Andrus,
    >
    > thanks for your answer.
    >
    > What else can I do, if I want to create a statement to read a result set of
    > objects and the objects are dependent on relations AND internal Attributes?
    > I think this is an ordinary case.
    > I like to get the list of objects by a single query because I like to use
    > the paged queries through "setPageSize". But if I split the query in two or
    > more seperate queries, I can't.
    >
    > Maybe there's another solution or is my task wrong?
    >

     From the SQL standpoint, the solution would be to use UNIONs. According
    to MySQL docs, UNIONs are supported from 4.0.0:

    http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#UNION

    Unfortunately currently Cayenne doesn't directly support UNION queries
    (though it should be rather starightforward to add). So for now now you
    will have to use Cayenne's SqlSelectQuery for this and use raw SQL :-(.

    On the positive side, SqlSelectQuery supports paginated queries, just
    like a regular SelectQuery would.

    Andrus



    This archive was generated by hypermail 2.0.0 : Mon Feb 17 2003 - 23:09:32 EST