Commit Graph

50 Commits

Author SHA1 Message Date
Alan Ren
200ebf0355 fix the select script gen issue for Synapse db (#1724) 2022-10-13 15:41:32 -07:00
Cheena Malhotra
006ac60923 Upgrade solution to .NET 6.0.9 (Build with .NET SDK v6.0.401) (#1692) 2022-09-16 11:27:52 -07:00
Jordan Hays
8bdf1d8451 Dropped Ledger Columns folders for ledger primary tables (#1688)
* dropped ledger columns strings, nodetypes, definition

* work in progress

* WIP- dropped columns folder showing for all tables

* Dropped Ledger Column folder only for primary ledger tables

* cleaning up

* undoing changes to kusto layer

* formatting

* undoing formatting

* undoing formatting

* removing IsLedger property and instead filtering on NodeTypeId

* updating column path test
2022-09-14 17:43:39 -07:00
Jordan Hays
93b7a4763b Adding filtering for dropped ledger columns on select script (#1663) 2022-08-30 13:16:55 -07:00
Jordan Hays
d78ff94b31 Ledger Objects Representation in Object Explorer (#1615)
* support for ledger objects in OE

* generated sr files

* update versionKey to sql 2022 in test env config

* more 2019 to 2022 updates

* add sql2022 instead of replacing

* missed filter on table

* add logging

* more logging

* adding Script160Compat options for sql2022

Co-authored-by: Alan Ren <alanren@microsoft.com>
2022-08-05 10:53:17 -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
Charles Gagnon
40c5d48c5e Fail build on unneeded usings (#1417) 2022-03-04 16:38:01 -08:00
Karl Burtram
5d5debbad6 Enable scripting for subobjects such as triggers (#1237)
* WIP 1

* Cleanups

* Change how schema is appended in to urn

* Add comment and fix incorrect condition

* Add parent type name to support Views, etc.
2021-08-26 13:06:15 -07: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
BranislavGrbicMDCS
962ba3a12b Adding Support for new engine edition (#876)
* Adding Support for SqlOnDemand

* Updating unit test per comment

* Resolving comments. Enabling external table for sqlondemand

* Resolving comments. Enabling External tables for sqlondemand

* Enabling external tables for sqlondemand
2019-10-16 23:29:57 +02:00
Amir Omidi
1c74e1af6f Create the file path on the tool service (#874)
* Create the file path on the tool service

* Add comment

* Modify comment

* Use Path.GetTempFileName()
2019-10-07 13:10:19 -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
Karl Burtram
27bcb96597 Enable scripting for SQL Server 2019 (#751) 2018-11-29 15:56:06 -08:00
Matt Irvine
7f28f249de Add support for Azure Active Directory connections (#727) 2018-11-13 11:50:30 -08:00
David Shiflet
f99061866c Upgrade SMO to 150 preview (#701)
* Switch to the unified SMO NuGet so all binaries are strong named and signed.

* use one AssemblyLoader instance for all loads

* Revert "use one AssemblyLoader instance for all loads"

This reverts commit 48c59ffd5c57152de281c87acdbcad7ddf7ab760.

* Stop creating multiple AssemblyLoadContext objects during composition, per https://github.com/dotnet/coreclr/issues/19632

* restore high entropyva property

* Improve the comment

* Update SMO to 150 and fix scripting for objects with a single quote in their name.

* restore newtonsoft reference
2018-10-03 18:33:40 -04: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
Leila Lali
fc4282b701 fixed the issue with defualt values for options not loaded correctly (#581) 2018-02-06 20:23:23 -05:00
Leila Lali
d20215cb19 added script as alter (#564)
* added script as alter
2017-12-07 12:49:38 -08:00
Leila Lali
e7b76a6dec Feature/script execute (#563)
* added script as execute for stored procedures
2017-12-05 13:17:51 -08:00
Leila Lali
6f32221496 fixed the issue with scripting a view with trigger in dw database (#554) 2017-12-01 14:50:14 -08:00
Leila Lali
ab332cba9b using existing connection for scripting as operation (#556)
* using connection binding queue for scripting to be able to use existing connection
2017-12-01 14:34:09 -08:00
Leila Lali
530b66fc54 Adding new handler for script as requests (#552)
* added new scripting handler for script as request
*change the language service to get the peek definition using scripting as operatin
2017-11-27 15:04:17 -08: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
Leila Lali
3bb86af10b Fix/scripting server name (#543)
* binding queue should not throw excpetion if fails to connect

* getting the server name using the server connection

* removed extra comment
2017-11-02 15:39:38 -07:00
Karl Burtram
4d04bff810 Revert "Scripting should await result of requestcontext.sendresult in case it errors" (#526)
* Revert "Add rowcount check so that no results error is sent for a query where no rows are returned (#525)"

This reverts commit 3392f93a2e.

* Revert "Add unknown status for DB Nodes whose status is not known (#524)"

This reverts commit 3d7b87eca2.

* Revert "Should await result of requestcontext.sendresult in case it errors (#520)"

This reverts commit caf196ea31.
2017-10-25 13:34:45 -07:00
Kevin Cunnane
caf196ea31 Should await result of requestcontext.sendresult in case it errors (#520)
- Refactored to use pattern where we wait on the binding queue action to complete, then send the result / error outside of that.
2017-10-25 12:06: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
Aditya Bist
a4376732ce peek and go to definition less verbose now (#484)
* peek and go to definition less verbose now

* untabify files
2017-10-10 10:56:10 -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
Aditya Bist
7444939335 Task/script refactor (#478)
* scripting working with race conditions

* new service works with no race conditions

* use new scripting service and commented out tests

* refactored peek definition to use mssql-scripter

* fixed peek definition tests

* removed auto gen comment

* fixed peek definition highlighting bug

* made scripting async and fixed event handlers

* fixed tests (without cancel and plan notifs)

* removed dead code

* added nuget package

* CR comments + select script service implementation

* minor fixes and added test

* CR comments and script select

* added unit tests

* code review comments and cleanup

* fixed failing scripting tests

* fixed failing scripting tests

* fixed select script test

* code review comments
2017-10-05 12:19:08 -07:00
Aditya Bist
05702182ab Task/script refactor (#476)
* scripting working with race conditions

* new service works with no race conditions

* use new scripting service and commented out tests

* refactored peek definition to use mssql-scripter

* fixed peek definition tests

* removed auto gen comment

* fixed peek definition highlighting bug

* made scripting async and fixed event handlers

* fixed tests (without cancel and plan notifs)

* removed dead code

* added nuget package

* CR comments + select script service implementation

* minor fixes and added test

* CR comments and script select

* added unit tests

* code review comments and cleanup

* fixed failing scripting tests
2017-10-03 14:41:18 -07:00
Karl Burtram
9091df8f62 Fix some issues with Script As Select (#474) 2017-10-03 14:39:29 -07:00
Aditya Bist
e7756b0bf1 Task/script refactor (#446)
* scripting working with race conditions

* new service works with no race conditions

* use new scripting service and commented out tests

* refactored peek definition to use mssql-scripter

* fixed peek definition tests

* removed auto gen comment

* fixed peek definition highlighting bug

* made scripting async and fixed event handlers

* fixed tests (without cancel and plan notifs)

* removed dead code

* added nuget package

* CR comments + select script service implementation

* minor fixes and added test

* CR comments and script select

* added unit tests

* code review comments and cleanup
2017-10-02 12:02:43 -07:00
Karl Burtram
84ea045572 XEvent Profiler initial event handlers (#456)
* 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
2017-09-12 14:08:50 -07:00
Kate Shin
14ec5be961 Create remote file browser service (#448)
* code refactoring

* Add filebrowser service and tests

* change dataset reference

* Address pr comments

* add more tests

* address pr comments

* address pr comments and added more tests

* minor change

* minor fix

* Fix test break and add dataset result check
2017-09-08 13:57:56 -07:00
Aditya Bist
3915688332 added support for more object scripting (#435)
* added support for more object scripting

* allow using script options in scripting

* added tests for scripting all objects
2017-08-16 17:11:41 -07:00
Brian O'Neill
a4a27f9559 Merging mssql-scripter changes (#430)
* Manual port of latest 'feature/mssq-scripter' branch

* Bumpnuget package SqlScriptPublishModel.140.2.0 to Microsoft.SqlServer.Management.SqlScriptPublishModel.140.2.3

* In TestDriver, fix the path to Microsoft.SqlTools.ServiceLayer.exe after move to .NET Core 2.0
2017-08-09 08:25:13 -07:00
Kevin Cunnane
3aba287759 Fix #911 handle perforce files (#400)
- Additional handling of document events with "perforce:" or other SCM strings
- Much of the handling had been added already, but adding in additional validation and ensuring that everywhere `Workspace.GetFile` is called we add a not-null check to avoid null reference errors
2017-07-05 13:25:05 -07:00
Leila Lali
0d00534f6a setting timeout for oe tasks (#363) 2017-05-26 21:54:45 -07:00
Brian O'Neill
8a54435a9c Fix scripting data in the scripting service (#337)
A regression was introduced in the scripting service refactoring where data is no longer scripted. This commit fixes the issue, and updates the tests to catch this in the future.

The issue is in the getter for SqlScriptPublishModel.AdvancedOptions, there is some strange logic which will cause the SqlScriptPublishModel.AdvancedOptions to get reset and lose all values based the ordering of when SqlScriptPublishModel.ScriptAllObjects is set.  In the scripting service refactoring, we started to hit this reset of the AdvanceOptions, which would lose the option to script data, along with other options.

To workaround this, we initialize with SqlScriptPublishModel.ScriptAllObjects to true, and then set all SqlScriptPublishModel.AdvancedOptions values.  Then, we set SqlScriptPublishModel.ScriptAllObjects, and avoid calling the SqlScriptPublishModel.AdvancedOptions getter.

Also including some misc scripting service changes:
1) Adding a sequence number field to the scripting operation events
2) Adding a error message to scripting progress events
3) Expect a null scripting option parameter
4) Correctly set the exception message and details for json-rpc events
5) More logging
2017-05-10 12:06:59 -07:00
Brian O'Neill
4aac4a4047 Add scripting API implemented by the SqlScriptPublishModel (#316)
Update the ScriptingService to expose new scripting JSON-RPC APIs that use the SqlScriptPublishModel for script generation.

The SqlScriptPublishModel is the model behind the SSMS scripting wizard. To enable scripting for CLI tools, we've ported SqlScriptPublishModel to .NET Core. The SqlScriptPublishModel wraps the SMO scripting APIs for .sql script generation.

1) Added three new requests to the ScriptingService: ScriptingRequest, ScriptingListObjectsRequest, ScriptingCancelRequest.
2) Generating scripts are long running operations, so the ScriptingRequest and ScriptingListObjectsRequest kick off a long running scripting task and return immediately.
3) Long running scripting task reports progress and completion, and can be cancelled by a ScriptingCancelRequest request.
4) Bumped the SMO nuget package to 140.17049.0. This new version contains a signed SSMS_Rel build of SMO with the SqlScriptPublishModel.
5) For testing, adding the Northwind database schema

TODO (in later pull requests)
1) Integrate the new ScriptingService APIs with the ConnectionService
2) Integrate with the metadata support recently added
2017-04-24 16:10:20 -07:00
Aditya Bist
06eddd57f4 Task/batch parser wrapper tests (#314)
* added more batch parser tests

* fixed merge conflicts

* change debug type to portable

* fixed imports according to review
2017-04-21 11:59:20 -07:00
Aditya Bist
9e8e1df95e fixed peek definition tokenizing (#281)
* fixed peek definition tokenizing

* fixed signature help test

* added new heuristic for PeekDefinition behaviour

* added tests for new heuristic

* fixed code according to Kevin's CR

* fixed failing test due to shared connection

* changed uri for procedure test
2017-03-23 13:19:59 -07:00
Benjamin Russell
16b3874f28 Remove SELECT * from edit/initialize Query (#288)
* Major refactor of EditDataMetadata providers

* EditMetadataFactory generates "basic" EditTableMetadata objects based entirely on SMO metadata
* SmoEditTableMetadata no longer depends on SMO, making it unecessary to mock it
* Renamed SmoEditTableMetadata to EditTableMetadata
* EditTableMetadata can be extended with DbColumnWrappers

* Moving logic for extending a EditColumnMetadata into that class

* I *think* this will work for async execution of initialize tasks

* Fixing unit tests for new Edit(Table|Column)Metadata classes

* Async stuff that works! And passes unit tests

* Adding unit tests
Adding .idea to gitignore

* Adding message to the EditSessionReadyEvent

* Fixes from dev merge

* Fixing unit tests that Rider didn't catch as failing
May have been a bit heavy-handed with the async/await stuff

* Couple changes as per PR comments
2017-03-22 10:53:24 -07:00
Karl Burtram
addad29b7c Add Scripter class and use it in the ScriptingService (#286)
* Initial scripting commit

* Fix the script CREATE integration test

* Use language service binding queue for scripting

* Update scripting service to have methods for each operation

* Add scripter class

* Fix build break.

* Fix a few bugs

* Use scripter class instead of PeekDefinition class.

* Fix scripting test break

* Fix header incorrectly saying file is generated.

* Add localization tests to address a large block of code not covered by automation.

* Moving system usings to top of using list
2017-03-21 13:18:52 -07:00
Karl Burtram
7ba2011a1e Initial metadata and scripting services (#280)
* Initial metadata service and scripting service files

* Simple metadata lookup with SMO objects

* Add metadata type class

* Remove SMO from metadata service.

* Cleanup metadata service SQL

* Initial MetadataService test

* Add scripting commands

* Add metadata test case

* Remove sleep used for testing

* Use random table name in metadata test

* Add scripting tests
2017-03-14 22:35:17 -07:00