When false, the query string must not contain any literals and instead must bind all values. For example, SELECT * FROM Kind WHERE a = 'string literal' is not allowed, while SELECT * FROM Kind WHERE a = @value is.
For each non-reserved named binding site in the query string, there must be a named parameter with that name, but not necessarily the inverse. Key must match regex [A-Za-z_$][A-Za-z_$0-9]*, must not match regex __.*__, and must not be "".
Numbered binding site @1 references the first numbered parameter, effectively using 1-based indexing, rather than the usual 0. For each binding site numbered i in query_string, there must be an i-th numbered parameter. The inverse must also be true.
When false, the query string must not contain any literals and instead must
bind all values. For example,
SELECT * FROM Kind WHERE a = 'string literal' is not allowed, while
SELECT * FROM Kind WHERE a = @value is.
Returns
Type
Description
bool
setAllowLiterals
When false, the query string must not contain any literals and instead must
bind all values. For example,
SELECT * FROM Kind WHERE a = 'string literal' is not allowed, while
SELECT * FROM Kind WHERE a = @value is.
Parameter
Name
Description
var
bool
Returns
Type
Description
$this
getNamedBindings
For each non-reserved named binding site in the query string, there must be
a named parameter with that name, but not necessarily the inverse.
Key must match regex [A-Za-z_$][A-Za-z_$0-9]*, must not match regex
__.*__, and must not be "".
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Cloud Datastore V1 Client - Class GqlQuery (1.33.1)\n\nVersion latestkeyboard_arrow_down\n\n- [1.33.1 (latest)](/php/docs/reference/cloud-datastore/latest/V1.GqlQuery)\n- [1.33.0](/php/docs/reference/cloud-datastore/1.33.0/V1.GqlQuery)\n- [1.32.3](/php/docs/reference/cloud-datastore/1.32.3/V1.GqlQuery)\n- [1.31.0](/php/docs/reference/cloud-datastore/1.31.0/V1.GqlQuery)\n- [1.30.0](/php/docs/reference/cloud-datastore/1.30.0/V1.GqlQuery)\n- [1.29.2](/php/docs/reference/cloud-datastore/1.29.2/V1.GqlQuery)\n- [1.28.2](/php/docs/reference/cloud-datastore/1.28.2/V1.GqlQuery)\n- [1.26.0](/php/docs/reference/cloud-datastore/1.26.0/V1.GqlQuery)\n- [1.25.0](/php/docs/reference/cloud-datastore/1.25.0/V1.GqlQuery)\n- [1.24.4](/php/docs/reference/cloud-datastore/1.24.4/V1.GqlQuery)\n- [1.23.0](/php/docs/reference/cloud-datastore/1.23.0/V1.GqlQuery)\n- [1.22.1](/php/docs/reference/cloud-datastore/1.22.1/V1.GqlQuery)\n- [1.21.2](/php/docs/reference/cloud-datastore/1.21.2/V1.GqlQuery)\n- [1.19.0](/php/docs/reference/cloud-datastore/1.19.0/V1.GqlQuery)\n- [1.18.1](/php/docs/reference/cloud-datastore/1.18.1/V1.GqlQuery)\n- [1.17.1](/php/docs/reference/cloud-datastore/1.17.1/V1.GqlQuery) \nReference documentation and code samples for the Cloud Datastore V1 Client class GqlQuery.\n\nA [GQL\nquery](https://cloud.google.com/datastore/docs/apis/gql/gql_reference).\n\nGenerated from protobuf message `google.datastore.v1.GqlQuery`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Datastore \\\\ V1\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getQueryString\n\nA string of the format described\n[here](https://cloud.google.com/datastore/docs/apis/gql/gql_reference).\n\n### setQueryString\n\nA string of the format described\n[here](https://cloud.google.com/datastore/docs/apis/gql/gql_reference).\n\n### getAllowLiterals\n\nWhen false, the query string must not contain any literals and instead must\nbind all values. For example,\n`SELECT * FROM Kind WHERE a = 'string literal'` is not allowed, while\n`SELECT * FROM Kind WHERE a = @value` is.\n\n### setAllowLiterals\n\nWhen false, the query string must not contain any literals and instead must\nbind all values. For example,\n`SELECT * FROM Kind WHERE a = 'string literal'` is not allowed, while\n`SELECT * FROM Kind WHERE a = @value` is.\n\n### getNamedBindings\n\nFor each non-reserved named binding site in the query string, there must be\na named parameter with that name, but not necessarily the inverse.\n\nKey must match regex `[A-Za-z_$][A-Za-z_$0-9]*`, must not match regex\n`__.*__`, and must not be `\"\"`.\n\n### setNamedBindings\n\nFor each non-reserved named binding site in the query string, there must be\na named parameter with that name, but not necessarily the inverse.\n\nKey must match regex `[A-Za-z_$][A-Za-z_$0-9]*`, must not match regex\n`__.*__`, and must not be `\"\"`.\n\n### getPositionalBindings\n\nNumbered binding site @1 references the first numbered parameter,\neffectively using 1-based indexing, rather than the usual 0.\n\nFor each binding site numbered i in `query_string`, there must be an i-th\nnumbered parameter. The inverse must also be true.\n\n### setPositionalBindings\n\nNumbered binding site @1 references the first numbered parameter,\neffectively using 1-based indexing, rather than the usual 0.\n\nFor each binding site numbered i in `query_string`, there must be an i-th\nnumbered parameter. The inverse must also be true."]]