Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0034770
TypeCategorySeverityReproducibilityDate SubmittedLast Update
feature request[Openbravo ERP] A. PlatformminorN/A2016-12-19 12:102022-02-01 08:09
ReportercaristuView Statuspublic 
Assigned ToTriage Platform Base 
PrioritynormalResolutionopenFixed in Version
StatusacknowledgedFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned To
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0034770: Add code to auto-detect 'accidental double query' on same OBQuery object

DescriptionThere is a quite common bad coding pattern which calls '.list()' more than one time on the same OBQuery object.

That will call the underlying sql query also 2 times.

Similar some code without good reason calls .count() + then .list() on the same instance. Which leads to a 'select count(*)' + then another 'select *' sql query.

Detecting such pattern is easy with some extra debugging code inside those 2 utility classes.

See attached patch for a rough patch doing some simple tracking.

Not polished yet but did already find 6 issues in fast manual testing + more 'to be triaged' when running erp-try with it applied.

The attached patch logs a WARN + a stacktrace of the location of and 2nd or 3rd call to either list,count,scroll.uniqueResult.

In practice that 2nd location is enough as a pointer and finding the first call in code is very easy in all examples observed so far.
Steps To ReproduceIn description
TagsNo tags attached.
Attached Filesdiff file icon 34770_prototype.diff [^] (4,677 bytes) 2016-12-19 12:15 [Show Content]

- Relationships Relation Graph ] Dependency Graph ]
related to feature request 0033767 closedplatform Add code to auto-detect 'accidental double query' on same OBQuery or OBCriteria object 

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2016-12-19 12:10 caristu New Issue
2016-12-19 12:10 caristu Assigned To => platform
2016-12-19 12:10 caristu Modules => Core
2016-12-19 12:10 caristu Triggers an Emergency Pack => No
2016-12-19 12:10 caristu Issue generated from 0033767
2016-12-19 12:10 caristu Relationship added related to 0033767
2016-12-19 12:14 caristu Description Updated View Revisions
2016-12-19 12:14 caristu Steps to Reproduce Updated View Revisions
2016-12-19 12:15 caristu File Added: 34770_prototype.diff
2016-12-19 12:49 shuehner Issue Monitored: shuehner
2016-12-23 08:20 caristu Status new => acknowledged
2022-02-01 08:09 alostale Assigned To platform => Triage Platform Base


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker