-
Notifications
You must be signed in to change notification settings - Fork 465
Detect changed context is just ... #610
Description
+@brettwooldridge to keep me honest.
The checkIfContextChanged method in SQLServerStatement has a bunch of issues. My understanding is that this was added to handle the case where prepared handles cannot be re-used because the server context has changed. However, first off the implementation is very flaky, for ex. if I have a stored procedure called AddUser it will be detected as a context change. This also adds a bunch of overhead in terms of string manipulation & comparison with very little gain (most of the time the context will not have changed).
The previous implementation (that I did) attempted to re-create the handle if the context changed. There are pros and cons here, but I think that or simply throwing an error are the only reasonable alternatives. IMHO, the cons against this current approach are:
- Not guaranteed to work, driver will not have the context and logic of the server to be accurate
- Adds a bunch of overhead for a fairly edge case scenario
Thoughts?
/Tobias