Показать сообщение отдельно
Старый 12.04.2019, 19:12   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
Dangerous bug in CustCollectionsPoolsListPage form AX2012/D365
Источник: http://alexvoy.blogspot.com/2019/04/...nspoolsli.html
==============

<div dir="ltr" style="text-align: left;" trbidi="on">There is a form CustCollectionsPoolsListPage where two data sources are outer joined to the root data source with no relations (no links).



If by any reason the initial query does not contain links for these two aforementioned, SQL starts producing a Cartesian product and generating a huge temporary table. The latter can potentially lead to SQL server crash, like it happened in our environment.



The following fix may leave much to be desired but at least it creates needed links in case they are absent.

On CustTable data source we have to add an additional check for the existing query.


public void executeQuery()
{
element.populateAgingIndicators(selectedCustAging);

// Use the query from the cue?
if (!useInitialQuery
// Begin
|| !this.wblCheckQuery(this.query())
// End:
)
{
this.query(element.addOriginalPoolQuery(listPageHelper.getCurrentPoolQuery()));
}


super();

element.setButtonAccess();
element.setGridColumnLabels();
}



<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">// to avoid the cartesian product in case of absent link for this outer join
private boolean wblCheckQuery(Query _query)
{
QueryBuildDataSource custAgingDs;
QueryBuildDataSource custAgingLegalEntityDs;
boolean ret = true;

custAgingDs = _query.dataSourceName(#CustAgingDsName);
custAgingLegalEntityDs = _query.dataSourceName(#CustAgingLegalEntityName);
if (!custAgingDs || !custAgingLegalEntityDs || custAgingDs.linkCount()
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.