cQL
cQL is used to query a COMAND repository or collection and return a set of results. cQL can also update and delete objects, manage content types and grant authorizations.
Example
The following cQL will return all fields for Contacts with a First Name that starts with "Jo".
SELECT * FROM Contact WHERE FirstName LIKE 'Jo%'
Where to Use cQL
cQL can be used in many places throughout the COMAND ecosystem.
- Panel Title Bar Path - Display and edit results of a cPath or cQL SELECT query.
- API App cQL Tabs - Display results of any cQL statement in a read-only table.
- cTemplate #CQL - Query and reference repository objects with the #CQL statement.
Statements
cQL statements can be used to query, create and modify content, content types and fields in a COMAND repository. Additionally, user authorization statements can be used to define fine-grain access controls to repository content and functionality.
There are several types of cQL statements:
- SELECT - Get existing content from the repository.
- INSERT - Add new content to the repository.
- APPROVE / SAVE / STORE - Modify existing content in the repository (like SQL UPDATE).
- DELETE / CANCEL - Remove existing content from the repository.
- CREATE - Create a content type.
- ALTER - Modify a content type.
- GRANT - Create/modify a user role.
Expressions
cQL statements can reference object fields, call functions, perform math operations and compare values with:
Results
Collections
SELECT statements result in a collection of matching objects. Each object and all of its fields can be accessed by traversing the object's fields.
Row Sets
In some cases, it is useful to get results as a set of rows, where each row contains a value for each selected field. Row sets are similar to SQL systems typically return for results. A key difference from collections is that multiple rows will be returned to represent "to many" relationships from one object.
For more information, see cQL Results (Objects & Rows).