XCode Warrier
XCode Warrier

Reputation: 775

AppEngine DataStore - GQL not returning any results

$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.

Upvotes: 1

Views: 120

Answers (1)

Tom
Tom

Reputation: 1613

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

Upvotes: 1

Related Questions