fix: gdb unsupport aliyun hologres link (#3150)

This commit is contained in:
海亮
2023-11-13 22:05:53 +08:00
committed by GitHub
parent d4b14fd717
commit 4d7f9552fe
2 changed files with 17 additions and 1 deletions

View File

@ -378,7 +378,7 @@ const (
ctxKeyInternalProducedSQL gctx.StrKey = `CtxKeyInternalProducedSQL`
// type:[username[:password]@][protocol[(address)]]/dbname[?param1=value1&...&paramN=valueN]
linkPattern = `(\w+):([\w\-]*):(.*?)@(\w+?)\((.+?)\)/{0,1}([^\?]*)\?{0,1}(.*)`
linkPattern = `(\w+):([\w\-\$]*):(.*?)@(\w+?)\((.+?)\)/{0,1}([^\?]*)\?{0,1}(.*)`
)
type queryType int

View File

@ -222,6 +222,22 @@ func Test_parseConfigNodeLink_WithType(t *testing.T) {
t.Assert(newNode.Charset, defaultCharset)
t.Assert(newNode.Protocol, `file`)
})
// #3146
gtest.C(t, func(t *gtest.T) {
node := &ConfigNode{
Link: `pgsql:BASIC$xxxx:123456@tcp(xxxx.hologres.aliyuncs.com:80)/xxx`,
}
newNode := parseConfigNodeLink(node)
t.Assert(newNode.Type, `pgsql`)
t.Assert(newNode.User, `BASIC$xxxx`)
t.Assert(newNode.Pass, `123456`)
t.Assert(newNode.Host, `xxxx.hologres.aliyuncs.com`)
t.Assert(newNode.Port, `80`)
t.Assert(newNode.Name, `xxx`)
t.Assert(newNode.Extra, ``)
t.Assert(newNode.Charset, defaultCharset)
t.Assert(newNode.Protocol, `tcp`)
})
}
func Test_Func_doQuoteWord(t *testing.T) {