question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Detect changed context is just ...

See original GitHub issue

https://github.com/Microsoft/mssql-jdbc/blob/e0e70a429aa6f84d151e5a18aef8b92f3337e269/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerStatement.java#L806

+@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:

  1. Not guaranteed to work, driver will not have the context and logic of the server to be accurate
  2. Adds a bunch of overhead for a fairly edge case scenario

Thoughts? /Tobias

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:21 (20 by maintainers)

github_iconTop GitHub Comments

1reaction
TobiasSQLcommented, Feb 1, 2018

Thanks @v-afrafi , submitted one comment. Thanks for the quick turn around!

0reactions
cheenamalhotracommented, Feb 16, 2018

Closing issue as requested changes merged to driver.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Detect when context's variable changes its value
I'm working on a new node that will output a message when a variable receives new value. The format of the message will...
Read more >
Angular Change Detection - How Does It Really Work?
Angular can detect when component data changes, and then automatically re-render the view to reflect that change. But how can it do so...
Read more >
How to find out if an Entity Framework object has changed?
If the entity is detached from a context you can't find out what has changed unless you are reloading the original entity from...
Read more >
How the React Context API detects changes and re-renders ...
The documentation says that the algorithm detects the value changes using Object.is() and I do not quite understand why we ever need to...
Read more >
The contribution of scene context on change detection ...
In the change detection task scene context can support the search for the target object at different stages: the perceptual stage, visual short- ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found