[appengine-java] Re: complex query

2010-02-23 Thread Blake
Hah, that's good to know, and I appreciate you throwing the "it's in
the docs" right back at me :)

On Feb 22, 3:26 pm, Karel Alvarez  wrote:
> Actually you can have more than one inequality condition, but they
> must all refer to the same field, it is in the docs... :-) that is not
> the problem I have, thanks for replying though...
> Karel
>
> On 2/22/10, Blake  wrote:
>
> > You can only have one inequality filter per query.  So you can say:
>
> > where A==b && B==c && D==e && e>0
>
> > that last "e>0" is your ownly allowed inequality filter.  It's in the
> > docs :)
>
> > On Feb 22, 1:39 am, ka2  wrote:
> >> Hi
> >> I am trying to execute a query in the data store, the query would be
> >> something like this:
>
> >> "select listingNumber from {class name here} where listPrice>=1 &&
> >> listPrice<=20 && listingStatusId IN (1) && houseTypeId IN
> >> (1,2,4,6) &&  zipCode IN ('33035')"
>
> >> I know the In syntax is not standard, but I got the impression from
> >> some issue that I can no longer find that it could work
>
> >> I also tried using contains, with parameters and executeWithMap,
> >> declaring the parameters, and not, nothing seems to work, I can make
> >> simpler queries, by Id, by a field, delete all entities, all works
> >> fine, except this.
>
> >> Somebody has a complex query sample in java, query on one class only
> >> is fine, but would like something with >= and more than one contains?,
> >> my code would translate to something like:
>
> >> Query query = pm.newQuery("select listingNumber from {class name here}
> >> ");
> >>                 query.setFilter("listPrice>=:minPrice &&
> >> listPrice<=:maxPrice
> >> && :status.contains(listingStatusId)
> >> && :houseType.contains(houseTypeId) &&  :zip.contains(zipCode)");
> >>                 //query.declareParameters("pars defined here");
> >>                 Map pars= new HashMap();
> >>                 pars.put("minPrice", minPrice);
> >>                 pars.put("maxPrice", maxPrice);
> >>                 pars.put("status", Arrays.asList(status));
> >>                 pars.put("houseType", Arrays.asList(houseType));
> >>                 pars.put("zip", Arrays.asList(zipCode));
> >>                 results= (List) query.executeWithMap(pars);
>
> >> thanks
> >> Karel
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine for Java" group.
> > To post to this group, send email to google-appengine-j...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-appengine-java+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine-java?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: complex query

2010-02-23 Thread datanucleus
Obviously IN is not JDOQL syntax, and contains() is ... since it
follows Java (the JDO spec defines this, as do the DataNucleus docs).
You can (from a JDOQL perspective) have as many contains etc in a
query as you wish. You provide the params just as you have done.
Whether GAE/J supports all of that, I cannot answer.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: complex query

2010-02-22 Thread Karel Alvarez
Actually you can have more than one inequality condition, but they
must all refer to the same field, it is in the docs... :-) that is not
the problem I have, thanks for replying though...
Karel

On 2/22/10, Blake  wrote:
> You can only have one inequality filter per query.  So you can say:
>
> where A==b && B==c && D==e && e>0
>
> that last "e>0" is your ownly allowed inequality filter.  It's in the
> docs :)
>
> On Feb 22, 1:39 am, ka2  wrote:
>> Hi
>> I am trying to execute a query in the data store, the query would be
>> something like this:
>>
>> "select listingNumber from {class name here} where listPrice>=1 &&
>> listPrice<=20 && listingStatusId IN (1) && houseTypeId IN
>> (1,2,4,6) &&  zipCode IN ('33035')"
>>
>> I know the In syntax is not standard, but I got the impression from
>> some issue that I can no longer find that it could work
>>
>> I also tried using contains, with parameters and executeWithMap,
>> declaring the parameters, and not, nothing seems to work, I can make
>> simpler queries, by Id, by a field, delete all entities, all works
>> fine, except this.
>>
>> Somebody has a complex query sample in java, query on one class only
>> is fine, but would like something with >= and more than one contains?,
>> my code would translate to something like:
>>
>> Query query = pm.newQuery("select listingNumber from {class name here}
>> ");
>>                 query.setFilter("listPrice>=:minPrice &&
>> listPrice<=:maxPrice
>> && :status.contains(listingStatusId)
>> && :houseType.contains(houseTypeId) &&  :zip.contains(zipCode)");
>>                 //query.declareParameters("pars defined here");
>>                 Map pars= new HashMap();
>>                 pars.put("minPrice", minPrice);
>>                 pars.put("maxPrice", maxPrice);
>>                 pars.put("status", Arrays.asList(status));
>>                 pars.put("houseType", Arrays.asList(houseType));
>>                 pars.put("zip", Arrays.asList(zipCode));
>>                 results= (List) query.executeWithMap(pars);
>>
>> thanks
>> Karel
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: complex query

2010-02-22 Thread Blake
You can only have one inequality filter per query.  So you can say:

where A==b && B==c && D==e && e>0

that last "e>0" is your ownly allowed inequality filter.  It's in the
docs :)

On Feb 22, 1:39 am, ka2  wrote:
> Hi
> I am trying to execute a query in the data store, the query would be
> something like this:
>
> "select listingNumber from {class name here} where listPrice>=1 &&
> listPrice<=20 && listingStatusId IN (1) && houseTypeId IN
> (1,2,4,6) &&  zipCode IN ('33035')"
>
> I know the In syntax is not standard, but I got the impression from
> some issue that I can no longer find that it could work
>
> I also tried using contains, with parameters and executeWithMap,
> declaring the parameters, and not, nothing seems to work, I can make
> simpler queries, by Id, by a field, delete all entities, all works
> fine, except this.
>
> Somebody has a complex query sample in java, query on one class only
> is fine, but would like something with >= and more than one contains?,
> my code would translate to something like:
>
> Query query = pm.newQuery("select listingNumber from {class name here}
> ");
>                 query.setFilter("listPrice>=:minPrice && listPrice<=:maxPrice
> && :status.contains(listingStatusId)
> && :houseType.contains(houseTypeId) &&  :zip.contains(zipCode)");
>                 //query.declareParameters("pars defined here");
>                 Map pars= new HashMap();
>                 pars.put("minPrice", minPrice);
>                 pars.put("maxPrice", maxPrice);
>                 pars.put("status", Arrays.asList(status));
>                 pars.put("houseType", Arrays.asList(houseType));
>                 pars.put("zip", Arrays.asList(zipCode));
>                 results= (List) query.executeWithMap(pars);
>
> thanks
> Karel

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.