8000 fix: When both -Q and -q are specified, take -Q input and finish by martinkunc · Pull Request #547 · microsoft/go-sqlcmd · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@martinkunc
Copy link
Contributor

Would this be a good fix for the issue #525 when both -Q and -q are specified.

By switching priority, when both are specified, it takes -Q first, and finishes. The app no more crashes.

If we would like to report error instead, maybe I could do it in another PR.

Example output

> ./sqlcmd -S "tcp:127.0.0.1,1433" -E -d master -q "SELECT 1" -Q "SELECT 2"

-----------
          2

(1 row affected)

@shueybubbles
Copy link
Collaborator

thx for opening a PR!
I think mimicking ODBC is the right thing.
Please add a test that fails without your fix.

>"C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\SQLCMD.EXE" -Q "select 'Q'" -q "select 'q'"

-
Q

(1 rows affected)

@shueybubbles shueybubbles merged commit 412fe02 into microsoft:main Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0