Repository: microsoft/go-mssqldb
Pull request #261 (2025-05-22 13:48:17)

isProc: added `COMMIT` and `ROLLBACK` command to the builtin commands
Fix: https://github.com/microsoft/go-sqlcmd/issues/569

giautm: cc @shueybubbles
shueybubbles: thx!
codecov-commenter: ## [Codecov](https://app.codecov.io/gh/microsoft/go-mssqldb/pull/261?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 74.88%. Comparing base [(`a3ce042`)](https://app.codecov.io/gh/microsoft/go-mssqldb/commit/a3ce042ecfefd07bd3bc59ab08309785690afeb5?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft) to head [(`9bb53ca`)](https://app.codecov.io/gh/microsoft/go-mssqldb/commit/9bb53ca70eea59264e14998b0181a6ca324b7505?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft).

<details><summary>Additional details and impacted files</summary>


```diff
@@           Coverage Diff           @@
##             main     #261   +/-   ##
=======================================
  Coverage   74.88%   74.88%           
=======================================
  Files          32       32           
  Lines        6471     6471           
=======================================
  Hits         4846     4846           
- Misses       1334     1335    +1     
+ Partials      291      290    -1     
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/microsoft/go-mssqldb/pull/261?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft).

<details><summary> :rocket: New features to boost your workflow: </summary>

- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
</details>

Patch:
diff --git a/mssql.go b/mssql.go
index 2c8d00e..bf99783 100644
--- a/mssql.go
+++ b/mssql.go
@@ -565,7 +565,10 @@ func (s *Stmt) sendQuery(ctx context.Context, args []namedValue) (err error) {
 
 // Builtin commands are not stored procs, but rather T-SQL commands
 // those commands can be invoke without extra options
-var builtinCommands = []string{"RECONFIGURE", "SHUTDOWN", "CHECKPOINT"}
+var builtinCommands = []string{
+	"RECONFIGURE", "SHUTDOWN", "CHECKPOINT",
+	"COMMIT", "ROLLBACK",
+}
 
 // isProc takes the query text in s and determines if it is a stored proc name
 // or SQL text.


Test patch:
diff --git a/mssql_test.go b/mssql_test.go
index 6a35bcc..d7eaf5c 100644
--- a/mssql_test.go
+++ b/mssql_test.go
@@ -51,6 +51,8 @@ func TestIsProc(t *testing.T) {
 		{"RECONFIGURE", false},
 		{"SHUTDOWN", false},
 		{"CHECKPOINT", false},
+		{"COMMIT", false},
+		{"ROLLBACK", false},
 	}
 
 	for _, item := range list {