Skip to content

Add option to ask how many Queries were performed, equivalent to Limits.getQueries() #298

Description

@packocz

For some features it is important that local static caching (or whatever similar approach) works correctly to prevent limit issues for queries. You'd then write a test which ensures e.g. that subsequent calls to the same method do not cause additional SOQL queries.

SOQL already counts queries and throws exception when limit reached. Ideally we should have an official api to get this number from SOQL.

Perhaps (optionally) even combined with the actual results from Limits?

SOQL.getQueries();
SOQL.getLimitQueries();

Additional context
It makes no sense perhaps when running code for real but in Unit Tests where no actual SOQL is done it probably would. The methods could delegate to real Limits class outside of tests for consistent usage perhaps.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Fields

No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions