About this question
I want to avoid hitting the org's governor limits but at the same time I need to know if I was about to hit them. Here's what I have so far:
[ SELECT convertCurrency(Price__c) FROM Object__c LIMIT :(Limits.getLimitQueryRows() - Limits.getQueryRows()) ];So this will save me from hitting the limits but it will not tell me that I was going to hit them.
Basically the case I am talking about is when the query LIMIT is 50k and the records are 50k. If Limits.getQueryRows() is 50k it doesn't necessarily mean that a limit would have been hit. But if the records are 50001 I want to know this so I can display an error on the page for the user.
I was thinking about using Count() somehow but not sure how I can achieve what I want. I am also trying to incorporate the solution without making an additional query.