Commit Graph

56 Commits

Author SHA1 Message Date
Hai Cao
bcf015f939 Fix datetimeoffset formatting (#1823) 2023-01-25 11:19:30 -08:00
Benjamin Russell
af2c0c77e7 Export to Markdown Support (#1705)
* Adding file writer for Markdown tables. No testing yet.

* Unit tests for the markdown writer

* Wiring up the factory and and request types

* Wiring up changes for Markdown serialization in serialization service

* Couple last minute tweaks

* Changes as per PR comments

* Revert temp testing code. 🙈

* Fluent assertions in SerializationServiceTests.cs

Co-authored-by: Ben Russell <russellben@microsoft.com>
2022-09-27 11:55:43 -07:00
Charles Gagnon
fd00114a0e Catch Request/Event handler errors at dispatcher level (#1610)
* Catch Request/Event handler errors at dispatcher level

* Fix tests

* Use Exception overload of SendError

* Fix tests
2022-07-29 17:31:36 -07:00
Benjamin Russell
2ace786d95 Export headers in an empty result set (#1434)
* Minimal changes to make headers appear on empty result sets

* Columns for everyone!

* Updating tests - some don't pass yet

* Adding some more tests to verify the changes for column/row selection

* null default columns

* Updates to comments as per PR comments
2022-03-31 09:10:32 -07:00
Lewis Sanchez
f7b37091ca Renames ShowPlan directories along with corresponding namespaces (#1435)
* Renames ShowPlan directories along with corresponding namespaces

* Renames ShowPlanGraphUtils to ExecutionPlanGraphUtils

* Revert "Renames ShowPlanGraphUtils to ExecutionPlanGraphUtils"

This reverts commit 5dc2696ae906598447eed7360a3f342218432b83.

* Reverts show plan tests name change.

* Renames show plan test XML files.

* Renames ported directory to ShowPlan and updates namespace accordingly
2022-03-21 16:25:44 -07:00
Charles Gagnon
40c5d48c5e Fail build on unneeded usings (#1417) 2022-03-04 16:38:01 -08: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
Charles Gagnon
dc6555a823 Escape file URIs (#1189)
* Escape file URIs

* Fix test

* Add tests
2021-04-16 15:33:11 -07:00
Charles Gagnon
1e9221b2a5 Remove password field from test (#1163) 2021-02-23 08:53:41 -08:00
David Shiflet
839acf67cd Convert most tools service tests to nunit (#1037)
* Remove xunit dependency from testdriver

* swap expected/actual as needed

* Convert Test.Common to nunit

* port hosting unit tests to nunit

* port batchparser integration tests to nunit

* port testdriver.tests to nunit

* fix target to copy dependency

* port servicelayer unittests to nunit

* more unit test fixes

* port integration tests to nunit

* fix test method type

* try using latest windows build for PRs

* reduce test memory use
2020-08-05 13:43:14 -04:00
Soheil Alizadeh
887a499d2b Update Infrastructure (#961)
* Update form .NET Core 2.2 to .NET Core 3.1

- Global variable for projects
- Change TFMs from netcoreapp2.2 to netcoreapp3.1
- Update global.json
- Update build.json
- Remove direct framework cake TestCore task
- Update travis dotnet version
- Update azure pipline file
- Update vscode launch.json

* Add Central Package Management

* Fix xUnit Breaking Change for MemberData type

* Fix xUnit breaking change for duplicate test method name

* Fix Rang/Index type conflict with System.Rang/Index

* Update vscode tasks.json

* Change serviceHostExecutable path in ServiceTestDriver.cs

* Downgrade SDK version (https://github.com/appveyor/ci/issues/3440)

- Appveyor hasn't installed latest SDK therefore I downgrade it until they install it.

* Dump Microsoft.SqlServer.DACFx
2020-06-12 11:44:18 -07: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
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
Kevin Cunnane
d42e3626cb Fix serialization tests & don't block thread (#846)
* Fix serialization tests & don't block thread
- Fixed potential null ref when closing streams
- Always clean up serialization queue if an error occurs
- Stop blocking dispatcher thread by not awaiting task that processes the message
- Improved error logging in EventFlowValidator to help debug issues
- Close stream on exception
2019-08-09 09:48:57 -07:00
Kevin Cunnane
7ef82feea7 Add serialization service support (#840)
Added a method that handles serialization requests
Support splitting save over multiple requests to reduce overall message size
Added unit tests
String changes used a new version of the string tool for generation.
Will publish PR separately for the changes to build & localization
so this can run on Mac without .Net Core 1.0
2019-08-06 16:50:42 -07:00
Karl Burtram
151a2de625 Query execution settings support (#812)
* WIP

* WIP 3

* WIP 3

* Additional query settings updates

* Add settings tets

* Address code review feeback

* Updates from testing
2019-05-16 15:21:17 -07:00
udeeshagautam
5778dc7b01 Fix for : 4045: Cannot cancel a Query. Query runs too long. (And SMO update) (#780)
* Fix for : 4045: Cannot cancel a Query. Query runs too long.
HandleExecuteRequest was returning a task to awaiter - which was getting waited on. changed it to async function to start task in new thread and return nothing to awaiter . Also the cancellation token set by cancel request was getting checked only after making the connection to execute batches. Added an additional check for cancellation token befor the connection has been made.

Fix for 4319: Error showing dbs when using AAD in... 1.5.0-alpha.74
David has already created a new version of SMO nuget with the fix. - incorporating the same (150.18096.0-preview).

* Adding awaitable internal task for tests to run properly

* Adding more cancel tests
2019-03-13 15:39:00 -07:00
Arvind Ranasaria
5f6d500977 This change ensures that we send back only one 'isComplete=true' message for a given result set (#763)
Fixes:
The streaming protocol is now tightened to ensure that only the last message for a result set contain isCompleted=true. Now isCompleted=true is never sent in isAvailable message.
Tightened logic in sending messages to make sure that no duplicate messages get sent out due to concurrent processing.
Made a fix to a null reference exception when processing special action which was a pre-existing benign bug.
Testing: Added 1 more new test that runs existing tests concurrently 1000 times to make sure no random timing issues are observed and tightened verifications to existing tests to ensure no duplicate messages and only one isComplete=true message is sent across.

* tightening the protocal to ensure only one message (the last one) with completed=true is sent back for a single result set within a query batch
2019-01-11 10:21:52 -08:00
Arvind Ranasaria
e4808c12aa Feat/result streaming - Fix for issue #746 in toolsservice and issue Microsoft/azuredatastudio#3348 (#753)
* fix for issues 746 & azuredatastudio issue 3348

* test coverage improvement for results streaming

* addressed minor review comments

* adding generated file test/CodeCoverage/package-lock.json to workaround code coverage issue.
2018-12-04 20:49:05 -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
2966a53b70 Fix: DATETIMEOFFSET data types should be ISO formatted (#714) 2018-10-22 16:46:02 -07: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
AlexFsmn
41d0ef1814 Fixed correct value types when saving columns to a json file (#691) 2018-09-25 14:24:39 -07:00
Mustafa Sadedil
98018c5292 Save as XML feature added (#684)
Similar approach used like Save as JSON or Save as CSV.
2018-09-10 12:11:51 -07:00
Sebastian Pfliegel
84f62a3e85 Added more options to SaveResultsAsCsvRequestParams (#669)
Fixes Microsoft/sqlopsstudio#203
Options:
LineSeperator
TextIdentifier
Encoding
2018-08-01 15:15:11 -04:00
Chirag Rupani
77a08b4bdd Added support for specifying delimiter while exporting query results as CSV (#653) 2018-07-12 10:39:23 -07:00
Matt Irvine
d19db1b4fe Handle errors during execution as info messages instead of exceptions (#596) 2018-04-03 08:47:44 -07:00
Kevin Cunnane
30c4b97f2a Fix batch results with GO N (#587)
- Fixes https://github.com/Microsoft/vscode-mssql/issues/1066
2018-03-21 13:41:58 -07:00
Matt Irvine
90611034cf Disable flaky test (#559) 2017-12-06 16:10:41 -08:00
Kevin Cunnane
b8e46ce65f Support GO N syntax to execute multiple times (#551)
* Support `GO N` syntax to execute multiple times
- Plumbed through the batch execution count from the parser and used in the batch execution code path
- Functionality matches SSMS:
  - Outputs loop start/end messages that match SSMS if you're doing multi-batch execution
  - Outputs an "ignoring failure" error if an error happens during a batch
- Added tests for this
- Manually verified end to end also

* Fixing test error
2017-11-22 11:33:19 -08:00
Benjamin Russell
e9bc97e290 Edit Data: Better errors for possible truncation (#514)
* Fix to make sql exceptions surface properly to user (with important notes!)

* Adding support for detecting column size issues when updating a cell

* Adding unit tests for the exception on read scenario
2017-10-21 11:08:40 -07:00
Benjamin Russell
639cd91fe2 Moving event flow validatior into test.common 2017-10-19 14:27:37 -07:00
Kevin Cunnane
077ce4de1b Fix travis (#490)
* Also disabled flaky test and disable macOS build
2017-10-11 15:27:40 -07:00
Matt Irvine
924709af79 More ConcurrentDictionary test changes - Fix build error from PR #456 (#467) 2017-09-21 16:21:47 -07:00
Matt Irvine
339a9c0fe2 Use a concurrent dict when mocking file stream factory (#465) 2017-09-21 10:27:03 -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
Benjamin Russell
5cf779fd23 Fix: GUIDs not being stored as Guids (#461)
* Fixing issue where Guids weren't being stored in the service buffer file as Guids

* Removing unnecessary ReadSqlGuid method

* Adding unit test for revert cell integration

* Adding unit test for edit session initialization

* Revert "Adding unit test for revert cell integration"

This reverts commit a949926f2ebbb0c39f776edba76d999af4f3f3e9.

* Revert "Adding unit test for edit session initialization"

This reverts commit ff9e5a7d0e5392b27257e57db64879699d73d21c.
2017-09-20 09:59:25 -07:00
Matt Irvine
a35cd8ed2b Take column into account when getting current statement query (#458) 2017-09-19 16:51:24 -07:00
Henry Phan
784f4c5d05 Feature/serialization exe (#442)
* Initial changes to have serialization generate its own .exe

* Removed additional project from sln file

* remove all references to removed temporary project

* Moved shared contracts into own dll and fixed imports. Addressed PR comments

* Undid having a separate contracts project since that'll be a task for later on. Moved dbcellvalue and saveresultsrequest to Hosting, where they will be imported and shared by the service layer and serialization projects

* Switched backslashes in project reference in csproj file to forward slashes for consistency

* Moved necessary contracts back to service layer. Refactored CommandOptions to reduce code duplication. Addressed miscellaneous PR suggestions

* Accidentally left these files out of previous commit

* Initialized loggers for serialization and credentials with the logging directory provided by the cmd line arg, if there is one

* Changed default log directory paths for serialization and credentials. Removed unnecessary cast and added a copyright

* Changed name of generated executable for serialization service

* removed unnecessary object cast

* removing unnecessary imports and addressing other PR comments
2017-09-05 16:21:42 -07:00
Anthony Dresser
70d658b9a8 Changed how the test awaits on executed queries to make it more reliable (#427) 2017-08-04 14:44:57 -07:00
Anthony Dresser
7ef81d0e54 Multiple Connection Simple Execute (#421)
* change simple execute to open a new connection and close it every query

* updated tests for simple execute

* removed an unnecessary connect

* refactored code to be more readable

* global try catch on simple execute

* added multiple execution test

* update execution to be asynchrous; update tests to account for asynchrounous nature
2017-07-28 13:35:46 -07:00
Karl Burtram
18977a89dc Allow empty query string text (#415)
* Allow empty query string text

* Remove test that is no longer valid

* Remove test that is no longer valid
2017-07-15 10:14:32 -07:00
Karl Burtram
cfa78bbc3b Execute SQL statement at cursor location (#412)
* Stage changes to other machine

* Parse sql statement from script document

* Fix a few typos and minor changes

* Fix bug
2017-07-13 20:33:05 -07:00
Kevin Cunnane
2a5ae06f12 Support "SQL" settings in addition to MSSQL (#398)
* 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.
2017-06-29 17:03:11 -07:00
Anthony Dresser
af2ed84953 Adds a execute and return result message (#383)
* inital request

* refactored query execution failure callback to take exception

* added failure callback to execute and return

* added test for query execute and return

* updated params

* removed dead code

* addressed feedback; added multiple active result set support; updated tests

* addessed feedback and added testing and errors and verification

* change <= to ==

* changed name of trashQ to removedQuery
2017-06-16 15:43:41 -07:00
Benjamin Russell
96d46b5c09 Include Internal Row ID with DbCellValue (#308)
Update to include the Row ID with a DbCellValue. This will be super useful to us for the purposes of managing individual rows via slick grid.

Although this changes the API for edit/subset and query/subset, it is effectively backwards compatible since it's adding a parameter, not removing anything.

* New DbCellValue has an internal Row ID

* Adding unit tests
2017-04-17 14:31:59 -07:00
Benjamin Russell
2eb60f45c9 Send Error Object on SendError (#304)
This change ensures that when calling `requestContext.SendError` you are only able to supply parameters that match the language service beta protocol expected Error object. In other words, you have to provide an error message and optionally and error code.

# **BREAKING API CHANGES**
This will break displaying errors in Microsoft/vscode-mssql. I will be making changes to properly handle the error object shortly.

* Adding contract for returning Error objects as per LanguageService "protocol"

* Fixes throughout codebase to send only error message in error cases
Cleanup of CredentialServiceTest unit test class
Adding standard error handling for event flow validator

* Adding optional data field as per protocol spec
https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md

* Adding optional validation for error objects
2017-04-05 14:47:37 -07:00
Benjamin Russell
e548ae67b5 Adding EditCell constructor validation (#301)
* New unit tests!
* New CopyTo method!
* New null validation!

YEAH!!!
2017-04-03 13:20:04 -07:00