Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
de9d0c2
Initial plan
Copilot Jan 31, 2026
8ef7a8f
Add float64/float32 formatting to match ODBC sqlcmd behavior
Copilot Jan 31, 2026
5a4abc5
Remove binary from repo and update .gitignore
Copilot Jan 31, 2026
bb5d504
Fix trailing whitespace in test file
Copilot Jan 31, 2026
b1a3ced
Add hybrid float formatting: use 'f' format with fallback to 'g' for …
Copilot Feb 1, 2026
9a407bb
Enhance extreme values test to verify both e+ and e- notation
Copilot Feb 1, 2026
99f5b8d
Fix extreme values test and add REAL formatting test
Copilot Feb 1, 2026
ef8579c
Improve REAL formatting test assertions
Copilot Feb 1, 2026
c53be10
Fix test configuration issues
Copilot Feb 1, 2026
a3b7a26
Clean up code formatting in tests
Copilot Feb 1, 2026
6a8b162
Fix errcheck linting errors in test functions
Copilot Feb 2, 2026
635cb07
Fix float formatting to use DatabaseTypeName for bitSize and add conn…
Copilot Feb 2, 2026
38ac3ee
Improve float formatting to also handle SMALLMONEY as 32-bit
Copilot Feb 2, 2026
5a574a5
Fix fallback logic for displayWidth=0 and remove trailing whitespace
Copilot Feb 2, 2026
5194b35
Centralize float type default width constants
Copilot Feb 2, 2026
85c8c8b
Fix golangci-lint errcheck violations in commands.go
Copilot Feb 2, 2026
9f87576
Fix file handle cleanup and add displayWidth=0 test
Copilot Feb 2, 2026
9611e7b
Remove commented-out dead code in connectCommand
Copilot Feb 2, 2026
db681ab
Merge branch 'main' into copilot/fix-float-formatting-issue
dlevy-msft-sql Feb 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ linux-s390x/sqlcmd
# Build artifacts in root
/sqlcmd
/sqlcmd_binary
/modern

# certificates used for local testing
*.der
Expand Down
2 changes: 1 addition & 1 deletion cmd/modern/root/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestQueryWithNonDefaultDatabase(t *testing.T) {
if runtime.GOOS != "windows" {
t.Skip("stuartpa: This is failing in the pipeline (Login failed for user 'sa'.)")
}

cmdparser.TestSetup(t)

setupContext(t)
Expand Down
8 changes: 4 additions & 4 deletions cmd/sqlcmd/pipe_detection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ package sqlcmd
import (
"os"
"testing"

"github.com/stretchr/testify/assert"
)

func TestStdinPipeDetection(t *testing.T) {
// Get stdin info
fi, err := os.Stdin.Stat()
assert.NoError(t, err, "os.Stdin.Stat()")

// On most CI systems, stdin will be a pipe or file (not a terminal)
// We're testing the logic, not expecting a specific result
isPipe := false
if fi != nil && (fi.Mode()&os.ModeCharDevice) == 0 {
isPipe = true
}

// Just making sure the detection code doesn't crash
// The actual value will depend on the environment
t.Logf("Stdin detected as pipe: %v", isPipe)
}
}
2 changes: 1 addition & 1 deletion internal/secret/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const (
)

// Generate generates a random password of a specified length. The password
// will contain at least the specified number of special characters,
// will contain at least the specified number of special characters,
// numeric digits, and upper-case letters. The remaining characters in the
// password will be selected from a combination of lower-case letters, special
// characters, and numeric digits. The special characters are chosen from
Expand Down
6 changes: 3 additions & 3 deletions pkg/console/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func NewConsole(historyFile string) sqlcmd.Console {
historyFile: historyFile,
stdinRedirected: isStdinRedirected(),
}

if c.stdinRedirected {
c.stdinReader = bufio.NewReader(os.Stdin)
} else {
Expand All @@ -52,7 +52,7 @@ func (c *console) Close() {
f.Close()
}
}

if !c.stdinRedirected {
c.impl.Close()
}
Expand All @@ -79,7 +79,7 @@ func (c *console) Readline() (string, error) {
}
return line, nil
}

// Interactive terminal mode with prompts
s, err := c.impl.Prompt(c.prompt)
if err == liner.ErrPromptAborted {
Expand Down
7 changes: 4 additions & 3 deletions pkg/console/console_redirect.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package console

import (
"os"

"golang.org/x/term"
)

Expand All @@ -15,13 +16,13 @@ func isStdinRedirected() bool {
// If we can't determine, assume it's not redirected
return false
}

// If it's not a character device, it's coming from a pipe or redirection
if (stat.Mode() & os.ModeCharDevice) == 0 {
return true
}

// Double-check using term.IsTerminal
fd := int(os.Stdin.Fd())
return !term.IsTerminal(fd)
}
}
2 changes: 1 addition & 1 deletion pkg/console/console_redirect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ func TestStdinRedirectionDetection(t *testing.T) {

// Clean up
console.Close()
}
}
Loading
Loading