Convert character to bytes and insert into table using latin1
This commit is contained in:
parent
7d8e4e8d3d
commit
113094bbd2
11647
et --hard e484824bbd68085600386ce1b1edfda42af590ad
Normal file
11647
et --hard e484824bbd68085600386ce1b1edfda42af590ad
Normal file
File diff suppressed because it is too large
Load Diff
@ -119,5 +119,5 @@ func (this *ConnectionConfig) GetDBUri(databaseName string) string {
|
||||
if this.tlsConfig != nil {
|
||||
tlsOption = TLS_CONFIG_KEY
|
||||
}
|
||||
return fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?timeout=%fs&readTimeout=%fs&writeTimeout=%fs&interpolateParams=%t&autocommit=true&charset=utf8mb4,utf8,latin1&tls=%s", this.User, this.Password, hostname, this.Key.Port, databaseName, this.Timeout, this.Timeout, this.Timeout, interpolateParams, tlsOption)
|
||||
return fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?timeout=%fs&readTimeout=%fs&writeTimeout=%fs&interpolateParams=%t&autocommit=true&charset=latin1&tls=%s", this.User, this.Password, hostname, this.Key.Port, databaseName, this.Timeout, this.Timeout, this.Timeout, interpolateParams, tlsOption)
|
||||
}
|
||||
|
@ -47,13 +47,10 @@ type Column struct {
|
||||
|
||||
func (this *Column) convertArg(arg interface{}, isUniqueKeyColumn bool) interface{} {
|
||||
if s, ok := arg.(string); ok {
|
||||
// string, charset conversion
|
||||
if encoding, ok := charsetEncodingMap[this.Charset]; ok {
|
||||
arg, _ = encoding.NewDecoder().String(s)
|
||||
}
|
||||
arg2Bytes := []byte(s)
|
||||
arg = arg2Bytes
|
||||
|
||||
if this.Type == BinaryColumnType && isUniqueKeyColumn {
|
||||
arg2Bytes := []byte(arg.(string))
|
||||
size := len(arg2Bytes)
|
||||
if uint(size) < this.BinaryOctetLength {
|
||||
buf := bytes.NewBuffer(arg2Bytes)
|
||||
|
Loading…
Reference in New Issue
Block a user