Interface IDatabaseSearch
SQL searches should only be used for advanced querying/counting when joins and the other SQL-capabilities, that cannot be achieved using Lucene queries, are needed.
In other cases the IDataService's search/count methods that work with Lucene queries are preferred. For example, IDataService.searchInstances(String, String, String),
IDataService.getInstancesCount(String, String), etc.
- Since:
- 3.19.3
-
Method Summary
Modifier and TypeMethodDescriptionintReturns the number of persistent objects found by executing the given SQL-query in the database for the current revision.intcountInBaseline(String sqlQuery, String revision) Returns the number of persistent objects found by executing the specified SQL-query in the database for the specified revision.intcountInCollection(String sqlQuery, IObjectId collectionId) Returns the count of persistent objects matching the specified SQL query in the Collection.<T extends IPObject>
IPObjectList<T>Searches the persistent objects by executing the specified SQL-query in the database for the current revision.<T extends IPObject>
IPObjectList<T>instancesInBaseline(String sqlQuery, String revision) Searches the persistent objects by executing the specified SQL-query in the database for the specified revision.<T extends IPObject>
IPObjectList<T>instancesInCollection(String sqlQuery, IObjectId collection) Executes an SQL query against the specified Collection to retrieve persistent objects.
-
Method Details
-
instances
Searches the persistent objects by executing the specified SQL-query in the database for the current revision.- Parameters:
sqlQuery-- Returns:
- a list containing the objects found as a result of the query execution.
- See Also:
-
instancesInBaseline
@NotNull <T extends IPObject> IPObjectList<T> instancesInBaseline(@NotNull String sqlQuery, @Nullable String revision) Searches the persistent objects by executing the specified SQL-query in the database for the specified revision.- Parameters:
sqlQuery-revision- A Baseline revision in which to search. Ifnull, search in the current revision.- Returns:
- a list containing the objects found as a result of the query execution.
- See Also:
-
instancesInCollection
@NotNull <T extends IPObject> IPObjectList<T> instancesInCollection(@NotNull String sqlQuery, @NotNull IObjectId collection) Executes an SQL query against the specified Collection to retrieve persistent objects.Note: Queries executed against the Collection HEAD (without a specified revision in the Collection ID) may return slightly stale data (in the range of several minutes).
For detailed information about Collection query syntax and best practices, please refer to the Polarion SDK documentation.
- Returns:
- a list containing the objects found as a result of the query execution.
- Since:
- 3.25.6
-
count
Returns the number of persistent objects found by executing the given SQL-query in the database for the current revision. Should be used instead ofinstances(String sqlQuery).size()when only the number of search results is required.- Parameters:
sqlQuery-- Returns:
- The number of persistent objects that match the given SQL-query.
- See Also:
-
countInBaseline
Returns the number of persistent objects found by executing the specified SQL-query in the database for the specified revision. Should be used instead ofinstancesInBaseline(String sqlQuery, String revision).size()when only the number or search results is required.- Parameters:
sqlQuery-revision- A Baseline revision in which to search. Ifnull, search in the current revision.- Returns:
- The number of persistent objects that match the given SQL-query.
- See Also:
-
countInCollection
Returns the count of persistent objects matching the specified SQL query in the Collection. This method is optimized for counting and should be preferred overinstancesInCollection(String, IObjectId)when only the result count is needed.Note: Queries executed against the Collection HEAD (without a specified revision in the Collection ID) may return slightly stale data (in the range of several minutes).
For detailed information about Collection query syntax and best practices, please refer to the Polarion SDK documentation.
- Returns:
- The number of persistent objects that match the given SQL query.
- Since:
- 3.25.6
-