File tree Expand file tree Collapse file tree 3 files changed +12
-5
lines changed
Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package client
33import (
44 "crypto/tls"
55 "crypto/x509"
6+ "database/sql"
67 "errors"
78
89 "github.com/1Panel-dev/1Panel/agent/global"
@@ -82,8 +83,8 @@ type BackupInfo struct {
8283}
8384
8485type FormatCollation struct {
85- Format string `json:"format" gorm:"column:CHARACTER_SET_NAME"`
86- Collation string `json:"collation" gorm:"column:COLLATION_NAME"`
86+ Format sql. NullString `json:"format" gorm:"column:CHARACTER_SET_NAME"`
87+ Collation sql. NullString `json:"collation" gorm:"column:COLLATION_NAME"`
8788}
8889
8990type RecoverInfo struct {
Original file line number Diff line number Diff line change @@ -405,6 +405,9 @@ func (r *Local) LoadFormatCollation(timeout uint) ([]dto.MysqlFormatCollationOpt
405405 if len (parts ) != 2 {
406406 continue
407407 }
408+ if parts [0 ] == "NULL" {
409+ continue
410+ }
408411 if _ , ok := formatMap [parts [0 ]]; ! ok {
409412 formatMap [parts [0 ]] = []string {parts [1 ]}
410413 } else {
Original file line number Diff line number Diff line change @@ -421,10 +421,13 @@ func (r *Remote) LoadFormatCollation(timeout uint) ([]dto.MysqlFormatCollationOp
421421 if err := rows .Scan (& item .Format , & item .Collation ); err != nil {
422422 return nil , err
423423 }
424- if _ , ok := formatMap [item .Format ]; ! ok {
425- formatMap [item .Format ] = []string {item .Collation }
424+ if ! item .Format .Valid {
425+ continue
426+ }
427+ if _ , ok := formatMap [item .Format .String ]; ! ok {
428+ formatMap [item .Format .String ] = []string {item .Collation .String }
426429 } else {
427- formatMap [item .Format ] = append (formatMap [item .Format ], item .Collation )
430+ formatMap [item .Format . String ] = append (formatMap [item .Format . String ], item .Collation . String )
428431 }
429432 }
430433 options := []dto.MysqlFormatCollationOption {}
You can’t perform that action at this time.
0 commit comments