Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
littleniannian committed Nov 13, 2024
1 parent dddfb02 commit 903fa5e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions sqle/driver/mysql/rule/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -5211,8 +5211,11 @@ func checkTableRowLength(input *RuleHandlerInput) error {
case *ast.CreateTableStmt:
charsetNum := GetTableCharsetNum(stmt.Options)
for _, col := range stmt.Cols {
colCharsetNum := MappingCharsetLength(col.Tp.Charset)
// 可能会设置列级别的字符串
charsetNum = MappingCharsetLength(col.Tp.Charset)
if charsetNum != colCharsetNum {
charsetNum = colCharsetNum
}
oneColumnLength := ComputeOneColumnLength(col, charsetNum)
rowLength += oneColumnLength
}
Expand All @@ -5226,8 +5229,11 @@ func checkTableRowLength(input *RuleHandlerInput) error {
columnLengthMap := make(map[string]int, len(tableStmt.Cols))
// 计算原表的长度
for _, col := range tableStmt.Cols {
// 可能会设置列级别的字符串
charsetNum = MappingCharsetLength(col.Tp.Charset)
colCharsetNum := MappingCharsetLength(col.Tp.Charset)
if charsetNum != colCharsetNum {
charsetNum = colCharsetNum
}

oneColumnLength := ComputeOneColumnLength(col, charsetNum)
rowLength += oneColumnLength
columnLengthMap[col.Name.String()] = oneColumnLength
Expand Down

0 comments on commit 903fa5e

Please sign in to comment.