mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-04 00:10:25 +08:00
fix: machine file bug
This commit is contained in:
@@ -308,7 +308,7 @@ func (d *dbAppImpl) DumpDb(ctx context.Context, reqParam *dto.DumpDb) error {
|
||||
}
|
||||
if len(tbs) <= 0 {
|
||||
log(fmt.Sprintf("failed to get table [%s] information: No table information was retrieved", tableName))
|
||||
return errorx.NewBiz(fmt.Sprintf("Failed to get table information: %s", tableName))
|
||||
return errorx.NewBiz("Failed to get table information: %s", tableName)
|
||||
}
|
||||
|
||||
tableInfo := tbs[0]
|
||||
|
||||
@@ -446,11 +446,11 @@ func (d *dbSqlExecAppImpl) doUpdate(ctx context.Context, sqlExecParam *sqlExecPa
|
||||
}
|
||||
execRecord.Table = tableName
|
||||
|
||||
whereStr := updatestmt.Where.GetText()
|
||||
if whereStr == "" {
|
||||
if updatestmt.Where == nil {
|
||||
logx.ErrorContext(ctx, "update SQL - there is no where condition")
|
||||
return d.doExec(ctx, dbConn, sqlExecParam.Sql)
|
||||
}
|
||||
whereStr := updatestmt.Where.GetText()
|
||||
|
||||
// 获取表主键列名,排除使用别名
|
||||
primaryKey, err := dbConn.GetMetadata().GetPrimaryKey(tableName)
|
||||
|
||||
@@ -441,23 +441,27 @@ func (v *MysqlVisitor) VisitInPredicate(ctx *mysqlparser.InPredicateContext) int
|
||||
}
|
||||
|
||||
func (v *MysqlVisitor) VisitBetweenPredicate(ctx *mysqlparser.BetweenPredicateContext) interface{} {
|
||||
node := sqlstmt.NewNode(ctx.GetParser(), ctx)
|
||||
return node
|
||||
predicate := new(sqlstmt.PredicateLike)
|
||||
predicate.Node = sqlstmt.NewNode(ctx.GetParser(), ctx)
|
||||
return predicate
|
||||
}
|
||||
|
||||
func (v *MysqlVisitor) VisitIsNullPredicate(ctx *mysqlparser.IsNullPredicateContext) interface{} {
|
||||
node := sqlstmt.NewNode(ctx.GetParser(), ctx)
|
||||
return node
|
||||
predicate := new(sqlstmt.PredicateLike)
|
||||
predicate.Node = sqlstmt.NewNode(ctx.GetParser(), ctx)
|
||||
return predicate
|
||||
}
|
||||
|
||||
func (v *MysqlVisitor) VisitLikePredicate(ctx *mysqlparser.LikePredicateContext) interface{} {
|
||||
node := sqlstmt.NewNode(ctx.GetParser(), ctx)
|
||||
return node
|
||||
likePredicate := new(sqlstmt.PredicateLike)
|
||||
likePredicate.Node = sqlstmt.NewNode(ctx.GetParser(), ctx)
|
||||
return likePredicate
|
||||
}
|
||||
|
||||
func (v *MysqlVisitor) VisitRegexpPredicate(ctx *mysqlparser.RegexpPredicateContext) interface{} {
|
||||
node := sqlstmt.NewNode(ctx.GetParser(), ctx)
|
||||
return node
|
||||
predicate := new(sqlstmt.PredicateLike)
|
||||
predicate.Node = sqlstmt.NewNode(ctx.GetParser(), ctx)
|
||||
return predicate
|
||||
}
|
||||
|
||||
func (v *MysqlVisitor) VisitUnaryExpressionAtom(ctx *mysqlparser.UnaryExpressionAtomContext) interface{} {
|
||||
|
||||
@@ -59,6 +59,14 @@ type (
|
||||
|
||||
ExprAtom IExprAtom
|
||||
}
|
||||
|
||||
PredicateLike struct {
|
||||
Predicate
|
||||
|
||||
InPredicate IPredicate
|
||||
Exprs []IExpr
|
||||
SelectStmt ISelectStmt
|
||||
}
|
||||
)
|
||||
|
||||
func (*Predicate) isPredicate() {}
|
||||
|
||||
Reference in New Issue
Block a user