GQL IN运算符错误

时间:2015-12-09 05:21:02

标签: google-app-engine google-cloud-datastore gql

我遇到来自带有“IN”运算符的GQL查询的appengine错误。我的查询如下:

SELECT * FROM ratings WHERE rating >= 0.0 AND cat = 1 AND pid IN(44,14)

错误信息是:

PHP Fatal error:  Uncaught exception 'google\appengine\runtime\ApplicationError' with message 'Encountered "IN" at line 1, column 84.
Was expecting one of:
    "contains" ...
    "has" ...
    "is" ...
    "=" ...
    "<" ...
    "<=" ...
    ">" ...
    ">=" ...
    "." ...
    "(" ...
    ' in /base/data/home/runtimes/php/sdk/google/appengine/runtime/RealApiProxy.php:53

我将我的查询放在数据存储管理控制台中它没有任何错误,并显示了确切的结果。 怎么了?

1 个答案:

答案 0 :(得分:1)

您对IN运算符的作用感到困惑。它不能做你想做的事。

请阅读有关云数据存储https://cloud.google.com/datastore/docs/apis/gql/gql_reference

的文档

Notice that the operator = is another name for the IN and CONTAINS operators. For example, <value> = <property-name> is the same as <value> IN <property-name>, and <property-name> = <value> is the same as <property-name> CONTAINS <value>. Also <property-name> IS NULL is the same as <property-name> = NULL.