This topic explains how to build a query string in VMware Tanzu GemFire.
A query string is a fully-formed Object Query Language (OQL) statement that can be passed to a query engine and executed against a data set. The OQL statement must be a SELECT
expression that references at least one region.
To build a query string, combine supported keywords, expressions, and operators to create an expression that returns the information that you require.
A query string follows the rules specified by the query language and grammar. It can include:
SELECT * FROM /exampleRegion
,/exampleRegion
is a path expression. See FROM Clause.SELECT DISTINCT * FROM /exampleRegion p WHERE p.position1.secId = '1'
, we access the secId
attribute of the Position object. See WHERE Clause.SELECT DISTINCT * FROM /exampleRegion p WHERE p.name.startsWith('Bo')
, we invoke the startsWith
method on the Name object. See WHERE Clause.SELECT DISTINCT * FROM $1 p WHERE p.status = $2
, $1
and $2
are parameters that can be passed to the query during runtime. See Using Query Bind Parameters for more details.ELEMENT(expr)
and IS_DEFINED(expr)
. See SELECT Statement for other available functions.SELECT *
or SELECT DISTINCT *
. See SELECT Statement for other available functions./*
and */
delimiters. OQL does not permit nested comments. A single line comment body consists of all of the characters to the right of --
(two hyphens) on a single line.The components listed above can all be part of the query string, but none of the components are required. At a minimum, a query string contains an expression that can be evaluated against specified data.
The following sections provide guidelines for the query language building blocks that are used when writing typical Tanzu GemFire queries.