Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ The `sqlcmd` project aims to be a complete port of the original ODBC sqlcmd to t

The following switches have different behavior in this version of `sqlcmd` compared to the original ODBC based `sqlcmd`.
- `-r` requires a 0 or 1 argument
- `-R` switch will be removed. The go runtime does not provide access to user locale information, and it's not readily available through syscall on all supported platforms.
- `-I` switch will be removed. To disable quoted identifier behavior, add `SET QUOTED IDENTIFIER OFF` in your scripts.
- `-R` switch is ignored. The go runtime does not provide access to user locale information, and it's not readily available through syscall on all supported platforms.
- `-I` switch is ignored; quoted identifiers are always set on. To disable quoted identifier behavior, add `SET QUOTED IDENTIFIER OFF` in your scripts.
- `-N` now takes a string value that can be one of `true`, `false`, or `disable` to specify the encryption choice.
- If `-N` and `-C` are not provided, sqlcmd will negotiate authentication with the server without validating the server certificate.
- If `-N` is provided but `-C` is not, sqlcmd will require validation of the server certificate. Note that a `false` value for encryption could still lead to encryption of the login packet.
Expand All @@ -128,6 +128,7 @@ The following switches have different behavior in this version of `sqlcmd` compa
- All commands must fit on one line, even `EXIT`. Interactive mode will not check for open parentheses or quotes for commands and prompt for successive lines. The ODBC sqlcmd allows the query run by `EXIT(query)` to span multiple lines.
- `-i` now requires multiple arguments for the switch to be separated by `,`.
- `-v` requires multiple variable setters to be comma-separated. eg: `-v var1=v1,var2=v2 -v "var3=v 3"`
- `-M` switch is ignored. Sqlcmd always enables multi-subnet failover.

### Switches not available in the new sqlcmd (go-sqlcmd) yet

Expand Down
5 changes: 3 additions & 2 deletions cmd/sqlcmd/sqlcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ type SQLCmdArguments struct {
VariableTypeWidth *int
FixedTypeWidth *int
TrimSpaces bool
MultiSubnetFailover bool
Password string
DedicatedAdminConnection bool
ListServers bool
Expand Down Expand Up @@ -307,7 +306,7 @@ func setFlags(rootCmd *cobra.Command, args *SQLCmdArguments) {
rootCmd.Flags().BoolVarP(&args.UnicodeOutputFile, "unicode-output-file", "u", false, localizer.Sprintf("Specifies that all output files are encoded with little-endian Unicode"))
rootCmd.Flags().StringVarP(&args.ColumnSeparator, "column-separator", "s", "", localizer.Sprintf("Specifies the column separator character. Sets the %s variable.", localizer.ColSeparatorVar))
rootCmd.Flags().BoolVarP(&args.TrimSpaces, "trim-spaces", "W", false, localizer.Sprintf("Remove trailing spaces from a column"))
rootCmd.Flags().BoolVarP(&args.MultiSubnetFailover, "multi-subnet-failover", "M", false, localizer.Sprintf("Provided for backward compatibility. Sqlcmd always optimizes detection of the active replica of a SQL Failover Cluster"))
_ = rootCmd.Flags().BoolP("multi-subnet-failover", "M", false, localizer.Sprintf("Provided for backward compatibility. Sqlcmd always optimizes detection of the active replica of a SQL Failover Cluster"))

rootCmd.Flags().StringVarP(&args.Password, "password", "P", "", localizer.Sprintf("Password"))

Expand All @@ -319,6 +318,8 @@ func setFlags(rootCmd *cobra.Command, args *SQLCmdArguments) {
_ = rootCmd.Flags().IntP(fixedTypeWidth, "Y", 0, setScriptVariable("SQLCMDMAXFIXEDTYPEWIDTH"))
rootCmd.Flags().BoolVarP(&args.ListServers, "list-servers", "L", false, "List servers")
rootCmd.Flags().BoolVarP(&args.DedicatedAdminConnection, "dedicated-admin-connection", "A", false, localizer.Sprintf("Dedicated administrator connection"))
_ = rootCmd.Flags().BoolP("enable-quoted-identifiers", "I", true, localizer.Sprintf("Provided for backward compatibility. Quoted identifiers are always enabled"))
_ = rootCmd.Flags().BoolP("client-regional-setting", "R", false, localizer.Sprintf("Provided for backward compatibility. Client regional settings are not used"))
}

func setScriptVariable(v string) string {
Expand Down
153 changes: 86 additions & 67 deletions internal/translations/catalog.go

Large diffs are not rendered by default.

128 changes: 128 additions & 0 deletions internal/translations/locales/de-DE/out.gotext.json
Original file line number Diff line number Diff line change
Expand Up @@ -2350,6 +2350,16 @@
"message": "Dedicated administrator connection",
"translation": ""
},
{
"id": "Provided for backward compatibility. Quoted identifiers are always enabled",
"message": "Provided for backward compatibility. Quoted identifiers are always enabled",
"translation": ""
},
{
"id": "Provided for backward compatibility. Client regional settings are not used",
"message": "Provided for backward compatibility. Client regional settings are not used",
"translation": ""
},
{
"id": "Sets the sqlcmd scripting variable {V}",
"message": "Sets the sqlcmd scripting variable {V}",
Expand Down Expand Up @@ -2718,6 +2728,124 @@
}
]
},
{
"id": "Msg {Number}, Level {Class}, State {State}, Server {ServerName}, Procedure {ProcName}, Line {LineNo}{SqlcmdEol}",
"message": "Msg {Number}, Level {Class}, State {State}, Server {ServerName}, Procedure {ProcName}, Line {LineNo}{SqlcmdEol}",
"translation": "",
"placeholders": [
{
"id": "Number",
"string": "%#[1]v",
"type": "int32",
"underlyingType": "int32",
"argNum": 1,
"expr": "e.Number"
},
{
"id": "Class",
"string": "%[2]d",
"type": "uint8",
"underlyingType": "uint8",
"argNum": 2,
"expr": "e.Class"
},
{
"id": "State",
"string": "%[3]d",
"type": "uint8",
"underlyingType": "uint8",
"argNum": 3,
"expr": "e.State"
},
{
"id": "ServerName",
"string": "%[4]s",
"type": "string",
"underlyingType": "string",
"argNum": 4,
"expr": "e.ServerName"
},
{
"id": "ProcName",
"string": "%[5]s",
"type": "string",
"underlyingType": "string",
"argNum": 5,
"expr": "e.ProcName"
},
{
"id": "LineNo",
"string": "%#[6]v",
"type": "int32",
"underlyingType": "int32",
"argNum": 6,
"expr": "e.LineNo"
},
{
"id": "SqlcmdEol",
"string": "%[7]s",
"type": "string",
"underlyingType": "string",
"argNum": 7,
"expr": "SqlcmdEol"
}
]
},
{
"id": "Msg {Number}, Level {Class}, State {State}, Server {ServerName}, Line {LineNo}{SqlcmdEol}",
"message": "Msg {Number}, Level {Class}, State {State}, Server {ServerName}, Line {LineNo}{SqlcmdEol}",
"translation": "",
"placeholders": [
{
"id": "Number",
"string": "%#[1]v",
"type": "int32",
"underlyingType": "int32",
"argNum": 1,
"expr": "e.Number"
},
{
"id": "Class",
"string": "%[2]d",
"type": "uint8",
"underlyingType": "uint8",
"argNum": 2,
"expr": "e.Class"
},
{
"id": "State",
"string": "%[3]d",
"type": "uint8",
"underlyingType": "uint8",
"argNum": 3,
"expr": "e.State"
},
{
"id": "ServerName",
"string": "%[4]s",
"type": "string",
"underlyingType": "string",
"argNum": 4,
"expr": "e.ServerName"
},
{
"id": "LineNo",
"string": "%#[5]v",
"type": "int32",
"underlyingType": "int32",
"argNum": 5,
"expr": "e.LineNo"
},
{
"id": "SqlcmdEol",
"string": "%[6]s",
"type": "string",
"underlyingType": "string",
"argNum": 6,
"expr": "SqlcmdEol"
}
]
},
{
"id": "Invalid variable identifier {Name}",
"message": "Invalid variable identifier {Name}",
Expand Down
136 changes: 136 additions & 0 deletions internal/translations/locales/en-US/out.gotext.json
Original file line number Diff line number Diff line change
Expand Up @@ -2870,6 +2870,20 @@
"translatorComment": "Copied from source.",
"fuzzy": true
},
{
"id": "Provided for backward compatibility. Quoted identifiers are always enabled",
"message": "Provided for backward compatibility. Quoted identifiers are always enabled",
"translation": "Provided for backward compatibility. Quoted identifiers are always enabled",
"translatorComment": "Copied from source.",
"fuzzy": true
},
{
"id": "Provided for backward compatibility. Client regional settings are not used",
"message": "Provided for backward compatibility. Client regional settings are not used",
"translation": "Provided for backward compatibility. Client regional settings are not used",
"translatorComment": "Copied from source.",
"fuzzy": true
},
{
"id": "Sets the sqlcmd scripting variable {V}",
"message": "Sets the sqlcmd scripting variable {V}",
Expand Down Expand Up @@ -3274,6 +3288,128 @@
],
"fuzzy": true
},
{
"id": "Msg {Number}, Level {Class}, State {State}, Server {ServerName}, Procedure {ProcName}, Line {LineNo}{SqlcmdEol}",
"message": "Msg {Number}, Level {Class}, State {State}, Server {ServerName}, Procedure {ProcName}, Line {LineNo}{SqlcmdEol}",
"translation": "Msg {Number}, Level {Class}, State {State}, Server {ServerName}, Procedure {ProcName}, Line {LineNo}{SqlcmdEol}",
"translatorComment": "Copied from source.",
"placeholders": [
{
"id": "Number",
"string": "%#[1]v",
"type": "int32",
"underlyingType": "int32",
"argNum": 1,
"expr": "e.Number"
},
{
"id": "Class",
"string": "%[2]d",
"type": "uint8",
"underlyingType": "uint8",
"argNum": 2,
"expr": "e.Class"
},
{
"id": "State",
"string": "%[3]d",
"type": "uint8",
"underlyingType": "uint8",
"argNum": 3,
"expr": "e.State"
},
{
"id": "ServerName",
"string": "%[4]s",
"type": "string",
"underlyingType": "string",
"argNum": 4,
"expr": "e.ServerName"
},
{
"id": "ProcName",
"string": "%[5]s",
"type": "string",
"underlyingType": "string",
"argNum": 5,
"expr": "e.ProcName"
},
{
"id": "LineNo",
"string": "%#[6]v",
"type": "int32",
"underlyingType": "int32",
"argNum": 6,
"expr": "e.LineNo"
},
{
"id": "SqlcmdEol",
"string": "%[7]s",
"type": "string",
"underlyingType": "string",
"argNum": 7,
"expr": "SqlcmdEol"
}
],
"fuzzy": true
},
{
"id": "Msg {Number}, Level {Class}, State {State}, Server {ServerName}, Line {LineNo}{SqlcmdEol}",
"message": "Msg {Number}, Level {Class}, State {State}, Server {ServerName}, Line {LineNo}{SqlcmdEol}",
"translation": "Msg {Number}, Level {Class}, State {State}, Server {ServerName}, Line {LineNo}{SqlcmdEol}",
"translatorComment": "Copied from source.",
"placeholders": [
{
"id": "Number",
"string": "%#[1]v",
"type": "int32",
"underlyingType": "int32",
"argNum": 1,
"expr": "e.Number"
},
{
"id": "Class",
"string": "%[2]d",
"type": "uint8",
"underlyingType": "uint8",
"argNum": 2,
"expr": "e.Class"
},
{
"id": "State",
"string": "%[3]d",
"type": "uint8",
"underlyingType": "uint8",
"argNum": 3,
"expr": "e.State"
},
{
"id": "ServerName",
"string": "%[4]s",
"type": "string",
"underlyingType": "string",
"argNum": 4,
"expr": "e.ServerName"
},
{
"id": "LineNo",
"string": "%#[5]v",
"type": "int32",
"underlyingType": "int32",
"argNum": 5,
"expr": "e.LineNo"
},
{
"id": "SqlcmdEol",
"string": "%[6]s",
"type": "string",
"underlyingType": "string",
"argNum": 6,
"expr": "SqlcmdEol"
}
],
"fuzzy": true
},
{
"id": "Invalid variable identifier {Name}",
"message": "Invalid variable identifier {Name}",
Expand Down
Loading