SQL-370: Delete DocumentDistributionLog via DeleteRequestDistributions¶
This statement deletes each DocumentDistributionLog entity returned by a query for distribution logs of a given document request (DOCUMENT_REQUEST_LOG_SEQ_NUM = :requestId), via IUnitOfWork.GetRepository<T>().Delete(entity) inside a foreach loop, invoked from TemplateSearchService.DeleteRequestDistributions (Services/SAIF.Services/Documents/TemplateSearchService.cs:865). One DELETE is issued per row. The SQL below is inferred from this repository call and the DocumentDistributionLog NHibernate mapping — it is not literal SQL present in source.
Classification¶
| Field | Value |
|---|---|
| SQL ID | SQL-370 |
| Operation type | Delete |
| Execution method | ORM (IRepository.Delete) |
| Database | Oracle |
| Schema | [unqualified]** |
| Command type | N/A (ORM-generated) |
| Business object | DocumentDistributionLog |
| Criteria property | N/A — ORM |
| Lifecycle method | DeleteRequestDistributions |
Parameters¶
| Parameter | Direction | Type | Max length | Description |
|---|---|---|---|---|
:Id |
Input | long | N/A | Identifier of the DocumentDistributionLog being deleted (DOCUMENT_DIST_LOG_SEQ_NUM) |
Tables¶
| Table | Access | Columns used |
|---|---|---|
| DOCUMENT_DISTRIBUTION_LOG | DELETE | DOCUMENT_DIST_LOG_SEQ_NUM |
LINQ statement¶
Source: Services/SAIF.Services/Documents/TemplateSearchService.cs:865
// Services/SAIF.Services/Documents/TemplateSearchService.cs:858
IEnumerable<DocumentDistributionLog> logs = unitOfWork.GetRepository<DocumentDistributionLog>().Query()
.Where(a => a.DocumentRequestLogSeqNum == requestId);
// Services/SAIF.Services/Documents/TemplateSearchService.cs:863
foreach (var log in logs)
{
unitOfWork.GetRepository<DocumentDistributionLog>().Delete(log);
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_DISTRIBUTION_LOG
WHERE DOCUMENT_DIST_LOG_SEQ_NUM = :Id
Translation notes:
- One DELETE per row of the
logsquery (lines 858-859,WHERE DOCUMENT_REQUEST_LOG_SEQ_NUM = :requestId), which is enumerated by theforeachat line 863 - that read is a separate statement.
Operations and processes¶
- TemplateSearchService.DeleteRequestDistributions — see Operations and processes
Sources¶
Services/SAIF.Services/Documents/TemplateSearchService.cs (L865)