Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Commit

Permalink
format dsn
Browse files Browse the repository at this point in the history
  • Loading branch information
GMHDBJD committed May 28, 2020
1 parent 2ad6fc6 commit 36e8103
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/conn/basedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"context"
"database/sql"
"fmt"
"net/url"
"sync"

"github.com/pingcap/dm/dm/config"
Expand Down Expand Up @@ -58,7 +59,7 @@ func (d *DefaultDBProviderImpl) Apply(config config.DBConfig) (*BaseDB, error) {
}

for key, val := range config.Session {
dsn += fmt.Sprintf("&%s=\"%s\"", key, val)
dsn += fmt.Sprintf("&%s='%s'", key, url.QueryEscape(val))
}

db, err := sql.Open("mysql", dsn)
Expand Down

0 comments on commit 36e8103

Please sign in to comment.