Commit Graph

69 Commits

Author SHA1 Message Date
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
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
Kate Shin
cdfdd7bd5a Fix backup service to have multiple backup instances (#396)
* Allow multiple backups per backup service instance

* Add test to run multiple backups

* Update backup cancelTask method signature

* Fix to have multiple backup instances and add more tests

* Address PR comments

* Remove double new lines

* Add Azure check for backup operations
2017-06-26 16:21:09 -07:00
Kevin Cunnane
81d031d5eb LanguageService must send result or intellisense hangs (#395)
* LanguageService must send result or intellisense hangs
- Unless the language services methods return results for requests, the VSCode language service protocol will never send a response up to its higher-level code. This means with intellisense off, it appears to hang instead of saying "No results found". This is clearly sub-optimal and if any other extension wants to provide SQL suggestions, it would break them from sending results
- Minor refactor to fully remove Instance-field references in the code
2017-06-23 13:36:43 -07:00
Leila Lali
c28a97e6fa Fix/integrationtests (#391)
* fixed the problem with parsing sql2017 version
2017-06-22 09:20:58 -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
Kate Shin
a646d627c6 Register backup to task service for execution (#381)
* Create backup task for execution

* Register backup to task service

* Fix backup task service

* Fix async methods

* Add backup unit test

* Add cancellation token to task service and fix other PR comments

* Add SR and fix other pr comments

* Add comments to methods

* Fixed backup cancel test and casing

* Change sleep time in test
2017-06-16 14:01:09 -07:00
Leila Lali
71b349f67b Supporting SQL DW in Object explorer (#380)
* supporting sql dw in oe
2017-06-15 12:53:32 -07:00
Leila Lali
d9e68831ab fixed the tests for task service (#384)
* fixed the tests for task service
2017-06-15 12:49:20 -07:00
Leila Lali
85dc0b9ae2 setting user status in oe if user is disabled (#378)
* setting user status in oe if disabled
2017-06-14 15:54:50 -07:00
Leila Lali
58f438176b fixed couple of issues in task service (#377) 2017-06-12 15:52:49 -07:00
Kevin Cunnane
869cd1439f Add LanguageFlavorNotification handling and refactor LanguageService (#375)
* Add LanguageFlavorNotification handling and refactor LanguageService
- Added new notification handler for language flavor changed
- Refactored the LanguageService so that it no longer relies on so many intertwined static calls, which meant it was impossible to test without modifying the static instance. This will help with test reliability in the future, and prep for replacing the instance with a service provider.

* Skip if not an MSSQL doc and add test

* Handle definition requests

* Fix diagnostics handling
2017-06-12 13:28:24 -07:00
Leila Lali
b0263f8867 Added task service (#374)
* Added task service
2017-06-12 11:02:57 -07:00
Leila Lali
b60a865706 handling offline and inassisable db in oe (#369)
* handling offline and inassisable db in oe
2017-06-07 12:21:24 -07:00
Leila Lali
950b44137b using the new smo method to initialize the smo collections (#367)
* using the new smo method to initialize the smo collections
2017-06-02 16:07:21 -07:00
Kevin Cunnane
29c9b5fa51 Edit data schema and SQLAuth support (#362)
- 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
2017-05-26 14:19:18 -07:00
Kevin Cunnane
a4c630d5d3 Avoid throwing exception in LangageService for OE connections (#361)
* Ensure connection open for OE queries and fix connection disposal
- Dispose connection in Metadata service, to ensure we cleanly dispose and don't rely on garbage colleciton
- Fixed issue where if the connection was closed, expanding databases in the Server would fail. This is because SMO doesn't always reopen the connection, certainly not for Server level queries. The solution is to always check if open and reopen.
- Added unit tests for this, which required mocking the relevant IsOpen / OpenConnection methods. Refactored SMO wrapper calls into a dedicated class file to handle this

* Avoid throwing exception in LangageService for OE connections
- Handle non-File URIs by skipping language service binding in those cases. Added test for this

- VSCode passes untitled:, git: and other paths, often without a '/'. Updated logic to handle this.

* Handle windows file paths
2017-05-26 13:11:26 -07:00
Kevin Cunnane
bbd0972dde Ensure connection open for OE queries and fix connection disposal (#359)
* Ensure connection open for OE queries and fix connection disposal
- Dispose connection in Metadata service, to ensure we cleanly dispose and don't rely on garbage colleciton
- Fixed issue where if the connection was closed, expanding databases in the Server would fail. This is because SMO doesn't always reopen the connection, certainly not for Server level queries. The solution is to always check if open and reopen.
- Added unit tests for this, which required mocking the relevant IsOpen / OpenConnection methods. Refactored SMO wrapper calls into a dedicated class file to handle this
2017-05-25 18:26:52 -07:00
Leila Lali
63372d327e Object explorer notifications (#354)
* changing oe protocols to send notifications
2017-05-23 09:30:11 -07:00
Leila Lali
6920e6bfd3 OE system folders and removing some nodes (#353)
* OE system objects for system database
2017-05-19 12:02:34 -07:00
Karl Burtram
dc3cd9ea59 Create DB work in-progress (#350)
* Stage changes to other machine

* Stage changes

* Update SMO to fix SMO missing Login bug on macOS
2017-05-15 18:48:04 -07:00
Karl Burtram
848cfadf9a Delete more unneeded sql manager UI code (#345) 2017-05-11 17:54:52 -07:00
Brian O'Neill
7625c8d83d Add command line option to specify the logging directory (#336)
Two changes in this PR:
* Add a --log-dir command line parameter and fix command line parsing
* Fix command line parsing where arguments with parameter were parsed incorrectly
2017-05-10 08:55:46 -07:00
Karl Burtram
2e9843cec1 Merge create db work in progress (#341)
* 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
2017-05-09 17:56:32 -07:00
Leila Lali
0d570fa29b Fixed node labels, status, sub types (#338) 2017-05-09 09:33:25 -07:00
Henry Phan
f50f30b493 Changes to sqltoolsservice to allow empty password for SqlLogin (#333)
* Initial changes to allow empty passwords

* Added in empty password test

* Modifying test to work after my changes.
2017-05-02 10:17:44 -07:00
Matt Irvine
fb239ac956 Support connecting with a connection string (#334)
- 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
2017-05-01 21:01:26 -07:00
Leila Lali
0b39408eae added handler for oe refresh and close session requests (#332)
* added handler for oe refresh and close session requests
2017-05-01 15:20:02 -07:00
Leila Lali
51916c2221 Implemented the oe filtering (#328)
* Implemented the oe filtering
2017-04-26 14:48:17 -07:00
Karl Burtram
1a16101381 Initial admin and DR services. (#329)
* Add initial services for admin, tasks, and DR

* Fix up some of the contract interfaces

* Make fields public to allow Json.Net to work

* Fix a couple issues in backup contracts
2017-04-26 10:29:15 -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
Benjamin Russell
e65699ef75 Removing optional data property from Error response class (#325)
* Removing optional data property from Error response class

* Fixing broken unit tests
2017-04-24 13:45:33 -07:00
Raymond Martin
8206c70994 Removing hardcoded constant (#326) 2017-04-20 19:05:32 -07:00
Abbie Petchtes
809254d2e2 Fix the OE service where returns database as the root node for database connection (#322)
* Fix the OE service where retuns database as the root node if the connection contains database name

* Fix OE tests

* addressed the comments

* addresses comment

* fix OE test and add more tests

* fix VerifyAdventureWorksDatabaseObjects test
2017-04-20 12:33:49 -07:00
Monasr
3a6b3e8f81 Latest SQLToolservice XLIFF with SSDTrecycling (#319)
* Latest SQLToolservice XLIFF with SSDTrecycling

* adding generated SRGen RESX files
2017-04-19 14:31:57 -07:00
Raymond Martin
84ec20d2ae Fix for srGen designer issues (#321)
* removing designer files

* adding designer files to gitignore

* updating refs and tests
2017-04-19 11:08:45 -07:00
Leila Lali
8c0885da88 adding metadata to object explorer node info (#320)
* adding metadata to oe node info
2017-04-19 08:32:39 -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
Leila Lali
a1bc1bc344 fixed the issue with loading dlls for service provider (#312)
* fixed the issue with loading dlls for service provider
2017-04-13 15:57:56 -07:00
Leila Lali
d903ba56a9 Object Explorer Service (#311)
* moving OE service from an old branch
2017-04-11 15:50:20 -07:00
Kevin Cunnane
f3bf330da6 Connect with different properties should actually change context (#307)
* 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
2017-04-06 11:25:59 -07:00
Raymond Martin
ea5b151dcd Removing unused constants (#299)
* removing unused constants

* updating test strings

* adding edit data string

* fixing tests
2017-04-05 15:49:44 -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
Benjamin Russell
65456ae35b Returning EditCell in EditRows (#302)
Instead of returning DbCellValues inside an EditRow, we should be returning EditCells. This way we can preserve dirty state when scrolling.
2017-04-03 13:12:53 -07:00
Benjamin Russell
42498446cc Implicit Revert Row Cleanup Logic (#297)
This change enhances the way that edit/updateCell and edit/revertCell operations are performed. 

## **THE API BREAKING CHANGES**:
* edit/updateCell now returns an EditCell (a DbCellValue with a dirty flag) and a row dirty flag.
* edit/revertCell now returns an EditCell (a DbCellValue with a dirty flag) and a row dirty flag.

If by setting the value of a cell via edit/updateCell the row no longer has any edits (an "implicit revert"), the entire row's edit will be removed from the cache. Additionally, if by requesting edit/revert all the pending edits for a row are removed, the entire row's edit will be removed from the cache. This will prevent issues where committing will generate an invalid script because it has no pending changes.

* Adding EditCell class
Returning EditCell with EditUpdateCellResult

* Adding code that will remove a row update if the row is clean after a cell update

* Adding code that will return an EditCell and row dirty flag when a cell is reverted.
If the row is reverted by the cell revert, the pending update will be removed

* Comments for edit cell

* Changes as per pull request comments
2017-03-29 13:51:29 -07:00
Benjamin Russell
f7036f3f73 Adding decoding of multipart identifiers, default schema workaround (#295)
This change adds a couple things

_Multipart Identifier Decoding_
The ability to decode a multipart identifier (with or without escaping) has been added to the SqlScriptFormatter utility class. This code is utilized to split a table name provided to the edit/initialize request into schema and table name.

_Default Schema Workaround_
The code that retrieves the SMO metadata objects originally used the `[]` operator to access the objects. Due to a bug(?) in SMO, this results in problems when loading tables without a default schema (in our case if you're logged in as SA). Using the metadata object constructors gets around this issue, we are explicitly using them.

* Adding decoding of multipart identifiers
Adding code fix for default schema issue

* Adding some more localizable strings for errors when loading metadata

* Adding localization files... again?

* Changes as per pull request comments
2017-03-27 17:14:21 -07:00
Benjamin Russell
1909310a92 Important bug fixes for edit/commit (extended property check) (#294)
* Ensures that metadata is "extended" before creating a new row edit object
* Adds the commit handler to edit data service initialization calls
* Unit tests for the associated changes
2017-03-24 15:11:27 -07:00
Leila Lali
d81fa347e5 fixed an issue with setting a boolean option to string (#291)
* fixed an issue with setting an option which Boolean to string
2017-03-24 10:16:55 -07:00
Benjamin Russell
991421c6f8 Support TOP n When Initializing Edit Sessions (#290)
* Start of edit initialize filtering

* Implementation to utilize filtering

* Unit tests for the refactoring

* Unit tests for query construction
2017-03-22 17:32:41 -07:00