简体   繁体   中英

java google app engine query from string (like Python's GQL)

    final DatastoreService dss = DatastoreServiceFactory
            .getDatastoreService();
    Query query = new Query("GQL query goes here!");

    /*
     * Like this GQL query:
     * 
        q = db.GqlQuery("SELECT * FROM People "
            "WHERE first_name = John "
            "AND last_name = Smith")
     */
     */

Is there any way to make it possible?
The thing is, I want to allow the user to provide his own query constraints.

This isn't possible with the low-level datastore service. GQL is parsed by the API; the backend does not speak a textual query language.

Why do you want to do this? Letting a user provide a query string is usually a (very) Bad Idea.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM