I've written such a translater that implements a subset of JDOQL:

     https://code.google.com/p/lowlevelquery/

<https://code.google.com/p/lowlevelquery/>There's really no documentation
other than the source code, which is a single class:


https://code.google.com/p/lowlevelquery/source/browse/trunk/src/com/newatlanta/appengine/datastore/LowLevelQuery.java

<https://code.google.com/p/lowlevelquery/source/browse/trunk/src/com/newatlanta/appengine/datastore/LowLevelQuery.java>The
LowLevelQuery class contains a number of static methods that let you execute
a JDOQL-like query string directly; for example:

    List<Entity> results = LowLevelQuery.asList( "select from myKind where
category = 'Java' and rating > 5" );

LowLevelQuery also implements the PreparedQuery interface; you can create a
LowLevelQuery instance from a query string and then use it just like you
would a PreparedQuery; for example:

    PreparedQuery myQuery = new LowLevelQuery( "select from myKind where
category = 'Java' and rating > 5" );
    List<Entity> results = myQuery.asList();

Let me know what you think.

Vince

On Wed, Jan 6, 2010 at 3:06 PM, keyurva <[email protected]> wrote:

> This is likely a common scenario and I'm wondering if someone has
> already written some code to do this that I can steal.
>
> I'm using the low-level datastore API. In my app, users will be
> entering a SQL where clause. For instance:
>
> category = "Java" and rating > 5
>
> This translates to the com.google.appengine.api.datastore.Query object
> as such:
>
> Query q = new Query("a kind");
> q.addFilter("category", Query.FilterOperator.EQUAL, "Java");
> q.addFilter("rating", Query.FilterOperator.GREATER_THAN, 5);
>
> Has anyone written a generic library that does this translation?
>
> Thanks,
> Keyur
>
> --
> 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
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-appengine-java%[email protected]>
> .
> 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 [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to