JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris WBEM Developer's Guide     Oracle Solaris 11 Express 11/10
search filter icon
search icon

Document Information


1.  Overview of Solaris Web-Based Enterprise Management

2.  Using the CIM Object Manager

3.  Using the Sample Programs

4.  Writing a Client Program

5.  Writing WBEM Queries

About the WBEM Query Language

Writing Queries

WQL Key Words

SELECT Statement

FROM Clause

WHERE Clause

Standard WQL Operators for WHERE Clauses

Parsing Queries


FROM Clause

WHERE Clause

Writing a Provider That Handles Queries

6.  Writing a Provider Program

7.  Creating JavaBeans Components Using the MOF Compiler

8.  Administering Security

9.  Troubleshooting

A.  Solaris Schema


Writing Queries

WBEM clients use WQL to query and filter data. When the data is served by a particular provider, the CIMOM passes the client queries to the appropriate provider. You can search for instances that match a specified query in a particular class, or in all classes within a particular namespace.

The following example shows a search for all instances of the Solaris_DiskDrive class that have a particular value for the Storage_Capacity property:

select * from Solaris_DiskDrive where Storage_Capacity = 1000

WQL Key Words

The Solaris WBEM SDK supports Level 1 WBEM SQL, which enables simple select operations without joins. The following table describes the supported WQL key words.

Table 5-2 Supported WQL Key Words

Key Word
Combines two Boolean expressions and returns TRUE when both expressions are TRUE.
Specifies the classes that contain the properties that are listed in a SELECT statement.
Comparison operator that is used with NULL.
Combines two conditions. When more than one logical operator is used in a statement, OR operators are evaluated after AND operators.
Specifies the properties that are used in a query.
Narrows the scope of a query.
Generates a result set that is based on a minimum amount of information provided.
SELECT Statement

You use the SELECT statement to retrieve instances of a single class and its subclasses. You can also specify the properties to retrieve and the conditions that must be met.

Note - Currently, join operations are not supported.

The syntax for the SELECT statement is as follows:

SELECT list FROM class WHERE condition

The following table shows examples of using arguments in the SELECT clause to refine a search.

Table 5-3 Sample SELECT Statements

Example Query
Selects all instances of the specified class and all of its subclasses. Each instance that is returned contains all the properties.
SELECT PropertyA FROM class
Selects all instances that contain PropertyA of the specified class and all of its subclasses.
SELECT PropertyA, PropertyB FROM class WHERE PropertyB=20
Selects all instances of the specified class and all of its subclasses where PropertyB=20. Each returned instance contains only PropertyA and PropertyB.
FROM Clause

The FROM clause identifies the class in which to search for instances that match the query string. Only non-joined expressions are supported, which means that a valid WQL FROM clause includes only a single class.

The FROM clause is represented by the abstract class, fromExp. Currently, NonJoinExp is the only direct subclass of fromExp. The NonJoinExp subclass represents FROM clauses with only one table (CIM class) to which the SELECT operation is applied.

WHERE Clause

The WHERE clause narrows the scope of a query. This clause contains a conditional expression, that can contain a property or key word, an operator, and a constant.

The syntax for a WHERE clause appended to a SELECT statement is as follows:

SELECT CIMinstance FROM CIMclass WHERE conditional_expression 

The conditional_expression in the WHERE clause takes the following form:

 property operator constant

The expression is composed of a property or key word, an operator, and a constant. You can append the WHERE clause to the SELECT statement using one of the following forms:

SELECT instance FROM class WHERE constant operator property

Valid WHERE clauses follow these rules:

Standard WQL Operators for WHERE Clauses

You can use the following standard WQL operators for a binary expression in the WHERE clause of a SELECT statement.

Table 5-4 WQL Operators for WHERE Clauses

Equal to
Less than
Greater than
Less than or equal to
Greater than or equal to
Not equal to