Class GqlQuery<V> (2.13.1)
Stay organized with collections
Save and categorize content based on your preferences.
public final class GqlQuery<V> extends Query<V> implements RecordQuery<V>
A Google Cloud Datastore GQL query.
A usage example:
When the type of the results is known the preferred usage would be:
Query<Entity> query =
Query.newGqlQueryBuilder(Query.ResultType.ENTITY, "select * from kind").build();
QueryResults<Entity> results = datastore.run(query);
while (results.hasNext()) {
Entity entity = results.next();
...
}
When the type of the results is unknown you can use this approach:
Query query = Query.newGqlQueryBuilder("select __key__ from kind").build();
QueryResults results = datastore.run(query);
if (Key.class.isAssignableFrom(results.getResultClass())) {
QueryResults<Key> keys = (QueryResults<Key>) results;
while (keys.hasNext()) {
Key key = keys.next();
...
}
}
See Also: GQL Reference
Type Parameter
Methods
allowLiteral()
public boolean allowLiteral()
Returns whether the query string can contain literals. When false
, the query string
must not contain any literals and instead must bind all values.
Returns
equals(Object obj)
public boolean equals(Object obj)
Parameter
Returns
Overrides
getNamedBindings()
public Map<String,Object> getNamedBindings()
Returns an immutable map of named bindings.
Returns
getNamedBindingsMap()
public Map<String,GqlQuery.Binding> getNamedBindingsMap()
Returns
Type | Description |
Map<String,com.google.cloud.datastore.GqlQuery.Binding> | |
getNumberArgs()
public List<Object> getNumberArgs()
Returns an immutable list of positional bindings (using original order).
Returns
getPositionalBindingsMap()
public List<GqlQuery.Binding> getPositionalBindingsMap()
Returns
Type | Description |
List<com.google.cloud.datastore.GqlQuery.Binding> | |
getQueryString()
public String getQueryString()
Returns the query string for this query.
Returns
getType()
public Query.ResultType<V> getType()
Returns
hashCode()
Returns
Overrides
nextQuery(RunQueryResponse responsePb)
public RecordQuery<V> nextQuery(RunQueryResponse responsePb)
Parameter
Returns
populatePb(RunQueryRequest.Builder requestPb)
public void populatePb(RunQueryRequest.Builder requestPb)
Parameter
toString()
Returns
Overrides
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-10 UTC.
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2024-09-10 UTC."}