* 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
* 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
* 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
* 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
* 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
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
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
* 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
* 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
Very small feature add to make sure that values entered for `TIME` columns are < 24hrs. If the value is >=24hrs when setting the column, an exception will be thrown that the edit/updateCell handler will catch and convert into an error on the JSON RPC side.
* Adding validation of timespan columns
* Fixing a merge conflict
// edit/dispose -------------------------------------------------------------------------------
export interface EditDisposeParams extends IEditSessionOperationParams { }
export interface EditDisposeResult { }
* Initial plumbing for edit/revertCell
* Implementation of revert cell in the parents of the row edit base
* Adding unit tests
Returns strings for the default value of a column when a new row is created. The values that could come back:
* `null` when there isn't a default for the column
* a string when there is a default for the column
* a placeholder (currently <TBD>) when the column cannot be updated
* Renaming EditTableMetadata to reflect its SMO source
* Implementation of returning default values
* Unit test for default values
* Reworking column defaults using default constraints
* Adding unit test for new sql script unwrapper
* Disabling flaky test
* Fixing oddities in tests, removing personal tests
* Fixing broken unit test
The main goal of this feature is to enable a command that will
1) Generate a parameterized command for each edit that is in the session
2) Execute that command against the server
3) Update the cached results of the table/view that's being edited with the committed changes (including computed/identity columns)
There's some secret sauce in here where I cheated around worrying about gaps in the updated results. This was accomplished by implementing an IComparable for row edit objects that ensures deletes are the *last* actions to occur and that they occur from the bottom of the list up (highest row ID to lowest). Thus, all other actions that are dependent on the row ID are performed first, then the largest row ID is deleted, then next largest, etc. Nevertheless, by the end of a commit the associated ResultSet is still the source of truth. It is expected that the results grid will need updating once changes are committed.
Also worth noting, although this pull request supports a "many edits, one commit" approach, it will work just fine for a "one edit, one commit" approach.
* WIP
* Adding basic commit support. Deletions work!
* Nailing down the commit logic, insert commits work!
* Updates work!
* Fixing bug in DbColumnWrapper IsReadOnly setting
* Comments
* ResultSet unit tests, fixing issue with seeking in mock writers
* Unit tests for RowCreate commands
* Unit tests for RowDelete
* RowUpdate unit tests
* Session and edit base tests
* Fixing broken unit tests
* Moving constants to constants file
* Addressing code review feedback
* Fixes from merge issues, string consts
* Removing ad-hoc code
* fixing as per @abist requests
* Fixing a couple more issues
* Initial credential service files
* Clean-up hostloader
* Update build scripts to build credentials archive
* Move hosting files to new assembly
* Add credentials files to MS.SqlTools.Credentials
* Remove duplicate files
* Update namespace in program.cs
* Fix test build breaks
* Update extensions visibility.
* Remove unused resource strings
* Add xproj files to SLN for appveyor builds
* Fix appveyor build break in test project
* Fix extensibility tests
* Fix various typos in latest iteration
* Add settings for Integration build
* Fix codecoverage.bat to use full pdb for new projects
* Fix bug when packing in folder with native images
* Fix typos in xproj
* Reset XLF to fix build.cmd
This is a very large change. I'll try to outline what's going on.
1. This adds the **EditDataService** which manages editing **Sessions**.
1. Each session has a **ResultSet** (from the QueryExecutionService) which has the rows of the table and basic metadata about the columns
2. Each session also has an **IEditTableMetadata** implementation which is derived from SMO metadata which provides more in-depth and trustworthy data about the table than SqlClient alone can.
3. Each session holds a list of **RowEditBase** abstract class implementations
1. **RowUpdate** - Update cells in a row (generates `UPDATE` statement)
2. **RowDelete** - Delete an entire row (generates `DELETE` statement)
3. **RowCreate** - Add a new row (generates `INSERT INTO` statement)
4. Row edits have a collection of **CellUpdates** that hold updates for individual cells (except for RowDelete)
1. Cell updates are generated from text
5. RowEditBase offers some baseline functionality
1. Generation of `WHERE` clauses (which can be parameterized)
2. Validation of whether a column can be updated
2. New API Actions
1. edit/initialize - Queries for the contents of a table/view, builds SMO metadata, sets up a session
2. edit/createRow - Adds a new RowCreate to the Session
3. edit/deleteRow - Adds a new RowDelete to the Session
4. edit/updateCell - Adds a CellUpdate to a RowCreate or RowUpdate in the Session
5. edit/revertRow - Removes a RowCreate, RowDelete, or RowUpdate from the Session
6. edit/script - Generates a script for the changes in the Session and stores to disk
7. edit/dispose - Removes a Session and releases the query
3. Smaller updates (unit test mock improvements, tweaks to query execution service)
**There are more updates planned -- this is just to get eyeballs on the main body of code**
* Initial stubs for edit data service
* Stubbing out update management code
* Adding rudimentary dispose request
* More stubbing out of update row code
* Adding complete edit command contracts, stubbing out request handlers
* Adding basic implementation of get script
* More in progress work to implement base of row edits
* More in progress work to implement base of row edits
* Adding string => object conversion logic and various cleanup
* Adding a formatter for using values in scripts
* Splitting IMessageSender into IEventSender and IRequestSender
* Adding inter-service method for executing queries
* Adding inter-service method for disposing of a query
* Changing edit contract to include the object to edit
* Fully fleshing out edit session initialization
* Generation of delete scripts is working
* Adding scripter for update statements
* Adding scripting functionality for INSERT statements
* Insert, Update, and Delete all working with SMO metadata
* Polishing for SqlScriptFormatter
* Unit tests and reworked byte[] conversion
* Replacing the awful and inflexible Dictionary<string, string>[][] with a much better test data set class
* Fixing syntax error in generated UPDATE statements
* Adding unit tests for RowCreate
* Adding tests for the row edit base class
* Adding row delete tests
* Adding RowUpdate tests, validation for number of key columns
* Adding tests for the unit class
* Adding get script tests for the session
* Service integration tests, except initialization tests
* Service integration tests, except initialization tests
* Adding messages to sr.strings
* Adding messages to sr.strings
* Fixing broken unit tests
* Adding factory pattern for SMO metadata provider
* Copyright and other comments
* Addressing first round of comments
* Refactoring EditDataService to have a single method for handling
session-dependent operations
* Refactoring Edit Data contracts to inherit from a Session and Row
operation params base class
* Copyright additions
* Small tweak to strings
* Updated unit tests to test the refactors
* More revisions as per pull request comments