-
Notifications
You must be signed in to change notification settings - Fork 82
Open
Description
Summary
Investigate adding an environment variable (e.g., SQLCMD_ODBC_COMPAT=1) that would make go-sqlcmd behave exactly like the original ODBC sqlcmd for maximum backward compatibility.
Motivation
go-sqlcmd has intentionally diverged from ODBC sqlcmd in several areas to provide better defaults for modern usage. However, users migrating existing scripts or workflows may need exact behavioral compatibility with the original tool.
Potential Scope
When the compatibility mode is enabled, go-sqlcmd would match ODBC sqlcmd behavior in areas including:
Codepage Handling (PR #638)
| Behavior | go-sqlcmd (current) | ODBC sqlcmd | Compat mode |
|---|---|---|---|
| Default encoding | UTF-8 | Windows ANSI (system locale) | ANSI |
| UTF-16 codepages (1200, 1201) | Not supported | Supported | Supported |
| BOM detection | Automatic | Automatic | Automatic |
Other Potential Areas (to investigate)
- Output formatting differences
- Error message formatting
- Exit code behavior
- Variable expansion edge cases
- Null handling in output
- Column width calculations
Implementation Options
- Single env var: SQLCMD_ODBC_COMPAT=1 enables all compatibility behaviors
- Granular env vars: SQLCMD_CODEPAGE_COMPAT=1, SQLCMD_OUTPUT_COMPAT=1, etc.
- Command-line flag: --odbc-compat or -y (if available)
Tasks
- Document all known behavioral differences between go-sqlcmd and ODBC sqlcmd
- Evaluate which differences can reasonably be made configurable
- Design the compatibility mode API (env var name, granularity)
- Implement compatibility mode for codepage handling
- Add tests for compatibility mode behavior
- Update documentation
Related
- PR Add -f codepage flag for input/output encoding #638: Add -f codepage flag for input/output encoding
- This issue originated from codepage investigation showing ODBC uses ANSI default vs go-sqlcmd's UTF-8 default
Labels
enhancement, documentation
Metadata
Metadata
Assignees
Labels
No labels