mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Escape credentials for diagnostics tool
This commit is contained in:
parent
873432fb53
commit
d9c585ecf1
@ -3,6 +3,7 @@ package database
|
|||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/ClickHouse/ClickHouse/programs/diagnostics/internal/platform/data"
|
"github.com/ClickHouse/ClickHouse/programs/diagnostics/internal/platform/data"
|
||||||
@ -17,7 +18,7 @@ type ClickhouseNativeClient struct {
|
|||||||
|
|
||||||
func NewNativeClient(host string, port uint16, username string, password string) (*ClickhouseNativeClient, error) {
|
func NewNativeClient(host string, port uint16, username string, password string) (*ClickhouseNativeClient, error) {
|
||||||
// debug output ?debug=true
|
// debug output ?debug=true
|
||||||
connection, err := sql.Open("clickhouse", fmt.Sprintf("clickhouse://%s:%s@%s:%d/", username, password, host, port))
|
connection, err := sql.Open("clickhouse", fmt.Sprintf("clickhouse://%s:%s@%s:%d/", url.QueryEscape(username), url.QueryEscape(password), host, port))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &ClickhouseNativeClient{}, err
|
return &ClickhouseNativeClient{}, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user