Database Query in the Directory Service
Some directory service routines accept a query string and some also
an order string. This allows application programs to select subsets of
equipment according to special criteria, following the SQL language syntax.
General query
A typical database query in the directory service is on a single database
table or view:
SELECT column1, column2, column3 ...
FROM basetable
WHERE query
Where query is a string like:
- query = "column1='string1' AND (column2='string2' OR column3>value3)";
and column1, column2, ... are names of the base table columns.
Atomic conditions are linked together with AND and OR. Valid column names
are documented in the description of the table or view. Note the single quotes
inside the query string.
Query with wildcards
A special case is a condition with wildcards:
- % stands for any sequence of characters
- _ stands for any character
The atomic condition may then be:
Order string
This allows ordering of the results of the query alphabetically and numerically
according to the sequence of columns:
- order = "column3, column2";
more complex ordering criteria according to functions of column values are possible.