Skip to content

Commit

Permalink
support show warnings limit (#32)
Browse files Browse the repository at this point in the history
* show warnings support limit

* show warnings support limit add test

* resolve conflicts

---------

Co-authored-by: zouye <[email protected]>
  • Loading branch information
icrzye and zouye authored Mar 22, 2023
1 parent e410dbf commit 27e71be
Show file tree
Hide file tree
Showing 4 changed files with 2,042 additions and 2,028 deletions.
12 changes: 9 additions & 3 deletions ast/dml.go
Original file line number Diff line number Diff line change
Expand Up @@ -2666,7 +2666,7 @@ type ShowStmt struct {

ShowProfileTypes []int // Used for `SHOW PROFILE` syntax
ShowProfileArgs *int64 // Used for `SHOW PROFILE` syntax
ShowProfileLimit *Limit // Used for `SHOW PROFILE` syntax
Limit *Limit // Used for `SHOW PROFILE` `SHOW WARNINGS` syntax
}

// Restore implements Node interface.
Expand Down Expand Up @@ -2860,9 +2860,9 @@ func (n *ShowStmt) Restore(ctx *format.RestoreCtx) error {
ctx.WriteKeyWord(" FOR QUERY ")
ctx.WritePlainf("%d", *n.ShowProfileArgs)
}
if n.ShowProfileLimit != nil {
if n.Limit != nil {
ctx.WritePlain(" ")
if err := n.ShowProfileLimit.Restore(ctx); err != nil {
if err := n.Limit.Restore(ctx); err != nil {
return errors.Annotate(err, "An error occurred while restore ShowStmt.WritePlain")
}
}
Expand Down Expand Up @@ -2935,6 +2935,12 @@ func (n *ShowStmt) Restore(ctx *format.RestoreCtx) error {
restoreShowDatabaseNameOpt()
case ShowWarnings:
ctx.WriteKeyWord("WARNINGS")
if n.Limit != nil {
ctx.WritePlain(" ")
if err := n.Limit.Restore(ctx); err != nil {
return errors.Annotate(err, "An error occurred while restore ShowStmt.WritePlain")
}
}
case ShowErrors:
ctx.WriteKeyWord("ERRORS")
case ShowVariables:
Expand Down
Loading

0 comments on commit 27e71be

Please sign in to comment.