|
![]() |
#1 |
MCT
|
Цитата:
X++: While select Statement with Large Transaction Scope ttsBegin; while select ItemId from salesLine { select firstOnly forUpdate ItemType, ItemBuyerGroupId from inventTable where inventTable.ItemId == salesLine.ItemId; If (inventTable && (inventTable.ItemType == InventItemType::Item)) { inventTable.ItemBuyerGroupId = ; inventTable.update(); } } ttsCommit; To limit the transaction scope, the code should be written to begin the transaction when the following criteria is met: While select Statement with Appropriate Transaction Scope while select ItemId from salesLine { select firstOnly forUpdate ItemType, ItemBuyerGroupId from inventTable where inventTable.ItemId == salesLine.ItemId; If (inventTable && (inventTable.ItemType == InventItemType::Item)) { ttsBegin; inventTable.ItemBuyerGroupId = ; inventTable.update(); ttsCommit; } } DO: Limit the transaction scope by grabbing locks at the latest possible time and releasing locks as early as possible.
__________________
Axapta book for developer Последний раз редактировалось MikeR; 21.01.2014 в 19:41. |
|
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|