开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜