diff --git a/sqle/driver/mysql/rollback.go b/sqle/driver/mysql/rollback.go index 0004c94d94..9d4a7def67 100644 --- a/sqle/driver/mysql/rollback.go +++ b/sqle/driver/mysql/rollback.go @@ -11,7 +11,6 @@ import ( "github.com/actiontech/sqle/sqle/errors" "github.com/pingcap/parser/ast" - "github.com/pingcap/parser/format" _model "github.com/pingcap/parser/model" parserMysql "github.com/pingcap/parser/mysql" ) @@ -627,7 +626,7 @@ func (i *MysqlDriverImpl) generateUpdateRollbackSql(stmt *ast.UpdateStmt) (strin colChanged = true if isPk { isPkChanged = true - pkValue = restore(l.Expr) + pkValue = util.ExprFormat(l.Expr) } } } @@ -661,18 +660,6 @@ func (i *MysqlDriverImpl) generateUpdateRollbackSql(stmt *ast.UpdateStmt) (strin return rollbackSql, "", nil } -// 还原抽象语法树节点至SQL -func restore(node ast.Node) (sql string) { - var buf strings.Builder - rc := format.NewRestoreCtx(format.DefaultRestoreFlags, &buf) - - if err := node.Restore(rc); err != nil { - return - } - sql = buf.String() - return -} - // getRecords select all data which will be update or delete. func (i *MysqlDriverImpl) getRecords(tableName *ast.TableName, tableAlias string, where ast.ExprNode, order *ast.OrderByClause, limit int64) ([]map[string]sql.NullString, error) {