Skip navigation links
Release 2.0.61-alpha6 Built 23-Jan-23 22:23:58 PST on build2.lockss.org

Package org.lockss.laaws.rs.impl

See: Description

Package org.lockss.laaws.rs.impl Description

SQL-Like Query

There are several operations that require as an argument a text string containing a SQL-like query used to determine the results to be returned.

The result of executing such a query is always a List of objects. The kind of objects populating the result List is specific to the web service operation being performed.
For example, the Daemon Status web service operation queryPlugins returns a List of org.lockss.ws.entities.PluginWsResult objects.

The query may have up to three clauses, each of them allowing the user to control a different aspect of the results. Each clause is separated from the other by at least one space.

The three clauses are, in order of appearance in the query:

Examples

  1. select *: It is the simplest (but costly) query and it results in a List of all the objects with each and every property properly populated.
  2. select name: Results in a List of all the objects with just the name property properly populated and the rest of properties populated with null values.
  3. select name where id > 10: Results in a List of the objects with the numeric id property greater than 10 only and properly populated with just the name property and the rest of properties populated with null values.
  4. select id where name = 'abc': Results in a List of the objects with the text name property equal to abc only and properly populated with just the id property and the rest of properties populated with null values.
  5. select id, name where value < 100 and color like 'red%' order by id: Results in a List of the objects with both the numeric value property lower than 100 and the text color property starting with red only and properly populated with just the id and name properties and the rest of properties populated with null values. The objects in the list are ordered from the smallest id property to the largest one.
  6. select id, longValue where toDate(longValue) < toDate('02/Apr/2014'): Results in a List of the objects with the long numeric longValue property representing a date before April 2, 2014 and properly populated with just the id and longValue properties and the rest of properties populated with null values.
Skip navigation links
Release 2.0.61-alpha6 Built 23-Jan-23 22:23:58 PST on build2.lockss.org

Copyright © 2000–2023 LOCKSS Program. All rights reserved.