Skip to content

Commit

Permalink
update: 添加部分utf8mb3排序规则支持(utf8mb3_general_ci,utf8mb3_unicode_ci,utf8m…
Browse files Browse the repository at this point in the history
…b3_bin) (#603)
  • Loading branch information
hanchuanchuan committed Oct 29, 2023
1 parent 078585e commit b426096
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
4 changes: 2 additions & 2 deletions docs/ghost.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

### gh-ost

- gh-ost is built-in GoInception. No additional installation.
- About Stop, Pause, Recover are contained in GoInception command.
- gh-ost is built-in GoInception. No additional installation. About Stop, Pause, Recover are contained in GoInception command.
- Support calling gh-ost in binary mode, the parameter switch is `ghost_bin_dir`, please refer to the `osc_bin_dir` parameter of pt-osc for usage, if this parameter is not specified, it will still be called with the built-in gh-ost.

#### Options

Expand Down
4 changes: 2 additions & 2 deletions docs/zh/ghost.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# gh-ost

- 内置gh-ost源码(`v1.0.48`),因此无须下载。
- 手动终止和暂停及恢复功能已开放相应命令,因此隐藏相关参数。
- 内置gh-ost源码(`v1.0.48`),因此无须下载。手动终止和暂停及恢复功能已开放相应命令,因此隐藏相关参数。
- 支持binary方式调用gh-ost, 参数开关为`ghost_bin_dir`, 使用方式请参考pt-osc的`osc_bin_dir`参数,在未指定该参数时仍以内置源码方式调用.

####参数设置

Expand Down
16 changes: 15 additions & 1 deletion util/charset/charset.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,22 @@ func GetCollations() []*Collation {
return collations
}

func utf8Alias(csname string) string {
switch csname {
case "utf8mb3_bin":
csname = "utf8_bin"
case "utf8mb3_unicode_ci":
csname = "utf8_unicode_ci"
case "utf8mb3_general_ci":
csname = "utf8_general_ci"
default:
}
return csname
}

func GetCollationByName(name string) (*Collation, error) {
collation, ok := collationsNameMap[strings.ToLower(name)]
csname := utf8Alias(strings.ToLower(name))
collation, ok := collationsNameMap[csname]
if !ok {
return nil, ErrUnknownCollation.GenWithStackByArgs(name)
}
Expand Down

0 comments on commit b426096

Please sign in to comment.