Execution of DML Statements
In This Topic
Execution of DELETE Statements
DELETE statement must contain only one table (object) in its FROM clause and WHERE clause must contain only one or more comparisons of a column and a constant or the LIKE operator, united with the logical operators AND and OR.
DELETE statements are executed in the following way:
- The statement is parsed.
- If DELETE is not performed by the ID field, the ID fields of the objects, satisfying to the WHERE clause are selected. In other words, the SELECT ID statement with FROM and WHERE clause from the DELETE statement is executed.
- The objects are deleted from Dynamics 365 by the selected IDs
- If the table, the objects are deleted from, was cached, these objects are deleted from the cache.
Execution of INSERT Statements
INSERT statements must contain only constants in their VALUES clause. dotConnect for Dynamics 365 (formerly Dynamics CRM) supports the RETURNING clause in INSERT statements. The statements are executed in the following way:
- The object is inserted directly to Dynamics 365.
- If the table, the objects are inserted to, is cached, the object is queried from the Dynamics 365 and added to the cache.
- If there was the RETURNING clause in the INSERT statement, the fields, specified in this clause, are queried from the cache (if the table is cached) or from the server.
Execution of UPDATE Statements
UPDATE statements must contain only one or more comparisons of a column and a constant or the LIKE operator and must assign only constants to object fields. The FROM clause in UPDATE statements is not supported. They are executed in the following way:
- The statement is parsed.
- If UPDATE is not performed by the ID field, the ID fields of an objects, satisfying to the WHERE clause are selected.
- The objects are updated directly on Dynamics 365.
- If the table, the objects of which are updated, is cached, the objects are queried from the Dynamics 365 to retrieve its calculated fields.
- The retrieved objects are added to the cache.
Note: These steps are performed by dotConnect itself, you don't need to do anything