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.
[[["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,["# Interface GqlQueryOrBuilder (2.31.2)\n\nVersion latestkeyboard_arrow_down\n\n- [2.31.2 (latest)](/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.v1.GqlQueryOrBuilder)\n- [2.31.1](/java/docs/reference/google-cloud-datastore/2.31.1/com.google.datastore.v1.GqlQueryOrBuilder)\n- [2.30.0](/java/docs/reference/google-cloud-datastore/2.30.0/com.google.datastore.v1.GqlQueryOrBuilder)\n- [2.29.1](/java/docs/reference/google-cloud-datastore/2.29.1/com.google.datastore.v1.GqlQueryOrBuilder)\n- [2.28.2](/java/docs/reference/google-cloud-datastore/2.28.2/com.google.datastore.v1.GqlQueryOrBuilder)\n- [2.27.1](/java/docs/reference/google-cloud-datastore/2.27.1/com.google.datastore.v1.GqlQueryOrBuilder)\n- [2.26.4](/java/docs/reference/google-cloud-datastore/2.26.4/com.google.datastore.v1.GqlQueryOrBuilder)\n- [2.25.2](/java/docs/reference/google-cloud-datastore/2.25.2/com.google.datastore.v1.GqlQueryOrBuilder)\n- [2.24.3](/java/docs/reference/google-cloud-datastore/2.24.3/com.google.datastore.v1.GqlQueryOrBuilder)\n- [2.23.0](/java/docs/reference/google-cloud-datastore/2.23.0/com.google.datastore.v1.GqlQueryOrBuilder)\n- [2.22.0](/java/docs/reference/google-cloud-datastore/2.22.0/com.google.datastore.v1.GqlQueryOrBuilder)\n- [2.21.3](/java/docs/reference/google-cloud-datastore/2.21.3/com.google.datastore.v1.GqlQueryOrBuilder)\n- [2.20.2](/java/docs/reference/google-cloud-datastore/2.20.2/com.google.datastore.v1.GqlQueryOrBuilder)\n- [2.19.2](/java/docs/reference/google-cloud-datastore/2.19.2/com.google.datastore.v1.GqlQueryOrBuilder)\n- [2.18.5](/java/docs/reference/google-cloud-datastore/2.18.5/com.google.datastore.v1.GqlQueryOrBuilder)\n- [2.17.6](/java/docs/reference/google-cloud-datastore/2.17.6/com.google.datastore.v1.GqlQueryOrBuilder) \n\n public interface GqlQueryOrBuilder extends MessageOrBuilder\n\nImplements\n----------\n\n[MessageOrBuilder](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.MessageOrBuilder.html)\n\nMethods\n-------\n\n### containsNamedBindings(String key)\n\n public abstract boolean containsNamedBindings(String key)\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_$, must not match regex\n`__.__`, and must not be `\"\"`.\n\n`map\u003cstring, .google.datastore.v1.GqlQueryParameter\u003e named_bindings = 5;`\n\n### getAllowLiterals()\n\n public abstract boolean 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`bool allow_literals = 2;`\n\n### getNamedBindings() (deprecated)\n\n public abstract Map\u003cString,GqlQueryParameter\u003e getNamedBindings()\n\nUse [#getNamedBindingsMap()](/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.v1.GqlQueryOrBuilder#com_google_datastore_v1_GqlQueryOrBuilder_getNamedBindingsMap__) instead.\n\n### getNamedBindingsCount()\n\n public abstract int getNamedBindingsCount()\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_$, must not match regex\n`__.__`, and must not be `\"\"`.\n\n`map\u003cstring, .google.datastore.v1.GqlQueryParameter\u003e named_bindings = 5;`\n\n### getNamedBindingsMap()\n\n public abstract Map\u003cString,GqlQueryParameter\u003e getNamedBindingsMap()\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_$, must not match regex\n`__.__`, and must not be `\"\"`.\n\n`map\u003cstring, .google.datastore.v1.GqlQueryParameter\u003e named_bindings = 5;`\n\n### getNamedBindingsOrDefault(String key, GqlQueryParameter defaultValue)\n\n public abstract GqlQueryParameter getNamedBindingsOrDefault(String key, GqlQueryParameter defaultValue)\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_$, must not match regex\n`__.__`, and must not be `\"\"`.\n\n`map\u003cstring, .google.datastore.v1.GqlQueryParameter\u003e named_bindings = 5;`\n\n### getNamedBindingsOrThrow(String key)\n\n public abstract GqlQueryParameter getNamedBindingsOrThrow(String key)\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_$, must not match regex\n`__.__`, and must not be `\"\"`.\n\n`map\u003cstring, .google.datastore.v1.GqlQueryParameter\u003e named_bindings = 5;`\n\n### getPositionalBindings(int index)\n\n public abstract GqlQueryParameter getPositionalBindings(int index)\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`repeated .google.datastore.v1.GqlQueryParameter positional_bindings = 4;`\n\n### getPositionalBindingsCount()\n\n public abstract int getPositionalBindingsCount()\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`repeated .google.datastore.v1.GqlQueryParameter positional_bindings = 4;`\n\n### getPositionalBindingsList()\n\n public abstract List\u003cGqlQueryParameter\u003e getPositionalBindingsList()\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`repeated .google.datastore.v1.GqlQueryParameter positional_bindings = 4;`\n\n### getPositionalBindingsOrBuilder(int index)\n\n public abstract GqlQueryParameterOrBuilder getPositionalBindingsOrBuilder(int index)\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`repeated .google.datastore.v1.GqlQueryParameter positional_bindings = 4;`\n\n### getPositionalBindingsOrBuilderList()\n\n public abstract List\u003c? extends GqlQueryParameterOrBuilder\u003e getPositionalBindingsOrBuilderList()\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`repeated .google.datastore.v1.GqlQueryParameter positional_bindings = 4;`\n\n### getQueryString()\n\n public abstract String getQueryString()\n\nA string of the format described\n[here](https://cloud.google.com/datastore/docs/apis/gql/gql_reference).\n\n`string query_string = 1;`\n\n### getQueryStringBytes()\n\n public abstract ByteString getQueryStringBytes()\n\nA string of the format described\n[here](https://cloud.google.com/datastore/docs/apis/gql/gql_reference).\n\n`string query_string = 1;`"]]