Re: Expressions

From: Gary Jarrel (garyjarre..mail.com)
Date: Sat Mar 11 2006 - 00:34:23 EST

  • Next message: Tomi NA: "Re: reverse engineering a postgresql database: no relationships detected?"

    Thq query tempalte is created on the fly, using a Map containing
    attribute name and value pairs. I.e

        Key Value
    1. <sex> <male>
    2. <country> <{"Australia", "USA"}>

    It's for a generic AND search method. Hence the method loops through
    the entry set, building something like: x = Expression.fromString("sex
    = $sex and country = $country}. Then I use the
    x.expressionWithParameters(Map map) where "map" is the original map
    used to build the expression.

    It's not really that major of an issues, it's just something I tried
    out of interested, as most of my parameters are lists instead of
    arrays, and that approach works perfectly.

    Thank you!

    garyj

    On 3/4/06, Andrus Adamchik <andru..bjectstyle.org> wrote:
    > I need to check. How do you create an Expression for the original query?
    >
    > Andrus
    >
    > On Mar 4, 2006, at 3:29 AM, Gary Jarrel wrote:
    >
    > > Hello All Again!
    > >
    > > A quick one. Is it correct to assume that when you create a query with
    > > parameters, and you pass a List as one of the parameters, then it
    > > generates the IN clause, but the same doesn't apply when you pass an
    > > Array with parameters?
    > >
    > > I.e. when the List is passed I get the following query:
    > >
    > > SELECT t0.active, t0.name, t0.password, t0.security_level, t0.email,
    > > t0.username, t0.id FROM admin t0 WHERE t0.username IN (?, ?) [bind:
    > > 'garyj', 'johnt']
    > >
    > > while when an Array is passed I get the following (which throws a
    > > Query exception)
    > >
    > > SELECT t0.active, t0.name, t0.password, t0.security_level, t0.email,
    > > t0.username, t0.id FROM admin t0 WHERE t0.username = (?, ?) [bind:
    > > 'garyj', 'johnt']
    > >
    > > Thank you!
    > >
    > > Gary
    > >
    >
    >



    This archive was generated by hypermail 2.0.0 : Sat Mar 11 2006 - 00:34:24 EST