Commit Graph

385 Commits

Author SHA1 Message Date
Benjamin Russell
e71bcefb28 Feature: Progressive Messages (#208)
This change is a reworking of the way that messages are sent to clients from the service layer. It is also a reworking of the protocol to ensure that all formulations of query send back events to the client in a deterministic ordering. To support the first change:
* Added a new event that will be sent when a message is generated
* Messages now indicate which Batch (if any) generated them
* Messages now indicate if they were error level
* Removed message storage in Batch objects and BatchSummary objects
* Batch objects no longer have error state
2017-01-10 16:42:03 -08:00
Karl Burtram
a77fb77a85 Update building_sqltoolsservice.md (#212) 2017-01-09 11:01:35 -08:00
Sharon Ravindran
e186ffa3f2 Reuse existing ServerConnection in PeekDefinition (#209) 2017-01-06 12:17:48 -08:00
Leila Lali
379decf4e9 added support for QUOTED_IDENTIFIER in auto complete list (#190)
*  added support for QUOTED_IDENTIFIER in auto complete list
2017-01-04 14:03:10 -08:00
Connor Quagliana
3ad7cc1a8b Move Integration Tests to dedicated project (#201)
Add IntegrationTests project. Move all tests ifdef'd with LIVE_CONNECTION_TESTS to IntegrationTests project. Delete files that have no remaining code. Update codecoverage.bat to run integration tests
2017-01-04 11:37:57 -08:00
Karl Burtram
5b41538d22 Turning off a broken test until a fix can be merged (#207) 2017-01-03 13:28:48 -08:00
Karl Burtram
93a52e3e50 Add a couple more images to docs (#206)
* Add service loader image to docs.

* Add connection service image.

* Fix image width
2017-01-03 12:42:44 -08:00
Benjamin Russell
a8d627b07c Fixing by moving the result submission to before execution starts (#204) 2016-12-30 13:30:05 -08:00
Karl Burtram
323374d123 More documentation updates. (#205)
* Add additional documentation.

* More docs updates.

* Update docs.  Add building info.
2016-12-22 18:44:45 -08:00
Karl Burtram
d5f19031f2 More documentation updates (#203)
* Update docs 1

* MOre oc updates

* Another set of doc updates

* Few more doc cleanups
2016-12-22 01:27:15 -08:00
Benjamin Russell
7ea1b1bb87 Move Save As to ResultSet (#181)
It's an overhaul of the Save As mechanism to utilize the file reader/writer classes to better align with the patterns laid out by the rest of the query execution. Why make this change? This change makes our code base more uniform and adherent to the patterns/paradigms we've set up. This change also helps with the encapsulation of the classes to "separate the concerns" of each component of the save as function. 

* Replumbing the save as execution to pass the call down the query stack as QueryExecutionService->Query->Batch->ResultSet
    * Each layer performs it's own parameter checking
        * QueryExecutionService checks if the query exists
        * Query checks if the batch exists
        * Batch checks if the result set exists
        * ResultSet checks if the row counts are valid and if the result set has been executed
    * Success/Failure delegates are passed down the chain as well
* Determination of whether a save request is a "selection" moved to the SaveResultsRequest class to eliminate duplication of code and creation of utility classes
* Making the IFileStream* classes more generic
    * Removing the requirements of max characters to store from the GetWriter method, and moving it into the constructor for the temporary buffer writer - the values have been moved to the settings and given defaults
    * Removing the individual type writers from IFileStreamWriter
    * Removing the individual type writers from IFIleStreamReader
* Adding a new overload for WriteRow to IFileStreamWriter that will write out data, given a row's worth of data and the list of columns
* Creating a new IFileStreamFactory that creates a reader/writer pair for reading from the temporary files and writing to CSV files
* Creating a new IFileStreamFactory that creates a reader/writer pair for reading from the temporary files and writing to JSON files
* Dramatically simplified the CSV encoding functionality
* Removed duplicated logic for saving in different types and condensed down to a single chain that only differs based on what type of factory is provided
* Removing the logic for managing the list of save as tasks, since the ResultSet now performs the actual saving work, there's no real need to expose the internals of the ResultSet
* Adding new strings to the sr.strings file for save as error messages
* Completely rewriting the unit tests for the save as mechanism. Very fine grained unit tests now that should cover majority of cases (aside from race conditions)


* Refactoring maxchars params into settings and out of file stream factory

* Removing write*/read* methods from file stream readers/writers

* Migrating the CSV save as to the resultset

* Tweaks to unit testing to eliminate writing files to disk

* WIP, moving to a base class for save results writers

* Everything is wired up and compiles

* Adding unit tests for CSV encoding

* Adding unit tests for CSV and Json writers

* Adding tests to the result set for saving

* Refactor to throw exceptions on errors instead of calling failure handler

* Unit tests for batch/query argument in range

* Unit tests

* Adding service integration unit tests

* Final polish, copyright notices, etc

* Adding NULL logic

* Fixing issue of unicode to utf8

* Fixing issues as per @kburtram code review comments

* Adding files that got broken?
2016-12-21 17:52:34 -08:00
Karl Burtram
adc9672fa3 More documentation updates (#202)
* Add some content to the design page.

* More design doc updates

* Update user guide docs
2016-12-21 16:23:14 -08:00
Karl Burtram
4184eae8a1 Update docs (#200)
This is a documentation-only update so automerging.  Please review the commit if there are any follow-ups requested.

* Update .gitignore for docfx genertated files

* Update documenation (part 1)

* Update docs and add some samples

* More doc updates
2016-12-20 15:52:46 -08:00
Benjamin Russell
1e59166147 Event Flow Validator (#199)
This is a reworking of the unit tests to permit us to better test events from the service host. This new Event Flow Validator class allows creating a chain of events that can then be validated after execution of the request. Each event can have its own custom validation logic for verifying that the object sent via the service host is correct. It also allows us to validate that the order of events are correct.

The big drawback is that (at this time) the validator cannot support asynchronous events or non-determinant ordering of events. We don't need this for the query execution functionality despite messages being sent asynchronously because async messages aren't sent during unit tests (due to the db message event only being present on SqlDbConnection classes). If the need arises to do async or out of order event validation, then I have some ideas for how we can do that.

* Applying the event flow validator to the query execution service integration tests

* Undoing changes to events that were included in cherry-picked commit

* Cleaning up event flow validation to query execution

* Add efv to cancel tests

* Adding efv to dispose tests

* Adding efv to subset tests

* Adding efv to SaveResults tests

* Copyright
2016-12-20 11:59:03 -08:00
Benjamin Russell
0f19de38fb Date & Time Type Fixes (#196)
This basically is a replacement to the fix for Adding Milliseconds to DateTime fields. I didn't take into consideration that `DATE` columns would report as DateTime type. Date columns have a numeric scale set to 255, leading to the formatting string for the date time to include 255 millisecond places, which is invalid.

This change also reverses the change to store DateTime precision in the buffer file. Instead, the column metadata is now used when deserializing the rows from the db. `DATETIME` and `DATETIME2` columns are differentiated by their numeric scale while `DATE` columns are differentiated by their datatype name field.

More unit tests were added. Additionally, this fixes an unreported bug that `DATE` columns were being displayed with times, which is incorrect.

* Revert "Adding Milliseconds to DateTime fields (#173)"

This reverts commit 431dfa4156.

* Reworking the reader to use the column metadata for date types

* DbColumn -> DbColumnWrapper

* Fina tweaks to support DATETIME2(0)

* Removing the unused arguments
2016-12-20 11:22:00 -08:00
Benjamin Russell
1ada659a8a Getting rid of new methods in favor of just assigning the base (#198)
This change is a refactor of the DbColumnWrapper class. This fixes a huge oversight/gotcha in the DbColumnWrapper where treating the DbColumnWrapper as a DbColumn (ie, polymorphism) would result in almost all the fields of the column being null. This is a highly unexpected behavior. This change fixes that.
2016-12-19 15:27:13 -08:00
Connor Quagliana
ba12a80fbf Add fix for SendEvent causing test to fail (#195)
Add flag in ServiceHost to ignore SendEvent errors
2016-12-19 14:01:03 -08:00
Aditya Bist
1a2e802a5d Merge pull request #191 from Microsoft/customerIssue/escapeReservedWordsAutocomplete
reserved words with brackets in autocomplete
2016-12-19 11:25:18 -08:00
Aditya Bist
cde7bd49b3 added tests for new scenario 2016-12-19 10:53:20 -08:00
Benjamin Russell
0bee0147d9 Revert "Adding Milliseconds to DateTime fields (#173)" (#197)
This reverts commit 431dfa4156.
2016-12-16 16:37:32 -08:00
Karl Burtram
d10c9c4cae Link to SQL Tools Service API documentation from readme.md 2016-12-16 12:32:24 -08:00
Karl Burtram
4964a52be5 Initial docfx documentation placeholder files (#194)
This is documentation changes only so I'm just going to merge directly.  The PR is for FYI purposes.   Please leave feedback on the commit if you see anything I should follow-up on with this documentation.
2016-12-16 12:11:27 -08:00
Connor Quagliana
319c5ef7ed Merge pull request #193 from Microsoft/bug/addGetSignatureHelpTest
Add positive test for GetSignatureHelp
2016-12-16 11:08:34 -08:00
Karl Burtram
0d101cf598 Add text utils unit tests and parameter comments. (#192)
* Add unit tests for PositionOfCursor

* Add unit tests for PositionOfCursor
2016-12-15 14:22:39 -08:00
Aditya Bist
ac28d3b78f fixed changes according to review 2016-12-15 13:59:34 -08:00
Connor Quagliana
2db585ad63 Removed #define 2016-12-15 13:46:25 -08:00
Connor Quagliana
b5cd9d6359 Changed line parameter to zero-indexed 2016-12-15 13:45:29 -08:00
Sharon Ravindran
5d2bf7fbe4 Feature/delete peek scripts (#174)
* Delete temp script folder

* Delete folder and refactor code

* Add unit tests

* create folder per workspace

* Refactor and move creation to FileUtils

* Separate multiple assignment
2016-12-15 13:34:33 -08:00
Connor Quagliana
d5de4c8b21 Merge branch 'dev' into bug/addGetSignatureHelpTest 2016-12-15 12:01:00 -08:00
Connor Quagliana
2f1debc7c9 Added positive test for GetSignatureHelp 2016-12-15 11:40:10 -08:00
Aditya Bist
6e746efad0 reserved words with brackets in autocomplete 2016-12-15 11:12:36 -08:00
Sharon Ravindran
9c6162282a Add error handling for Azure Exceptions (#177)
* Add error handling for Azure Exceptions

* Add SRGen for string

* Add specific exception messages

* Move DefinitionResult class

* Add SqlLogin constant

* Add error scenarios

* revert timeout duration

* Modify tests

* Modify tests

* Add tests

* Revert live connection definition

* Modify DefinitionsHandlerWithNoConnectionTest

* fix test after merge

* Code review changes

* Code review changes

* Code review changes
2016-12-14 16:04:47 -08:00
Karl Burtram
6f15ac0b8f Don't call SR generated constructors (#189) 2016-12-14 14:35:45 -08:00
Kevin Cunnane
0bb1c39052 Revert NetCore target to 1.0.0 to fix Jenkins (#188)
* Revert NetCore target to 1.0.0 to fix Jenkins
- Changing to 1.* ends up requiring .Net Core 1.1 to be install on the machine. We need a better solution that can work around this and let us stay on 1.0 for now. Checking in to unblock builds, will fix Travis CI later.

* Installing dotnet as part of Travis setup. There is a build in dotnet: argument that uses dotnet-install scripts and supports specific version installation
2016-12-14 14:10:10 -08:00
Karl Burtram
dd41e0545a Add tests to improve code coverage (#187)
* DbColumn and ReliableConnection tests

* More retry connection tests

* More tests

* Fix broken peek definition integration tests

* Fix test bug

* Add a couple batch tests

* Add some more tests

* More tests for code coverage.

* Validation and Diagnostic tests

* A few more tests

* A few mote test changes.

* Update file path tests to run on Windows only
2016-12-14 13:49:42 -08:00
Leila Lali
e9398f7182 Sending status change notifications from server (#186)
* Sending status change notifications from server
2016-12-14 13:19:02 -08:00
Anthony Dresser
8cb35d00a6 Spelling mistake in readme
Fixed spelling mistake in readme that was causing appveyor icon to show up as link
2016-12-14 10:57:04 -08:00
Kevin Cunnane
9140f02b0d AppVeyor batch and Coveralls token (#184)
* AppVeyor batch and Coveralls token

* AppVeyor.yml no longer used in AppVeyor build

* AppVeyor badge uses public URL
2016-12-13 17:58:50 -08:00
Anthony Dresser
d950b751d8 Coveralls + AppVeyor + Travis CI (#171)
* added build files

* changed build script

* revert dotnet version to older one

* added osx building

* added appveyor build

* added ruby upload code coverage

* added gulp cli to downloads

* added gulp util to deps

* added through2 to deps

* added cask install for dotnet

* added coveralls gem install to appveyor

* fixed ruby script

* change upload to be gulp

* updated call

* added test for nin

* testing

* testing

* testing

* added coveralls nuget

* echoed path

* added code coverage badge

* updated cmd

* fixed syntax error

* added dotnet to path

* added manual call to dotnet

* iterate

* change directory

* commit

* added start to dotnet core version

* changed appveyor

* updated dotnet versions

* updated readme

* removed unnec de

* customize for microsoft

* specified encrypted key in appveyor

* updated readme; added newlines

* added branches to ymls

* updated ymls
2016-12-13 11:30:30 -08:00
Karl Burtram
b99b01cae0 Peek definition for Azure DB objects (#179)
* Working...

* Call refresh on SmoObject to switch status from creating to existing.

* Add logging to exeception handlers
2016-12-13 09:27:07 -08:00
Karl Burtram
df9e207e5f Bump SMO to 140.1.12 to pickup Azure DB fixes (#183) 2016-12-12 22:55:26 -08:00
Leila Lali
68a83814d5 fixed the broken perf test (#180)
* fixed the broken perf test
2016-12-12 16:23:33 -08:00
Karl Burtram
5c2e6b74cf Catch exceptions raised sending telemetry events (#182) 2016-12-12 15:50:08 -08:00
Connor Quagliana
40c1434745 Fixed null ref exception in GetSignatureHelp (#175)
- Fixed a few places where ScriptParseInfo was being used before it was verified to be non-null
- Added 1 basic test for GetSignatureHelp scenario
2016-12-09 15:18:08 -08:00
Benjamin Russell
431dfa4156 Adding Milliseconds to DateTime fields (#173)
This is a slightly larger change than anticipated due the difference between `DATETIME`, `DATETIME2`, and `DateTime`. The `DATETIME` type always uses 3 decimal points of a second, while the `DATETIME2` type has 7 (although since `DATETIME2(7)` is default in SSMS suggesting that it is a variable precision type). Regardless of the db type, the engine returns `DateTime` C# type. The db types are only made visible via the column info, via the numeric precision and numeric scale. My findings were as such:
`DATETIME `: Precision = 23, Scale = 3
`DATETIME2`: Precision = 255, Scale = 7

The scale corresponds neatly with the number of second decimal points to show. The buffer file writer was modified to store both the scale and the number of ticks. Then the buffer file reader was modified to read in the precision and the number of ticks and generate the ToString version of the DateTime to add "f" as many times as there is scale, which corresponds to milliseconds.

* Code for writing milliseconds of datetime/datetime2 columns

* Adding unit tests

* Fixing potential bug with datetime2(0)
2016-12-09 12:46:17 -08:00
Leila Lali
9526b4dd49 changing the telemetry event name incase the other one is used by vs code 2016-12-08 15:23:21 -08:00
Leila Lali
7d37431c0d fixed connection service tests 2016-12-08 14:12:34 -08:00
Leila Lali
0b295e78c2 adding a new event for when definition is requested (#167)
* sending telemetry events for intellisense usage
2016-12-08 14:05:42 -08:00
Benjamin Russell
54f30887cc Batch Start Notification (#169)
This change is part of the progressive results code. It will submit a notification from the service layer to indicate when execution of a batch has completed. This notification will contain the selection for batch, execution start time, and its ID. This will enable the extension to produce a header for the batch before the batch completes, in order to make it more clear to the user that execution is going on.

* Adding new event for batch start

* Unit tests

* Fixing comments as per @kevcunnane
2016-12-08 11:23:08 -08:00
Sharon Ravindran
ab97948005 Fix/peek def mac (#170)
* Fix Integrated auth error and Uri for *nix/Mac

* Format code

* Add Logging and unit tests

* Modify tests for Windows:

* Workaround missing default schema on *nix and Mac

* Add unit tests

* Correct comments

* Change loop length

* Fix Log message
2016-12-07 16:52:35 -08:00