Closed llali closed 7 years ago
For the case where OnInfoMessage
is called before the query completes, we can just postpone the database change until after the query completes and not allow new queries to be executed until the change is complete. How can we handle the case where OnInfoMessage
is called after the query completes? Can we guarantee OnInfoMessage
is called before the next query executes?
Is there another way to check for database changes other than via OnInfoMessage
?
When executing two "Use [database]" queries to change the database name sometimes the second query fails to change the database name. The problem is that there's a data reader still open so changing the database name fails. The behavior can be reproduced in test "DatabaseChangesWhenCallingUseDatabase" in the sqltoolsservice. Also one potential problem can be in the code that changes the db name ConnectionService.ChangeConnectionDatabaseContext. This code changes a shared resource but not protected by any lock.