Skip to content

Commit

Permalink
fix bug in sp_executesql with an unnamed parameter value
Browse files Browse the repository at this point in the history
fix #1
  • Loading branch information
PejmanNik committed Dec 18, 2018
1 parent ef39457 commit 0af8be4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how

## [Unreleased]

## [0.0.1]
## [0.0.2] - 2018-12-18
### Fixed
- fix bug in sp_executesql with an unnamed parameter value

## [0.0.1] - 2018-11-13
- Initial release
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Inspiring from https://github.com/mattwoberts/execsqlformat. so Thank you @mattw

## Release Notes

### 0.0.1
## [0.0.2] - 2018-12-18
### Fixed
- fix bug in sp_executesql with an unnamed parameter value

Initial release
## [0.0.1] - 2018-11-13
- Initial release
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "sqlops-spexecutesql-to-sql",
"displayName": "sqlops-spexecutesql-to-sql",
"description": "sp_executesql to sql",
"version": "0.0.1",
"version": "0.0.2",
"publisher": "pejmannikram",
"icon": "images/icon.png",
"repository": {
Expand Down
7 changes: 6 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,14 @@ export function activate(context: vscode.ExtensionContext) {
const match = regex.exec(text);

if (match) {
let parameters = match[2].split(",");
let newText = "DECLARE " + match[2] + "\n";

match[3].split(",").forEach((value: string) => {
match[3].split(",").forEach((value,index) => {
if (value[0]!=='@')
{
value = parameters[index].split(' ')[0] + '=' + value;
}
newText += "SET " + value + "\n";
});

Expand Down

0 comments on commit 0af8be4

Please sign in to comment.