-
Notifications
You must be signed in to change notification settings - Fork 83
feat: allow -q initial query to work with -i input files #626
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
base: main
Are you sure you want to change the base?
feat: allow -q initial query to work with -i input files #626
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enables the -q (initial query) flag to work alongside -i (input files), allowing users to set session options before running scripts. Previously, -q was mutually exclusive with -i, but now the initial query runs first, followed by the input files. The -Q (query and exit) flag remains mutually exclusive with -i as expected.
Changes:
- Modified validation to allow
-iwith-qwhile keeping-iand-Qmutually exclusive - Updated run logic to execute
-qbefore processing-ifiles - Updated flag descriptions and documentation
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| cmd/sqlcmd/sqlcmd.go | Modified validation logic to distinguish between -q and -Q, updated run logic to execute initial query before input files, and updated flag description |
| cmd/sqlcmd/sqlcmd_test.go | Updated test expectations to reflect that only -Q (not -q) is mutually exclusive with -i, added test for -q with -i combination |
| README.md | Added documentation for the new feature with example usage |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
f0f2cad to
f184668
Compare
Previously -q and -i were mutually exclusive. Now -q runs first, then -i files. The -Q flag remains mutually exclusive with -i since -Q exits after executing. Test uses SET NOCOUNT ON (locale-independent) instead of SET LANGUAGE German.
f184668 to
d4d220b
Compare
Summary
This PR allows the
-q(initial query) flag to be used with-i(input files), enabling users to set session options before running scripts.Changes
-iwith-Q(not-q)-qfirst, then process-ifiles-iflag description to document the new behaviorUsage
The initial query runs first, then the input files are processed.
Notes
-Qflag (query and exit) remains mutually exclusive with-isince-Qcauses sqlcmd to exit immediately after the queryFixes #389