Skip to content

Conversation

shueybubbles
Copy link
Collaborator

@shueybubbles shueybubbles commented Jun 24, 2025

Fixes #504
Since ODBC sqlcmd uses -F for the host name, we are going to follow suit and switch to --vertical as the parameter to turn on vertical output formatting.

sqlcmd -S someserver -Nstrict -F *.mydomain.com

Copilot

This comment was marked as outdated.

@shueybubbles
Copy link
Collaborator Author

Change of plans....next iteration, I will change -F to be for the host name, and change vertical formatting to be set using --vert[ical]
Matching ODBC is probably a better story, considering there are not likely a large number of users out there using vertical formatting in automation.

David Shiflet (from Dev Box) added 2 commits June 25, 2025 11:22
@shueybubbles
Copy link
Collaborator Author

i will generate new localization files after merging the driver update change when it goes to main, just to avoid dealing with merge conflicts.

@shueybubbles shueybubbles requested a review from Copilot June 30, 2025 16:01
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds support for specifying the expected host name in the server’s TLS certificate when using strict encryption, and replaces the -F <format> flag for vertical output with a dedicated --vertical switch.

  • Introduce HostNameInCertificate field in ConnectSettings and include it in the connection string when non-empty
  • Change CLI: repurpose -F as the short flag for host-name-in-certificate, remove -F <format>, and add --vertical
  • Update tests and documentation to reflect the new flag behaviors

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/sqlcmd/connect.go Added HostNameInCertificate field and query parameter logic
pkg/sqlcmd/sqlcmd_test.go Updated connection-string tests to expect the new hostname param
cmd/sqlcmd/sqlcmd.go Added CLI binding for host-name-in-certificate, removed format flag, added vertical flag
cmd/sqlcmd/sqlcmd_test.go Updated tests for --vertical, repurposed -F in argument parsing, adjusted invalid-value lists
README.md Documented usage of -F for hostname in certificate and --vertical
Comments suppressed due to low confidence (1)

pkg/sqlcmd/sqlcmd_test.go:54

  • Add a complementary test case where HostNameInCertificate is empty to verify that the connection string does not include the hostnameincertificate parameter when it’s unset.
			&ConnectSettings{ServerName: `tcp:someserver,1045`, Encrypt: "strict", HostNameInCertificate: "*.mydomain.com"},

@shueybubbles shueybubbles merged commit be3c5d4 into main Jul 2, 2025
7 checks passed
@shueybubbles shueybubbles deleted the shueybubbles/hostnameincertificate branch July 2, 2025 16:25
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.

Need a way to pass the HostNameInCertificate parameter for strict encryption connections
3 participants