AppEngine数据存储-GQL不返回任何结果 [英] AppEngine DataStore - GQL not returning any results

查看:53
本文介绍了AppEngine数据存储-GQL不返回任何结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$query = "SELECT * FROM Name";

可以按预期完美运行,但是:

works perfectly as expected but:

$query = "SELECT * FROM Name WHERE name = 'david'";

不能按预期工作.数据存储的创建过程如下:

doesn't work as expected. The DataStore is created as follows:

$obj_name = new Entity();
$obj_name->name = strtolower($name);
$obj_name->age = $age;
$result = $obj_name_store->upsert($obj_name);

关于如何使用GQL提取特定项目的任何建议?

Any suggestions for how to extract a specific item using GQL?

谢谢.

推荐答案

您似乎在这里使用我的 php-gds 库:

It looks like you are using my php-gds library from here: https://github.com/tomwalder/php-gds

如果是这样,则可能是您没有明确要求数据存储为名称"属性建立索引的问题.

If so, then the problem is likely that you have not explicity requested the "name" property be indexed by Datastore.

定义架构时,您需要传递可选的第二个参数"TRUE",以使查询能够对这些字段起作用.

When defining your Schema, you need to pass the optional second parameter "TRUE" in order for queries to work against those fields.

有关代码示例,请参见此处.

See here for a code example.

https://github.com/tomwalder/php-gds#defining-您的模型

这篇关于AppEngine数据存储-GQL不返回任何结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆