开发者

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

开发者 https://www.devze.com 2023-03-23 14:06 出处:网络
final DatastoreService dss = DatastoreServiceFactory .getDatastoreService(); Query query = new Query开发者_运维知识库(\"GQL query goes here!\");
    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

精彩评论

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