Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google app engine GQL语法条件_Google App Engine_Gql - Fatal编程技术网

Google app engine GQL语法条件

Google app engine GQL语法条件,google-app-engine,gql,Google App Engine,Gql,我有一个简单的问题: 在GQL中 什么是:1 根据语法,应该有:= 谢谢。您发布的语法链接上的GQL语法如下: SELECT [* | __key__] FROM <kind> [WHERE <condition> [AND <condition> ...]] [ORDER BY <property> [ASC | DESC] [, <property> [ASC | DESC] ...]] [LIMIT [<offs

我有一个简单的问题:

在GQL中

什么是
:1

根据语法,应该有
:=


谢谢。

您发布的语法链接上的GQL语法如下:

SELECT [* | __key__] FROM <kind>
  [WHERE <condition> [AND <condition> ...]]
  [ORDER BY <property> [ASC | DESC] [, <property> [ASC | DESC] ...]]
  [LIMIT [<offset>,]<count>]
  [OFFSET <offset>]

<condition> := <property> {< | <= | > | >= | = | != } <value>
<condition> := <property> IN <list>
<condition> := ANCESTOR IS <entity or key>
然后,我们可以替换第一个条件表达式,即:

<condition> := <property> {< | <= | > | >= | = | != } <value>
根据,1表示该值将绑定到
GqlQuery()
(查询后)的第一个参数。因此,在本例中,值为
users.get\u current\u user()

更新:

我认为这两种方法都不行,因为它们都缺少一个双引号来结束查询字符串。但是,以下两项都应起作用:

query = db.GqlQuery(
    "SELECT * FROM Rep WHERE author = :1", 
    users.get_current_user())

user = users.get_current_user()
query = db.GqlQuery(
    "SELECT * FROM Rep WHERE author = :1", 
    user)

拥有查询对象后,可以对其调用
fetch()
,以获取列表形式的项目。或者,您也可以直接迭代查询。

您发布的语法链接上的GQL语法如下:

SELECT [* | __key__] FROM <kind>
  [WHERE <condition> [AND <condition> ...]]
  [ORDER BY <property> [ASC | DESC] [, <property> [ASC | DESC] ...]]
  [LIMIT [<offset>,]<count>]
  [OFFSET <offset>]

<condition> := <property> {< | <= | > | >= | = | != } <value>
<condition> := <property> IN <list>
<condition> := ANCESTOR IS <entity or key>
然后,我们可以替换第一个条件表达式,即:

<condition> := <property> {< | <= | > | >= | = | != } <value>
根据,1表示该值将绑定到
GqlQuery()
(查询后)的第一个参数。因此,在本例中,值为
users.get\u current\u user()

更新:

我认为这两种方法都不行,因为它们都缺少一个双引号来结束查询字符串。但是,以下两项都应起作用:

query = db.GqlQuery(
    "SELECT * FROM Rep WHERE author = :1", 
    users.get_current_user())

user = users.get_current_user()
query = db.GqlQuery(
    "SELECT * FROM Rep WHERE author = :1", 
    user)

拥有查询对象后,可以对其调用
fetch()
,以获取列表形式的项目。或者,您也可以直接在查询上进行迭代。

谢谢您的详细回答。另一个快速问题:此查询有效:
query=list(db.GqlQuery(“SELECT*FROM Rep WHERE author=users.get\u current\u user())
但如果我定义
user=users.get\u current\u user()
并尝试查询
query=list(db.GqlQuery(“SELECT*FROM Rep WHERE author=user))
,则它不起作用。我在扫描字符串文字时出现错误
SyntaxError:EOL
有什么建议吗?再次感谢!谢谢你的详细回答。另一个快速问题:此查询有效:
query=list(db.GqlQuery(“SELECT*FROM Rep WHERE author=users.get\u current\u user())
但如果我定义
user=users.get\u current\u user()
并尝试查询
query=list(db.GqlQuery(“SELECT*FROM Rep WHERE author=user))
,则它不起作用。我在扫描字符串文字时出现错误
SyntaxError:EOL
有什么建议吗?再次感谢!
SELECT * FROM Pet WHERE owner = :1
query = db.GqlQuery(
    "SELECT * FROM Rep WHERE author = :1", 
    users.get_current_user())

user = users.get_current_user()
query = db.GqlQuery(
    "SELECT * FROM Rep WHERE author = :1", 
    user)