SQL-373: Delete DocumentRequestLog via DeleteTemplateRequests¶
This statement deletes each DocumentRequestLog entity in a result set for a given template, via IUnitOfWork.GetRepository<T>().Delete(entity) inside a foreach loop, invoked from TemplateSearchService.DeleteTemplateRequests (Services/SAIF.Services/Documents/TemplateSearchService.cs:886). One DELETE is issued per row (DOCUMENT_REQUEST_LOG_SEQ_NUM). The SQL below is inferred from this repository call and the DocumentRequestLog NHibernate mapping — it is not literal SQL present in source.
Classification¶
| Field | Value |
|---|---|
| SQL ID | SQL-373 |
| Operation type | Delete |
| Execution method | ORM (IRepository.Delete) |
| Database | Oracle |
| Schema | [unqualified]** |
| Command type | N/A (ORM-generated) |
| Business object | DocumentRequestLog |
| Criteria property | N/A — ORM |
| Lifecycle method | DeleteTemplateRequests |
Parameters¶
| Parameter | Direction | Type | Max length | Description |
|---|---|---|---|---|
:Id |
Input | long | N/A | Identifier of the DocumentRequestLog being deleted (DOCUMENT_REQUEST_LOG_SEQ_NUM) |
Tables¶
| Table | Access | Columns used |
|---|---|---|
| DOCUMENT_REQUEST_LOG | DELETE | DOCUMENT_REQUEST_LOG_SEQ_NUM |
LINQ statement¶
Source: Services/SAIF.Services/Documents/TemplateSearchService.cs:886
// Services/SAIF.Services/Documents/TemplateSearchService.cs:884
foreach (var result in results)
{
unitOfWork.GetRepository<DocumentRequestLog>().Delete(result);
Sample SQL¶
Inferred SQL: This SQL was inferred from the LINQ statement above and the NHibernate mappings. It is not concrete SQL from source code; NHibernate generates the executed statement at runtime, so aliases, column order, join syntax, and bind-parameter names may differ.
-- Inferred from LINQ (NHibernate mapping translation); not concrete SQL
DELETE FROM DOCUMENT_REQUEST_LOG
WHERE DOCUMENT_REQUEST_LOG_SEQ_NUM = :Id
Translation notes:
UPDATE_NUMis mapped withMap(line 27, with a "add version command" TODO at line 26), so there is no version predicate.- One DELETE per row of
results(lines 873-874,WHERE DOCUMENT_TEMPLATE_SEQ_NUM = :templateId-a.MyDocTemplate.Idshort-circuits to the FK column) - that read is separate and is enumerated twice (lines 878 and 884).
Operations and processes¶
- TemplateSearchService.DeleteTemplateRequests — see Operations and processes
Sources¶
Services/SAIF.Services/Documents/TemplateSearchService.cs (L886)