* Revert "Update SMO (#875)"
This reverts commit 96593d66e3.
* Revert "Switch Tools Service to new SMO and Microsoft.Data.SqlClient driver (#865)"
This reverts commit 9d140b53f3.
* Bump SMO to 160.1910315.0-preview
* Hotfix for ads dashboard for sqlondemand
* Generalizing engine edition functions and adapting tests
* Minor comment and cosmetic fixes
* Adding SqlOnDemand server edition string
* Fix tools service to store the corrected file path
* Use ClientFilePath for key
* Further fixes
* Undo spacing changes
* Fix tests
* Trigger CI rebuild
* switch to ambient props and targets files
* build against Microsoft.Data.SqlClient
* build tests
* fix test bug
* temporarily add SMO nuget to the repo
* update to released Microsoft.Data package
* First cut of CMS get Server Api - returns only names
* Adding Proper naming and some more functions
* Adding add remove Server and tests for it
* Changing relative path to derive from KeyChain.Urn and Nuget update
* Adding async thread for requests
* Addressing CR comments and adding one more test
* Adressed PR comments around naming
* Added the query to get big data cluster endpoints
Added bigDataClusterEndpoints to ObjectExplorerSession
Added bigDataClusterEndpoints to ServerInfo
Fixes some tests.
* Removed bigDataClusterEndpoints from session
* Since server property to get IsBigDataCluster is not implemented yet, use query of sys.asseblies instead to unblock us. Need to use server property when it is available
Add options to ServerInfo, so no need to change the contract in the further when adding new properties. Will move the existing properties to option later
* Undo changes not needed
* Resolved PR comments.
* Fixed node is null exception when can't find NodePath.
* Added comments
* Removed not used using
* Catch sqlException for the reader of BDC endpoints and set empty list to the option.
* Added comments for returning empty nodes.
This changes adds the following two notifications from the results processing within a batch. These new notifications allows a consumer to stream results from a resultset instead of getting them all at once after the entire resultset has been fetched.
ResultsAvailable
This is issued after at least 1 row has been fetched for this resultset.
ResultsUpdated
This is issued periodically as more rows are available on this resultset. The final send of this notification when all rows have been fetched has the property 'Complete' set to true in the ResultSummary object.
Detailed Change Log:
* Initial completed implementation of QueryResults stream feature. 3 unittests still need fixing
* Fix for the 3 failing test. I will look into making MockBehavior strict again for the three tests later
* Making GetReader/GetWriter use filestream objects in FileShare.ReadWrite mode so the file can be concurrently read and written
* Changing resultsAvailable also to fire off on a timer instead of after 1st row
* adding a project for clr TableValuedFunction to produce result set with delays after each row. This is helpful in end to end testing.
* Fixing up some tests and simplifying implementation of result update timer
* Address review comments
* Some test fixes
* Disabled flaky test verification
* Reopen connections prior to creating query execution data readers
* Reopen connection if an exception was rasied executing the query
* Fix unit tests
This change modifies the logging framework within sqltoolservice.
Moves away from custom Logger object to start using .Net tracing framework. It supports for the static Trace and TraceSource way of logging. For all new code it is recommend that we log the log messages using the existing static Logger class, while the code changes will continue to route the older Trace.Write* calls from the process to same log listeners (and thus the log targets) as used by the Logger class. Thus tracing in SMO code that uses Trace.Write* methods gets routed to the same file as the messages from rest of SQLTools Service code.
Make changes to start using .Net Frameworks codebase for all logging to unify our logging story.
Allows parameter to set tracingLevel filters that controls what kinds of message make it to the log file.
Allows a parameter to set a specific log file name so if these gets set by external code (the UI code using the tools service for example) then the external code is aware of the current log file in use.
Adding unittests to test out the existing and improved logging capabilities.
Sequences of checkins in development branch:
* Saving v1 of logging to prepare for code review. Minor cleanup and some end to end testing still remains
* Removing local launchSettings.json files
* added support for lazy listener to sqltoolsloglistener and removed incorrect changes to comments across files in previous checkin
* Converting time to local time when writing entries to the log
* move the hosting.v2 to new .net based logging code
* removing *.dgml files and addding them to .gitignore
* fixing typo of defaultTraceSource
* Addressing pull request feedback
* Adding a test to verify logging from SMO codebase
* propogating changes to v1 sqltools.hosting commandoptions.cs to the v2 version
* Fixing comments on start and stop callstack methods and whitespaces
* Commenting a test that got uncommented by mistake
* addding .gitattributes file as .sql file was observed to be misconstrued as a binary file
* add string serialization
* add unadded file
* changed code to be testable, added test
* moved test to correct location
* change to send undefined rather than error if the serialization fails
* update request name
* Add IncludePassword flag to get connection string method
* Override connection application name
* Fix typo
* Fix test break
* Use ****** as password placeholder
- Fixes https://github.com/Microsoft/sqlopsstudio/issues/97.
- This should fix the bulk of the issues reported by users since it's the 1st use of this connection in the query code path.
- Implemented the fix in the connection service. This will always open a connection when calling `GetOrOpenConnection`. I cannot see a reason why the connection returned from this should ever be closed.
- resolve issues in both this code path and the edit data code path since both use this method.
* add logic to close connections if changing fails
* added logic to close connections and reopen that fail to change (azure)
* expose connection map in connection info, change while to foreach
* removed unneeded code
* reworked logic to not depend on thrown errors
* added tests
* Avoid crashing if azure edition is System.
* Add new Azure-specific options to the prototype and return through the service calls
* Send azure properties over database info request
* IsCloud should include Azure SQL DW
- Fixed references to this feature flag
- Updated edition handling to include ManagedInstance and removed AzureV1 check since it's never used and it's been retired.
* Fix https://github.com/Microsoft/vscode-mssql/issues/986 and add better server edition naming
- Fixed a number of issues related to the binding queue, specifically the fact that it didn't capture exceptions that occurred on the binding thread. This caused the thread to crash the service.
- The root cause of the error was when you get a connection error during init of the SmoMetadataProvider which threw an exception. Because of this no Binder was created, and the code would null ref later during processing
- Added logic to handle null ref issue and other related code
- Added a unit test for the new error handling path, and supported still returning some value in this case
- Separately, have a fix for an issue where the edition is shown as "SQL Azure" for all Azure connections. Fixing to be "Azure SQL DB" for this case and handle when the database reports as DW or Stretch instead. This maps better to users concept of what the edition should be and avoids returning what is an outdated term.
* Messed up the test - fixing this by returning the expected return object
* Adding unit tests for save as excel
* Adding unit test for revert cell integration
* Adding unit test for edit session initialization
* Fixing issue where excel file factory wasn't being overridden
-- Ignoring the failed profiler test in the CI build since Matt is disabling in his pending PR.
* Turn off connection pool for internal SqlClient connections to avoid locking
* Add additional comments
* Bump SMO to 140.2.5 to pick-up private XEvent binaries
* Pick up SMO binaries from the build lab
* Add ProfilerService class placeholder
* Update SMO nuget package to include DB Scoped XEvents
* Stage changes
* Stage changes
* Update SMO to use RTM dependencies and remove separate SqlScript package
* Stage changes
* Iterate on profiler service
* Fix post-merge break in localization
* More refactoring
* Continue iterating on profiler
* Add test profiler listener
* Address a couple of the code review feedback
* Fix AppVeyor build break
* Use self-cleaning test file
This commit builds connection options using the connection string as a base, but allow other options to be overridden, which is how we change database. This commit also makes sure to copy the connection string when copying a connection, since that didn't happen before
* Support "SQL" settings in addition to MSSQL
- Handles having 2 separate configuration definitions and merging / treating them as 1 throughout the app
- If a settings group such as Intellisense is defined on mssql, it will override any generic SQL properties
- Retains backwards compatibility with existing settings.
* added get database info to admin service
* refactored code to be inline with standard
* added comments to utils functions
* added comments to public classes
* added machine name to serverinfo from connection; added last backupdate and last log backup date to database info
* removed camelcase from request type
* removed the wrapper for the generic dictionary
* removed unnecessary imports
* merged master
* changed datetime compare to equality operator
* added database compatability level to info
* renamed field
* fixed CompatibilityLevel string typo, added bakcup dates to capabilities list
- Fix non-dbo schema support, adding in specific parameter for schema. If this isn't specified, the code will still fall back to splitting up the objectName if it's a multi-part identifier. This ensures that input from action bar or CLI scenarios can still work since we'll accept multi-part names there
- Fix failure to edit data on Azure. This was failing as the SMO query to get the table info failed when cloning SqlConnection. In .Net Core it currently loses the passwor unless PersistSecurity = true.
- Fix bug in error reporting where ID and Method were switched. This caused bad breaks and was caught during integration testing
* Port over initial block of create db implementation
* Test case placeholder
* In-progress work
* Stage changes to other machine
* Add database prototype strings
* Stage changes to other machine
* Stage changes
* Hook the database info into capabilities discovery
* Stage changes
* Update SMO to latest from ssms_main
* Various clean-ups
* Update localization files
- Add support for connecting with a connection string by passing it as one of the connection parameters
- If a connection string is present, it will override any other parameters that are present
* Connect with different properties should actually change context
- Up to now, calling Connect for a previously-connected URI would disconnect, then reconnect ot the original (not new) target. WIth these changes we handle changes to database name or other key properties by updating the ConnectionInfo and connecting to the new target
- Some interesting scenarios are raised by our API, notably that an empty database name maps to the default DB (which we know nothing about). This limits the new feature such that only if the DB Name is specified, we'll change the connection. Hence 2 calls to an empty DB will not result in a DB change.
Additional changes:
- After discussion with Ben, we're simplifying the cancellation logic. He had made changes to support this, so the main update is that we dispose the token in the final block after its last use (hence avoiding a disposed exception) and clean up the number of Waits required since we already have async cancellation support
- Factored some logic such that the OnConnection callback isn't invoked until after we've updated the database name in the GetConnectionCompleteParams method. Again, this supports reporting the actual DB name instead of leaving it blank for default DB requests.
* PR comment fixes
- Add telemetry point for format requests
- Update PeekDefinition telemetry so that it captures whether the attempt succeeded and if it was connected. This will help us understand whether our current behavior of just notifying success/failure to the output window was useful or not. It will also help us understand whether we're doing a good job implementing this / if we need to improve reliability and preformance.
Fixes a bug where the GetOrOpenConnection method of the ConnectionService would throw if the connection didn't exist. It would yield a very unhelpful "key not found in collection" exception. The code has been updated to be much more helpful and fix the bug.
- TSqlFormatterService with support for formatting document and text range inside document
- Settings support for all formatting options.
- Extensibility support so that the service can be initialized using MEF extensibility, and can find all necessary TSqlFormatters using the same process
Fix Initialize request error on startup
- Messages were being read from the input channel before all request handlers were registered
- In particular, the Initialize request which is key for any server to talk to the client was getting lost because the message reader thread begins consuming, and we take an extra few hundred milliseconds due to MEF startup before we register the handler
- The solution is to initialize the message handler so request handlers can register, but not actually start processing incoming messages until all handers are ready. This is a safer way to go and should improve reliability overall
Improvements from internal prototype:
- Normalizing baselines to handle the line ending differences on Mac & Linux vs. Windows
- Significantly shortened most lines by implementing base class methods to wrap common objects from Visitor.Context and removing unnecessary "this." syntax
- Refactored the SqlCommonTableExpressionFormatter and related classes to reduce code count significantly. This provides a pattern to follow when refactoring other classes for similar clarity. It's likely a lot of common logic could be found and reused across these.
- Reduced overall code size by adding utility methods
* Add CancelTokenKey for uniquely identifying cancelations of Connections associated with an OwnerUri and ConnectionType string.
* Update ConnectionInfo to use ConcurrentDictionary of DbConnection instances. Add wrapper functions for the ConcurrentDictionary.
* Refactor Connect and Disconnect in ConnectionService.
* Update ConnectionService: Handle multiple connections per ConnectionInfo. Handle cancelation tokens uniquely identified with CancelTokenKey. Add GetOrOpenConnection() for other services to request an existing or create a new DbConnection.
* Add ConnectionType.cs for ConnectionType strings.
* Add ConnectionType string to ConnectParams, ConnectionCompleteNotification, DisconnectParams.
* Update Query ExecuteInternal to use the dedicated query connection and GetOrOpenConnection().
* Update test library to account for multiple connections in ConnectionInfo.
* Write tests ensuring multiple connections don’t create redundant data.
* Write tests ensuring database changes affect all connections of a given ConnectionInfo.
* Write tests for TRANSACTION statements and temp tables.