Package org.apache.jackrabbit.oak.api
Interface QueryEngine
-
- All Known Implementing Classes:
QueryEngineImpl
@ProviderType public interface QueryEngineThe query engine allows to parse and execute queries.What query languages are supported depends on the registered query parsers.
-
-
Field Summary
Fields Modifier and Type Field Description static StringINTERNAL_SQL2_QUERYThe suffix for internal SQL-2 statements.static Map<String,PropertyValue>NO_BINDINGSEmpty set of variables bindings.static Map<String,String>NO_MAPPINGSEmpty set of namespace prefix mappings.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ResultexecuteQuery(String statement, String language, long limit, long offset, Map<String,? extends PropertyValue> bindings, Map<String,String> mappings)Execute a query and get the result.ResultexecuteQuery(String statement, String language, Map<String,? extends PropertyValue> bindings, Map<String,String> mappings)Execute a query and get the result.ResultexecuteQuery(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.List<String>getBindVariableNames(String statement, String language, Map<String,String> mappings)Parse the query (check if it's valid) and get the list of bind variable names.Set<String>getSupportedQueryLanguages()Get the set of supported query languages.
-
-
-
Field Detail
-
INTERNAL_SQL2_QUERY
static final String INTERNAL_SQL2_QUERY
The suffix for internal SQL-2 statements. Those are logged with trace level instead of debug level.- See Also:
- Constant Field Values
-
NO_BINDINGS
static final Map<String,PropertyValue> 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
static final Map<String,String> 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 Detail
-
getSupportedQueryLanguages
Set<String> 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 ParseException
Parse 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,String> mappings) throws ParseException
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,String> mappings) throws ParseException
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,String> mappings) throws ParseException
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
-
-