<div dir="ltr">I've seen some other people on the list mention that they have used indexes to improve their query performance.  We do as well.  We also use a unique index for quote_no and are in the process of allowing users to manually specify that value.  If a user attempts to use a quote_no already in use, the operation needs to fail.<div>
<br></div><div>I've started implementing an optimistic commit strategy.  I'm not writing any additional checks before the commit, so I will be relying on my unique index to fail the transaction.  I'm using a standard DetailViewAjax endpoint, so if I can null $focus->id, it will report a failure [1].  I can check for the failed transaction in saveentity() before the transaction is completed [2] and unset the id.  Now we just have to deal with the additional database calls outside of the transaction; relateEntities() and the aftersave event handlers.</div>
<div><br></div><div style>What sort of behavior do people expect here?  I am of the opinion that we should short circuit past both relateEntities() and the aftersave handlers.  Maybe call a new aftersave.fail event?</div>
<div style><br></div><div style>This solution is quite a bit shy of what I'd really like to do; enable ADOdb exceptions (though I do turn them on for my phpunit tests), but the codebase is nowhere near ready for that sort of shenanigans.  ;)</div>
<div style><br></div><div style>[1] <a href="http://trac.vtiger.com/cgi-bin/trac.cgi/browser/vtigercrm/branches/5.4.0/modules/Quotes/DetailViewAjax.php#L33">http://trac.vtiger.com/cgi-bin/trac.cgi/browser/vtigercrm/branches/5.4.0/modules/Quotes/DetailViewAjax.php#L33</a><br>
</div><div>[2] <a href="http://trac.vtiger.com/cgi-bin/trac.cgi/browser/vtigercrm/branches/5.4.0/data/CRMEntity.php#L93">http://trac.vtiger.com/cgi-bin/trac.cgi/browser/vtigercrm/branches/5.4.0/data/CRMEntity.php#L93</a></div>
</div>