Skip to content

Commit

Permalink
Merge pull request #9 from jjeffcaii/feat/show_topology
Browse files Browse the repository at this point in the history
feat: support SHOW_TOPOLOGY
  • Loading branch information
AlexStocks authored Jun 24, 2022
2 parents ee9992e + 7cfc5d1 commit 2352eb0
Show file tree
Hide file tree
Showing 5 changed files with 8,970 additions and 8,933 deletions.
9 changes: 8 additions & 1 deletion ast/dml.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ package ast
import (
"strings"

"github.com/pingcap/errors"

"github.com/arana-db/parser/auth"
"github.com/arana-db/parser/format"
"github.com/arana-db/parser/model"
"github.com/arana-db/parser/mysql"
"github.com/pingcap/errors"
)

var (
Expand Down Expand Up @@ -2605,6 +2606,7 @@ const (
ShowPlacementForTable
ShowPlacementForPartition
ShowPlacementLabels
ShowTopology
)

const (
Expand Down Expand Up @@ -2691,6 +2693,11 @@ func (n *ShowStmt) Restore(ctx *format.RestoreCtx) error {
if err := n.Table.Restore(ctx); err != nil {
return errors.Annotate(err, "An error occurred while restore ShowStmt.Table")
}
case ShowTopology:
ctx.WriteKeyWord("TOPOLOGY FROM ")
if err := n.Table.Restore(ctx); err != nil {
return errors.Annotate(err, "An error occurred while restore ShowStmt.Table")
}
case ShowCreateView:
ctx.WriteKeyWord("CREATE VIEW ")
if err := n.Table.Restore(ctx); err != nil {
Expand Down
1 change: 1 addition & 0 deletions misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,7 @@ var tokenMap = map[string]int{
"SEND_CREDENTIALS_TO_TIKV": sendCredentialsToTiKV,
"SEPARATOR": separator,
"SEQUENCE": sequence,
"TOPOLOGY": topology,
"SERIAL": serial,
"SERIALIZABLE": serializable,
"SESSION": session,
Expand Down
Loading

0 comments on commit 2352eb0

Please sign in to comment.