Package org.apache.jackrabbit.oak.api
Interface QueryEngine
The query engine allows to parse and execute queries.
What query languages are supported depends on the registered query parsers.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The suffix for internal SQL-2 statements.static final Map
<String, PropertyValue> Empty set of variables bindings.Empty set of namespace prefix mappings. -
Method Summary
Modifier and TypeMethodDescriptionexecuteQuery
(String statement, String language, long limit, long offset, Map<String, ? extends PropertyValue> bindings, Map<String, String> mappings) Execute a query and get the result.executeQuery
(String statement, String language, Map<String, ? extends PropertyValue> bindings, Map<String, String> mappings) Execute a query and get the result.executeQuery
(String statement, String language, Optional<Long> limit, Optional<Long> offset, Map<String, ? extends PropertyValue> bindings, Map<String, String> mappings) Execute a query and get the result.Parse the query (check if it's valid) and get the list of bind variable names.Get the set of supported query languages.
-
Field Details
-
INTERNAL_SQL2_QUERY
The suffix for internal SQL-2 statements. Those are logged with trace level instead of debug level.- See Also:
-
NO_BINDINGS
Empty set of variables bindings. Useful as an argument toexecuteQuery(String, String, long, long, Map, Map)
when there are no variables in a query. -
NO_MAPPINGS
Empty set of namespace prefix mappings. Useful as an argument togetBindVariableNames(String, String, Map)
andexecuteQuery(String, String, long, long, Map, Map)
when there are no local namespace mappings.
-
-
Method Details
-
getSupportedQueryLanguages
Get the set of supported query languages.- Returns:
- the supported query languages
-
getBindVariableNames
List<String> getBindVariableNames(String statement, String language, Map<String, String> mappings) throws ParseExceptionParse the query (check if it's valid) and get the list of bind variable names.- Parameters:
statement
- query statementlanguage
- query languagemappings
- namespace prefix mappings- Returns:
- the list of bind variable names
- Throws:
ParseException
-
executeQuery
Result executeQuery(String statement, String language, long limit, long offset, Map<String, ? extends PropertyValue> bindings, Map<String, throws ParseExceptionString> mappings) Execute a query and get the result.- Parameters:
statement
- the query statementlanguage
- the languagelimit
- the maximum result set size (may not be negative)offset
- the number of rows to skip (may not be negative)bindings
- the bind variable value bindingsmappings
- namespace prefix mappings- Returns:
- the result
- Throws:
ParseException
- if the statement could not be parsedIllegalArgumentException
- if there was an error executing the query
-
executeQuery
Result executeQuery(String statement, String language, Optional<Long> limit, Optional<Long> offset, Map<String, ? extends PropertyValue> bindings, Map<String, throws ParseExceptionString> mappings) Execute a query and get the result.- Parameters:
statement
- the query statementlanguage
- the languagelimit
- the maximum result set size (may not be negative but may be empty)offset
- the number of rows to skip (may not be negative but may be empty)bindings
- the bind variable value bindingsmappings
- namespace prefix mappings- Returns:
- the result
- Throws:
ParseException
- if the statement could not be parsedIllegalArgumentException
- if there was an error executing the query
-
executeQuery
Result executeQuery(String statement, String language, Map<String, ? extends PropertyValue> bindings, Map<String, throws ParseExceptionString> mappings) Execute a query and get the result. This is a convenience method: no limit, and offset 0.- Parameters:
statement
- the query statementlanguage
- the languagebindings
- the bind variable value bindingsmappings
- namespace prefix mappings- Returns:
- the result
- Throws:
ParseException
- if the statement could not be parsedIllegalArgumentException
- if there was an error executing the query
-