Skip to content

Commit f504ba6

Browse files
authored
Fix: Miscellaneous ODBC compatibility fixes (#397)
1 parent 79a897e commit f504ba6

21 files changed

+1612
-180
lines changed

NOTICE.md

+20-37
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ This repository incorporates material as listed below or described in the code.
66
## github.com/Azure/azure-sdk-for-go/sdk/azcore
77

88
* Name: github.com/Azure/azure-sdk-for-go/sdk/azcore
9-
* Version: v1.1.2
10-
* License: [MIT](https://github.com/Azure/azure-sdk-for-go/blob/sdk/azcore/v1.1.2/sdk/azcore/LICENSE.txt)
9+
* Version: v1.6.0
10+
* License: [MIT](https://github.com/Azure/azure-sdk-for-go/blob/sdk/azcore/v1.6.0/sdk/azcore/LICENSE.txt)
1111

1212
```
1313
MIT License
@@ -37,8 +37,8 @@ SOFTWARE
3737
## github.com/Azure/azure-sdk-for-go/sdk/azidentity
3838

3939
* Name: github.com/Azure/azure-sdk-for-go/sdk/azidentity
40-
* Version: v1.2.1
41-
* License: [MIT](https://github.com/Azure/azure-sdk-for-go/blob/sdk/azidentity/v1.2.1/sdk/azidentity/LICENSE.txt)
40+
* Version: v1.3.0
41+
* License: [MIT](https://github.com/Azure/azure-sdk-for-go/blob/sdk/azidentity/v1.3.0/sdk/azidentity/LICENSE.txt)
4242

4343
```
4444
MIT License
@@ -68,8 +68,8 @@ SOFTWARE
6868
## github.com/Azure/azure-sdk-for-go/sdk/internal
6969

7070
* Name: github.com/Azure/azure-sdk-for-go/sdk/internal
71-
* Version: v1.0.0
72-
* License: [MIT](https://github.com/Azure/azure-sdk-for-go/blob/sdk/internal/v1.0.0/sdk/internal/LICENSE.txt)
71+
* Version: v1.3.0
72+
* License: [MIT](https://github.com/Azure/azure-sdk-for-go/blob/sdk/internal/v1.3.0/sdk/internal/LICENSE.txt)
7373

7474
```
7575
MIT License
@@ -99,8 +99,8 @@ SOFTWARE
9999
## github.com/AzureAD/microsoft-authentication-library-for-go/apps
100100

101101
* Name: github.com/AzureAD/microsoft-authentication-library-for-go/apps
102-
* Version: v0.8.1
103-
* License: [MIT](https://github.com/AzureAD/microsoft-authentication-library-for-go/blob/v0.8.1/LICENSE)
102+
* Version: v1.0.0
103+
* License: [MIT](https://github.com/AzureAD/microsoft-authentication-library-for-go/blob/v1.0.0/LICENSE)
104104

105105
```
106106
MIT License
@@ -1411,8 +1411,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14111411
## github.com/golang-jwt/jwt/v4
14121412

14131413
* Name: github.com/golang-jwt/jwt/v4
1414-
* Version: v4.4.2
1415-
* License: [MIT](https://github.com/golang-jwt/jwt/blob/v4.4.2/LICENSE)
1414+
* Version: v4.5.0
1415+
* License: [MIT](https://github.com/golang-jwt/jwt/blob/v4.5.0/LICENSE)
14161416

14171417
```
14181418
Copyright (c) 2012 Dave Grijalva
@@ -1430,8 +1430,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
14301430
## github.com/golang-sql/civil
14311431

14321432
* Name: github.com/golang-sql/civil
1433-
* Version: v0.0.0-20190719163853-cb61b32ac6fe
1434-
* License: [Apache-2.0](https://github.com/golang-sql/civil/blob/cb61b32ac6fe/LICENSE)
1433+
* Version: v0.0.0-20220223132316-b832511892a9
1434+
* License: [Apache-2.0](https://github.com/golang-sql/civil/blob/b832511892a9/LICENSE)
14351435

14361436
```
14371437
@@ -4683,8 +4683,8 @@ THE SOFTWARE.
46834683
## golang.org/x/crypto
46844684

46854685
* Name: golang.org/x/crypto
4686-
* Version: v0.0.0-20220622213112-05595931fe9d
4687-
* License: [BSD-3-Clause](https://cs.opensource.google/go/x/crypto/+/05595931:LICENSE)
4686+
* Version: v0.9.0
4687+
* License: [BSD-3-Clause](https://cs.opensource.google/go/x/crypto/+/v0.9.0:LICENSE)
46884688

46894689
```
46904690
Copyright (c) 2009 The Go Authors. All rights reserved.
@@ -4720,8 +4720,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
47204720
## golang.org/x/net
47214721

47224722
* Name: golang.org/x/net
4723-
* Version: v0.7.0
4724-
* License: [BSD-3-Clause](https://cs.opensource.google/go/x/net/+/v0.7.0:LICENSE)
4723+
* Version: v0.10.0
4724+
* License: [BSD-3-Clause](https://cs.opensource.google/go/x/net/+/v0.10.0:LICENSE)
47254725

47264726
```
47274727
Copyright (c) 2009 The Go Authors. All rights reserved.
@@ -4757,8 +4757,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
47574757
## golang.org/x/sys
47584758

47594759
* Name: golang.org/x/sys
4760-
* Version: v0.5.0
4761-
* License: [BSD-3-Clause](https://cs.opensource.google/go/x/sys/+/v0.5.0:LICENSE)
4760+
* Version: v0.8.0
4761+
* License: [BSD-3-Clause](https://cs.opensource.google/go/x/sys/+/v0.8.0:LICENSE)
47624762

47634763
```
47644764
Copyright (c) 2009 The Go Authors. All rights reserved.
@@ -4794,8 +4794,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
47944794
## golang.org/x/text
47954795

47964796
* Name: golang.org/x/text
4797-
* Version: v0.7.0
4798-
* License: [BSD-3-Clause](https://cs.opensource.google/go/x/text/+/v0.7.0:LICENSE)
4797+
* Version: v0.9.0
4798+
* License: [BSD-3-Clause](https://cs.opensource.google/go/x/text/+/v0.9.0:LICENSE)
47994799

48004800
```
48014801
Copyright (c) 2009 The Go Authors. All rights reserved.
@@ -5066,23 +5066,6 @@ third-party archives.
50665066
50675067
```
50685068

5069-
## gopkg.in/natefinch/npipe.v2
5070-
5071-
* Name: gopkg.in/natefinch/npipe.v2
5072-
* Version: v2.0.0-20160621034901-c1b8fa8bdcce
5073-
* License: [MIT](https://github.com/natefinch/npipe/blob/c1b8fa8bdcce/LICENSE.txt)
5074-
5075-
```
5076-
The MIT License (MIT)
5077-
Copyright (c) 2013 npipe authors
5078-
5079-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5080-
5081-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5082-
5083-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
5084-
```
5085-
50865069
## gopkg.in/yaml.v2
50875070

50885071
* Name: gopkg.in/yaml.v2

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ The `sqlcmd` project aims to be a complete port of the original ODBC sqlcmd to t
116116

117117
The following switches have different behavior in this version of `sqlcmd` compared to the original ODBC based `sqlcmd`.
118118
- `-r` requires a 0 or 1 argument
119-
- `-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.
120-
- `-I` switch will be removed. To disable quoted identifier behavior, add `SET QUOTED IDENTIFIER OFF` in your scripts.
119+
- `-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.
120+
- `-I` switch is ignored; quoted identifiers are always set on. To disable quoted identifier behavior, add `SET QUOTED IDENTIFIER OFF` in your scripts.
121121
- `-N` now takes a string value that can be one of `true`, `false`, or `disable` to specify the encryption choice.
122122
- If `-N` and `-C` are not provided, sqlcmd will negotiate authentication with the server without validating the server certificate.
123123
- 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.
@@ -128,6 +128,7 @@ The following switches have different behavior in this version of `sqlcmd` compa
128128
- 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.
129129
- `-i` now requires multiple arguments for the switch to be separated by `,`.
130130
- `-v` requires multiple variable setters to be comma-separated. eg: `-v var1=v1,var2=v2 -v "var3=v 3"`
131+
- `-M` switch is ignored. Sqlcmd always enables multi-subnet failover.
131132

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

cmd/sqlcmd/sqlcmd.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ type SQLCmdArguments struct {
6464
VariableTypeWidth *int
6565
FixedTypeWidth *int
6666
TrimSpaces bool
67-
MultiSubnetFailover bool
6867
Password string
6968
DedicatedAdminConnection bool
7069
ListServers bool
@@ -307,7 +306,7 @@ func setFlags(rootCmd *cobra.Command, args *SQLCmdArguments) {
307306
rootCmd.Flags().BoolVarP(&args.UnicodeOutputFile, "unicode-output-file", "u", false, localizer.Sprintf("Specifies that all output files are encoded with little-endian Unicode"))
308307
rootCmd.Flags().StringVarP(&args.ColumnSeparator, "column-separator", "s", "", localizer.Sprintf("Specifies the column separator character. Sets the %s variable.", localizer.ColSeparatorVar))
309308
rootCmd.Flags().BoolVarP(&args.TrimSpaces, "trim-spaces", "W", false, localizer.Sprintf("Remove trailing spaces from a column"))
310-
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"))
309+
_ = 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"))
311310

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

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

324325
func setScriptVariable(v string) string {

go.mod

+13-14
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@ require (
1010
github.com/docker/go-connections v0.4.0
1111
github.com/golang-sql/sqlexp v0.1.0
1212
github.com/google/uuid v1.3.0
13-
github.com/microsoft/go-mssqldb v1.0.0
13+
github.com/microsoft/go-mssqldb v1.3.0
1414
github.com/opencontainers/image-spec v1.0.2
1515
github.com/peterh/liner v1.2.2
1616
github.com/pkg/errors v0.9.1
1717
github.com/spf13/cobra v1.6.1
1818
github.com/spf13/pflag v1.0.5
1919
github.com/spf13/viper v1.14.0
2020
github.com/stretchr/testify v1.8.1
21-
golang.org/x/sys v0.5.0
22-
golang.org/x/text v0.7.0
23-
golang.org/x/tools v0.1.12
21+
golang.org/x/sys v0.8.0
22+
golang.org/x/text v0.9.0
23+
golang.org/x/tools v0.6.0
2424
gopkg.in/yaml.v2 v2.4.0
2525
)
2626

2727
require (
28-
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.2 // indirect
29-
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.1 // indirect
30-
github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect
31-
github.com/AzureAD/microsoft-authentication-library-for-go v0.8.1 // indirect
28+
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 // indirect
29+
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 // indirect
30+
github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect
31+
github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 // indirect
3232
github.com/Microsoft/go-winio v0.6.0 // indirect
3333
github.com/beorn7/perks v1.0.1 // indirect
3434
github.com/cespare/xxhash/v2 v2.1.1 // indirect
@@ -39,8 +39,8 @@ require (
3939
github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 // indirect
4040
github.com/fsnotify/fsnotify v1.6.0 // indirect
4141
github.com/gogo/protobuf v1.3.2 // indirect
42-
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
43-
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe // indirect
42+
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
43+
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
4444
github.com/golang/protobuf v1.5.2 // indirect
4545
github.com/gorilla/mux v1.8.0 // indirect
4646
github.com/hashicorp/hcl v1.0.0 // indirect
@@ -66,12 +66,11 @@ require (
6666
github.com/spf13/cast v1.5.0 // indirect
6767
github.com/spf13/jwalterweatherman v1.1.0 // indirect
6868
github.com/subosito/gotenv v1.4.1 // indirect
69-
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
70-
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
71-
golang.org/x/net v0.7.0 // indirect
69+
golang.org/x/crypto v0.9.0 // indirect
70+
golang.org/x/mod v0.8.0 // indirect
71+
golang.org/x/net v0.10.0 // indirect
7272
google.golang.org/protobuf v1.28.1 // indirect
7373
gopkg.in/ini.v1 v1.67.0 // indirect
74-
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
7574
gopkg.in/yaml.v3 v3.0.1 // indirect
7675
gotest.tools/v3 v3.4.0 // indirect
7776
)

0 commit comments

Comments
 (0)