adds support for db/branch syntax with --use-db global arg in remote contexts

This commit is contained in:
Stephanie You
2023-07-21 18:05:24 -07:00
parent bb5d656e84
commit 3148e185dd
3 changed files with 8 additions and 3 deletions
+5 -1
View File
@@ -25,6 +25,7 @@ import (
"time"
"github.com/abiosoft/readline"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dsess"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/dolthub/ishell"
@@ -481,11 +482,14 @@ func BuildConnectionStringQueryist(ctx context.Context, cwdFS filesys.Filesys, c
return nil, err
}
parsedMySQLConfig, err := mysqlDriver.ParseDSN(ConnectionString(clientConfig, database))
dbName, _ := dsess.SplitRevisionDbName(database)
parsedMySQLConfig, err := mysqlDriver.ParseDSN(ConnectionString(clientConfig, dbName))
if err != nil {
return nil, err
}
// ParseDSN currently doesn't support `/` in the db name
parsedMySQLConfig.DBName = database
parsedMySQLConfig.Addr = fmt.Sprintf("%s:%d", host, port)
if useTLS {
+1 -1
View File
@@ -19,7 +19,7 @@ require (
github.com/dustin/go-humanize v1.0.0
github.com/fatih/color v1.13.0
github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568
github.com/go-sql-driver/mysql v1.6.0
github.com/go-sql-driver/mysql v1.7.2-0.20230713085235-0b18dac46f7f
github.com/gocraft/dbr/v2 v2.7.2
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4
+2 -1
View File
@@ -255,8 +255,9 @@ github.com/go-pdf/fpdf v0.6.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhO
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-sql-driver/mysql v1.7.2-0.20230713085235-0b18dac46f7f h1:4+t8Qb99xUG/Ea00cQAiQl+gsjpK8ZYtAO8E76gRzQI=
github.com/go-sql-driver/mysql v1.7.2-0.20230713085235-0b18dac46f7f/go.mod h1:6gYm/zDt3ahdnMVTPeT/LfoBFsws1qZm5yI6FmVjB14=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=