AppEngine DataStore - GQL not returning any results

不羁岁月 提交于 2019-12-24 16:25:07

问题


$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);

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

Thank you.


回答1:


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.

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-your-model



来源:https://stackoverflow.com/questions/28658555/appengine-datastore-gql-not-returning-any-results

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!