-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is a purgeResult
call necessary before executing another statement?
#119
Comments
Sorry for the delay getting back on this. Yes, if you're not already ensuring that result sets are either completely exhausted OR calling I could've had the library auto-purge on its own, since the result sets do detect whether they've been invalidated by a new command (although due to interger wrap-around, it's not completely 100% reliable...but it's very, very close.) So, the reason I didn't do auto-purge was to provide early detection of cases where a user (either accidentially or maybe they're simply unaware of the limitation) attempts to receive two result sets on the same connection at the same time. Granted, in some cases (such as probably most of yours and mine, I would imagine) a thrown But a thrown Plus, this way, the user can still choose to implement auto-purging on their own, as you have. But if the lib auto-purged on it's own, it wouldn't be as easy (or possible?) for the user to reverse that (especially for a newcomer who doesn't know about the per-connection limitation). Hmm, but now you've got me thinking... When Something to maybe think about. Its also a possibility to make auto-purge an optional setting, but I hesitate at that because then algorithms could wind up relying on the setting being on or off, and that could get to be a mess... |
Let me amend that with a part "C": Defensively calling purgeResult before issuing a new command IS needed, IF (and only if) you're not already ensuring that result sets (specifically A. Are completely exhausted. OR |
As of v1.1.4, which I will be tagging shortly (pending approval from travis), the answer to this question becomes a plain, simple "no". It is no longer necessary, ever. (But it doesn't hurt anything either.) |
In my code, I defensively call
purgeResult
before re-executing a prepared statement with a second set of parameters. Per our discussion here, you weren't sure whether this was necessary. Since an exec should be over immediately (no results are returned, or they are at least ignored), it stands to reason thatpurgeResult
shouldn't be necessary.The text was updated successfully, but these errors were encountered: