Re: "is null" qualifier not working in modeler

From: Gili (cowwo..bs.darktech.org)
Date: Fri Sep 09 2005 - 12:20:20 EDT

  • Next message: Gili: "Re: SelectQuery.queryWithParameters(ignoreMismatch)"

            Ah ha! Found it! It's a bug in the cached mapped query support again.
    DataContext line 1237, when we generate a new query we don't copy over
    the qualifier string. I've moved this email over to the dev list.

            The problem is that the code invokes select.createQuery() which
    constructs a new Query based upon the old one but defaults to
    pruneMissing = true... for some unknown reason, this strips away my
    qualifier. It is true it has no parameters, but none of them are bound
    parameters either, so I don't think it should be stripping them away. So
    that's one bug (I think) and I think there is also a second one in that
    that we shouldn't be using pruneMissing = true in the first place for
    constructing a cached SelectQuery based upon the original SelectQuery.
    The parameters before and after should match up 100% and if not we
    should throw an error.

    Gili

    Gili wrote:
    >
    > Well, I know that MySQL (which I use) expects "is null" but when I
    > enter this in modeler the field turns red (indicating invalid syntax)
    > and it rejects the value. So either this is a modeler bug or a Cayenne
    > one because I honestly don't see how I'm supposed to get this working :)
    > in-so-far as I'm concerned it would be great if I could consistently
    > enter "= null" in the modeler and Cayenne would translate it to the
    > appropriate syntax for me. Looking at the code, I'm pretty sure that's
    > sort of what it was meant to do.
    >
    > Gili
    >
    > Mike Kienenberger wrote:
    >
    >> Qualifier null handling is database-dependent.
    >> Some databases require "is null" and some require "= null" while some
    >> will accept both.
    >>
    >> You'd either have to explicitly choose the supported type for your
    >> query or (probably better) use "value = $nullValue" and set $nullValue
    >> to null in your use of the qualifier. That should allow Cayenne to
    >> correctly choose the right operator.
    >>
    >> On 9/9/05, Gili <cowwo..bs.darktech.org> wrote:
    >>
    >>> Hi,
    >>>
    >>> I've declared a SelectQuery in the modeler. The qualifier is
    >>> set to
    >>> "parent = null" where "parent" is a to-one relationship. Anyway, at
    >>> runtime with logging enabled I can see that "parent is null" is never
    >>> passed onto the SQL query, as a result I am getting results back where
    >>> the parent is non-null. I am invoking the query using:
    >>>
    >>> context.performQuery("DefaultTheme.getRoot", false);
    >>>
    >>> it does not take any parameters. I tried searching the mailing
    >>> list but
    >>> found no mention of this. Is my qualifier syntax wrong or is something
    >>> wrong with the modeler?
    >>>
    >>> Thank you,
    >>> Gili
    >>> --
    >>> http://www.desktopbeautifier.com/
    >>>
    >>
    >>
    >

    -- 
    http://www.desktopbeautifier.com/
    



    This archive was generated by hypermail 2.0.0 : Fri Sep 09 2005 - 12:20:20 EDT