Skip to content

Commit f0f2cad

Browse files
Address Copilot review: fix quote style, prevent nil pointer in non-interactive mode
1 parent 5d3d2ed commit f0f2cad

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

cmd/sqlcmd/sqlcmd.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ func (a *SQLCmdArguments) Validate(c *cobra.Command) (err error) {
149149
if err == nil {
150150
switch {
151151
case len(a.InputFile) > 0 && len(a.Query) > 0:
152-
err = mutuallyExclusiveError("-i", `-Q`)
152+
err = mutuallyExclusiveError("-i", "-Q")
153153
case a.UseTrustedConnection && (len(a.UserName) > 0 || len(a.Password) > 0):
154154
err = mutuallyExclusiveError("-E", `-U/-P`)
155155
case a.UseAad && len(a.AuthenticationMethod) > 0:
@@ -890,6 +890,9 @@ func run(vars *sqlcmd.Variables, args *SQLCmdArguments) (int, error) {
890890
s.Query = args.Query
891891
} else if args.InitialQuery != "" {
892892
s.Query = args.InitialQuery
893+
if !isInteractive {
894+
once = true
895+
}
893896
}
894897

895898
// Run initial query (-q) if provided, even when combined with input files (-i)

0 commit comments

Comments
 (0)