Understand how to define object queries.
Since object queries can run on multiple mobile devices that may run different compact databases (UltraLiteJ or SQLite for example), object queries support a subset of UltraLiteJ SQL statements.
SQL | Restrictions |
---|---|
Select statement |
Supported – Order by Unsupported:
|
Input-parameter |
Supported – :name |
Comparison operators | Supported:
|
From clause | Supports multiple parts but from only one MBO. |
See the UltraLiteJ documentation for more information about theUltraLite SELECT statement clauses.
SELECT c.* from Cust c WHERE c.cust_id = :cust_id
results in an object query that returns a single row from the Customer table. You must use an alias (c and c.attribute_name) in the query definition or an error occurs during code generation.
General object query behavior, including assigning parameters a default value/primary key includes:
As an example, specifying the foreign key enables selection of children objects of the specified object. The pending flag locates only those objects that have pending changes, and so on.
select x.emp_fname, x.emp_lname, x.pending from Employee x where x.ss_number = :ssn
Parameter: Param1 (INT)
Query definition: SELECT x.* FROM TravelRequest x WHERE x.trvl_Id = :param1