Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: When both -Q and -q are specified, take -Q input and finish #547

Merged
merged 2 commits into from
Aug 14, 2024

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
3 checks passed
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