Skip to content

Commit

Permalink
#56: Added schema to ToDSN() function (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaklakariada authored Apr 21, 2022
1 parent f7e993f commit 7156d4c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/changes/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Changes

* [0.3.2](changes_0.3.2.md)
* [0.3.1](changes_0.3.1.md)
* [0.3.0](changes_0.3.0.md)
* [0.2.0](changes_0.2.0.md)
Expand Down
11 changes: 11 additions & 0 deletions doc/changes/changes_0.3.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Exasol Go SQL Driver 0.3.2, released 2022-04-21

Code name: Fix `ToDSN()` to add the schema

## Summary

This release fixes a bug in the `ToDSN()` that caused the schema to be missing in the generated DSN.

## Bugfixes

* #56: Added the schema to `ToDSN()`.
3 changes: 3 additions & 0 deletions dsn.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ func (c *DSNConfig) ToDSN() string {
if c.ClientVersion != "" {
sb.WriteString(fmt.Sprintf("clientversion=%s;", c.ClientVersion))
}
if c.Schema != "" {
sb.WriteString(fmt.Sprintf("schema=%s;", c.Schema))
}
return strings.TrimRight(sb.String(), ";")
}

Expand Down
6 changes: 6 additions & 0 deletions dsn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ func (suite *DriverTestSuite) TestConfigToDsnWithClientNameAndVersion() {
suite.Equal("exa:localhost:8563;user=sys;password=exasol;clientname=clientName;clientversion=clientVersion", config.String())
}

func (suite *DriverTestSuite) TestConfigToDsnWithSchema() {
config := NewConfig("sys", "exasol").
Schema("schemaName")
suite.Equal("exa:localhost:8563;user=sys;password=exasol;schema=schemaName", config.String())
}

func (suite *DriverTestSuite) TestConfigToDsnWithDefaultValues() {
config := NewConfig("sys", "exasol")
suite.Equal("exa:localhost:8563;user=sys;password=exasol", config.String())
Expand Down

0 comments on commit 7156d4c

Please sign in to comment.