A query string is a fully formed OQL statement that can be passed to a query engine and executed against a data set. To build a query string, you combine supported keywords, expressions, and operators to create an expression that returns the information 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.SELECT *
or SELECT DISTINCT *
. See SELECT Statement for other available functions./*
and */
delimiters; OQL does not permit nested comments. A single line comment body is all the characters to the right of --
(two hyphens) up to the end of the 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 VMware GemFire queries.