Commit Graph

117 Commits

Author SHA1 Message Date
Christopher Suh
106b6baeda Refreshes token for intellisense (#1476)
* check if token refresh needed

* add more checks

* simplify logic

* add summary and change to false

* wip

* wip

* add ExpiresOn field to check when token needs to be refreshed

* expired token check

* wip

* wip

* wip

* update expiresOn check

* wip

* wip

* working refresh token

* add closing tag

* fix summary

* pr comments

* add max tolerance

* refactoring

* refactoring and updating descriptions

* remove comment

* pr updates

* more pr comments

* pr comments

* wip

* pr comments - add state tracker

* update comment

* fix type

* pr comments

* fix race condition

* wip

* pr comments

* add comment

* pr comments

* nullable int

* pr comments

* remove uri from map upon disconnect

* pr comments

* remove uri from map upon editor close

* pr comments
2022-05-13 13:47:37 -05:00
Charles Gagnon
c248400a6c Add linting for copyright and unused usings (#1416)
* Add linting for copyright and unused usings

* Add one more + comment

* Enforce in build and fix errors

* Fix build
2022-03-04 15:17:29 -08:00
Vasu Bhog
8120858ad2 Modify Get Connection String Request to use connection details (#1394)
* connection string accepts connectionInfo

* get connection string from disconnected scenarios
2022-02-10 20:48:39 -08:00
Vasu Bhog
8e5a23f755 Optional application name parameter for connection string (#1380)
* optional application name parameter for connection string
2022-02-03 16:00:08 -08:00
Alan Ren
ee3588df75 set issupportedVersion flag (#1255) 2021-10-04 14:49:36 -07:00
Alex Ma
431e4cfbf1 Add changeConnectionUri action for query (#1227)
* added wip rename query

* added first rename test

* added missing query handling and two new tests

* removed ServiceDispose

* added change to owneruri.

* made fields private, used accessor methods

* added readonly flag back

* added didSave to sqltools.servicelayer

* fix for docsavecallbacks

* removed tryremove

* test disconnect in queryExecutionService

* removed debug message working query.

* added comment to handlerenamerequest

* added uri replacement function

* removed duplicate removemap function

* added minor fixes

* changed connectionOwnerUri to getter setter

* removed handledidsave and added setters

* removed additional save parts

* fixed space issues

* more fixes for spaces

* restored spaces

* fixed workspaceservice

* Update TextDocument.cs

* changed renameRequest into notification WIP

* restored textdocument

* restored textdocument.cs

* added rightwards arrow

* renamed rename to ChangeConnectionUri

* added more renames

* rename changeconnectionuri to changeuri

* renamed file names

* Revert "renamed file names"

This reverts commit 55228e65025b5179b15ae9a0adc095d95538723d.

* Revert "rename changeconnectionuri to changeuri"

This reverts commit 23f3813f609e3947f103e057f7c0919184075bdc.

* removed logging message and other small changes

* renamed class and method
2021-08-30 11:06:07 -07:00
Aasim Khan
539e47b40f Adding cpu count and ram size to server info (#1220)
* adding network file validator contract

* Adding additional properties to serverInfo

* Renaming to serversysinfo

* fixing var name

* Changed to smo to get the properties

* Fixing casting error

* renaming to sysinfo

* Removing unused sql scripts

* Throwing an error and renaming classes

* Changing Physicalmemory prop name from kb to mb

* pushing prop name change

* fixing comment
2021-07-13 12:57:53 -07:00
Alan Ren
27cb8f2f08 use new thread to handle requests (#1207) 2021-05-06 17:20:56 -07:00
Karl Burtram
6fe715d2d8 Do not update the DB name when connecting to DB pool (#1186)
* Do not update the DB name when connecting to DB pool

* Fix typo in the connection service
2021-04-15 14:48:02 -07:00
BranislavGrbicMDCS
3e98a2f17b [brgrbic] SqlOD changes for cloud Server Type and minor bug fixes (#1092)
* The ServerType of SQL OD in SMO is being changed to cloud. This is a minimal set of changes needed in sqltoolservice in order to keep everything working within ADS.

* SMO version update
2020-10-23 18:48:33 +02:00
Udeesha Gautam
616a79c83d GetConnectionString API fix to not change the cache only return the value (#1040)
* Get connection string call was changing the connection info (ref object) received from cache. Changing it to just get and make changes to only the returned string..

* Change to ensure PR validation works
2020-08-09 19:17:16 -07:00
Alan Ren
8f6662b019 extend the list databases request (#951)
* extend the list databases request

* reuse databaseInfo and refactor

* fix typo
2020-04-28 16:12:56 -07:00
Jeff Trimmer
a2b0435892 Fix issue where EnclaveAttestationProtocol gets set to "NotSpecified" (#937) 2020-03-25 14:53:55 -07:00
Jeff Trimmer
6920c34570 Always Encrypted Azure Key Vault Support (#934)
Add support for running queries that require a decryption key from Azure Key Vault when using Always Encrypted.
2020-03-19 12:48:05 -07:00
Aditya Bist
005457813d fix build breaks (#924) 2020-02-26 12:35:26 -08:00
Amir Omidi
a6c206bacd Revert "Fix build error"
This reverts commit f5a6f6f714.
2020-02-26 11:55:28 -08:00
Amir Omidi
f5a6f6f714 Fix build error 2020-02-26 11:46:23 -08:00
Jeff Trimmer
927b0d73ca Enable Always Encrypted enclave connection parameters (#919)
* Enable the enclave connection parameters.

* Update the switch statement to use the enum constants for EnclaveAttestationProtocol

* Update verbiage for Always Encrypted connection options

* Update the argument exception to chose one specific to this connection option

* Add resource logic to resource files.

* Add error checking for when enclave parameters are added and Always Encrypted is set to disabled.

* Add/Update unit tests
2020-02-18 15:33:12 -08:00
Jeff Trimmer
7b102df5a7 Enable column encryption setting (#908)
* Enable the Column Encryption advanced security connection setting and add supporting tests.
2020-01-22 16:02:05 -08:00
Amir Omidi
b786a14c03 Support ActiveDirectoryPassword authentication (#899) 2019-12-13 16:46:25 -08:00
Karl Burtram
427f0c11e8 Bump SMO and SqlClient to pickup Microsoft.Data.SqlClient fixes (#894)
* Revert "Revert to SMO with older SQLClient driver (#889)"

This reverts commit b763abae47.

* Bump SMO and SqlClient
2019-11-22 17:17:21 -08:00
Karl Burtram
b763abae47 Revert to SMO with older SQLClient driver (#889)
* 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
2019-11-04 13:00:45 -08:00
aleklj
84c505f647 Hotfix for ads dashboard for sqlondemand (#885)
* Hotfix for ads dashboard for sqlondemand

* Generalizing engine edition functions and adapting tests

* Minor comment and cosmetic fixes

* Adding SqlOnDemand server edition string
2019-10-31 17:35:11 +01:00
Charles Gagnon
6f17c15d2c Test fixes (#877)
* Test fixes

* Delete unneeded using
2019-10-16 10:43:12 -07:00
Charles Gagnon
de1bab9f1e Fix Intellisense not working for saved files (#867)
* Fix tools service to store the corrected file path

* Use ClientFilePath for key

* Further fixes

* Undo spacing changes

* Fix tests

* Trigger CI rebuild
2019-09-19 11:28:40 -07:00
David Shiflet
9d140b53f3 Switch Tools Service to new SMO and Microsoft.Data.SqlClient driver (#865)
* 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
2019-09-17 17:51:19 -04:00
udeeshagautam
9551022fff Feature/cms backend (#776)
* 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
2019-03-01 11:55:19 -08:00
Yurong He
adc13cff82 Unified connection support (#765)
* 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.
2019-01-24 20:06:35 -08:00
Arvind Ranasaria
6dd9a4b5f1 Feat/result streaming (#721)
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
2018-11-26 10:24:54 -08:00
Matt Irvine
7f28f249de Add support for Azure Active Directory connections (#727) 2018-11-13 11:50:30 -08:00
Karl Burtram
7c1710d396 Reopen connections prior to creating query execution data readers (#704)
* Reopen connections prior to creating query execution data readers

* Reopen connection if an exception was rasied executing the query

* Fix unit tests
2018-10-08 12:41:04 -07:00
ranasaria
09652cccd1 Enhanced Logging for sqltoolsservice (#695)
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
2018-09-24 23:55:59 -07:00
Anthony Dresser
3c0a282333 Serialize Connection String (#680)
* 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
2018-08-16 13:10:14 -07:00
Karl Burtram
38cf5414ce Add IncludePassword parameter to Get Connection String request (#670)
* Add IncludePassword flag to get connection string method

* Override connection application name

* Fix typo

* Fix test break

* Use ****** as password placeholder
2018-08-01 15:16:01 -04:00
Karl Burtram
7c96ceb501 Get Connection String request handler (#665) 2018-07-25 15:03:00 -04:00
Kevin Cunnane
42ee96f99f Fix Ops Studio issue 97 where query connection is dropped (#549)
- 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.
2017-11-21 14:46:20 -08:00
Aditya Bist
10cb78b712 listDatabases now shows online databases only (#534) 2017-10-27 16:10:38 -07:00
Anthony Dresser
399b03cbd1 Add force change database logic (#519)
* 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
2017-10-25 10:54:17 -07:00
Anthony Dresser
ed5b68bcf9 change return type from always true (#516) 2017-10-24 12:35:00 -07:00
Benjamin Russell
605f5e9f7b Adding more continuewithonfaulted handlers (#507) 2017-10-20 11:31:31 -07:00
Kevin Cunnane
d222af7824 Fix numerous Azure property issues (#511)
* 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.
2017-10-19 22:08:33 -07:00
Kevin Cunnane
4b66203dfc Fix tools service crash + improve server edition naming (#506)
* 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
2017-10-19 10:42:26 -07:00
Anthony Dresser
680f9f47d0 added change database handler (#505) 2017-10-18 19:09:55 -07:00
Leila Lali
284a3e0ee4 Fixing more restore connection issues (#488) 2017-10-10 14:32:45 -07:00
Leila Lali
fecf56bce2 closing the default connections that are opned just for validating the connections. Added the feature to application name in the connection (#483) 2017-10-09 10:49:12 -07:00
Leila Lali
f09b9f4c30 Fixing the bug with connections on database make restore fail (#473)
* closing the connections that don't need to be open and keeping track of the connections that should stay open
2017-10-05 20:06:31 -07:00
Karl Burtram
9091df8f62 Fix some issues with Script As Select (#474) 2017-10-03 14:39:29 -07:00
Karl Burtram
60aad9cf7e Allow connections on non-default port (#462)
* Allow custom port

* Update unit tests for port property
2017-09-21 08:26:13 -07:00
Kevin Cunnane
01d7cde0e3 Add support for Dedicated Administrator Connection (#466)
* Prototype support for admin connection

* Added test and used correct default for ADMIN connection casing
2017-09-20 16:04:12 -07:00
Benjamin Russell
8867bd9059 Code Coverage: SaveAsExcel Contracts, EditData Initialization (#463)
* 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
2017-09-20 15:09:29 -07:00