Skip to content

Commit 8ca7594

Browse files
author
James Cor
committed
remove unused node
1 parent 4f64e60 commit 8ca7594

File tree

6 files changed

+0
-89
lines changed

6 files changed

+0
-89
lines changed

sql/plan/revoke.go

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -426,76 +426,6 @@ func (n *Revoke) HandleRoutinePrivileges(user *mysql_db.User, dbName string, rou
426426
return nil
427427
}
428428

429-
// RevokeAll represents the statement REVOKE ALL PRIVILEGES.
430-
type RevokeAll struct {
431-
Users []UserName
432-
}
433-
434-
var _ sql.Node = (*RevokeAll)(nil)
435-
var _ sql.CollationCoercible = (*RevokeAll)(nil)
436-
var _ sql.AuthorizationCheckerNode = (*RevokeAll)(nil)
437-
438-
// NewRevokeAll returns a new RevokeAll node.
439-
func NewRevokeAll(users []UserName) *RevokeAll {
440-
return &RevokeAll{
441-
Users: users,
442-
}
443-
}
444-
445-
// Schema implements the interface sql.Node.
446-
func (n *RevokeAll) Schema() sql.Schema {
447-
return types.OkResultSchema
448-
}
449-
450-
func (n *RevokeAll) IsReadOnly() bool {
451-
return false
452-
}
453-
454-
// String implements the interface sql.Node.
455-
func (n *RevokeAll) String() string {
456-
users := make([]string, len(n.Users))
457-
for i, user := range n.Users {
458-
users[i] = user.String("")
459-
}
460-
return fmt.Sprintf("RevokeAll(From: %s)", strings.Join(users, ", "))
461-
}
462-
463-
// Resolved implements the interface sql.Node.
464-
func (n *RevokeAll) Resolved() bool {
465-
return true
466-
}
467-
468-
// Children implements the interface sql.Node.
469-
func (n *RevokeAll) Children() []sql.Node {
470-
return nil
471-
}
472-
473-
// WithChildren implements the interface sql.Node.
474-
func (n *RevokeAll) WithChildren(children ...sql.Node) (sql.Node, error) {
475-
if len(children) != 0 {
476-
return nil, sql.ErrInvalidChildrenNumber.New(n, len(children), 0)
477-
}
478-
return n, nil
479-
}
480-
481-
// CheckAuth implements the interface sql.AuthorizationCheckerNode.
482-
func (n *RevokeAll) CheckAuth(ctx *sql.Context, opChecker sql.PrivilegedOperationChecker) bool {
483-
createUser := sql.NewPrivilegedOperation(sql.PrivilegeCheckSubject{}, sql.PrivilegeType_CreateUser)
484-
superUser := sql.NewPrivilegedOperation(sql.PrivilegeCheckSubject{}, sql.PrivilegeType_Super)
485-
486-
subject := sql.PrivilegeCheckSubject{Database: "mysql"}
487-
mysqlUpdate := sql.NewPrivilegedOperation(subject, sql.PrivilegeType_Update)
488-
489-
return opChecker.UserHasPrivileges(ctx, createUser) ||
490-
opChecker.UserHasPrivileges(ctx, superUser) ||
491-
opChecker.UserHasPrivileges(ctx, mysqlUpdate)
492-
}
493-
494-
// CollationCoercibility implements the interface sql.CollationCoercible.
495-
func (*RevokeAll) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte) {
496-
return sql.Collation_binary, 7
497-
}
498-
499429
// RevokeRole represents the statement REVOKE [role...] FROM [user...].
500430
type RevokeRole struct {
501431
Roles []UserName

sql/planbuilder/builder.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,6 @@ func (b *Builder) buildSubquery(inScope *scope, stmt ast.Statement, subQuery str
375375
return b.buildGrantProxy(inScope, n)
376376
case *ast.RevokePrivilege:
377377
return b.buildRevokePrivilege(inScope, n)
378-
case *ast.RevokeAllPrivileges:
379-
return b.buildRevokeAllPrivileges(inScope, n)
380378
case *ast.RevokeRole:
381379
return b.buildRevokeRole(inScope, n)
382380
case *ast.RevokeProxy:

sql/planbuilder/priv.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -530,16 +530,6 @@ func (b *Builder) buildRevokePrivilege(inScope *scope, n *ast.RevokePrivilege) (
530530
return
531531
}
532532

533-
func (b *Builder) buildRevokeAllPrivileges(inScope *scope, n *ast.RevokeAllPrivileges) (outScope *scope) {
534-
outScope = inScope.push()
535-
outScope.node = plan.NewRevokeAll(convertAccountName(n.From...))
536-
n.Auth.Extra = outScope.node
537-
if err := b.cat.AuthorizationHandler().HandleAuth(b.ctx, b.authQueryState, n.Auth); err != nil && b.authEnabled {
538-
b.handleErr(err)
539-
}
540-
return
541-
}
542-
543533
func (b *Builder) buildRevokeRole(inScope *scope, n *ast.RevokeRole) (outScope *scope) {
544534
outScope = inScope.push()
545535
outScope.node = &plan.RevokeRole{

sql/rowexec/builder_gen_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ func TestGenBuilder(t *testing.T) {
135135
"ResetReplica": "*plan.ResetReplica",
136136
"TableNode": "*plan.TableNode",
137137
"Revoke": "*plan.Revoke",
138-
"RevokeAll": "*plan.RevokeAll",
139138
"RevokeRole": "*plan.RevokeRole",
140139
"RevokeProxy": "*plan.RevokeProxy",
141140
"RowUpdateAccumulator": "plan.RowUpdateAccumulator",

sql/rowexec/node_builder.gen.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,6 @@ func (b *BaseBuilder) buildNodeExecNoAnalyze(ctx *sql.Context, n sql.Node, row s
198198
return b.buildAlterPK(ctx, n, row)
199199
case plan.Nothing:
200200
return b.buildNothing(ctx, n, row)
201-
case *plan.RevokeAll:
202-
return b.buildRevokeAll(ctx, n, row)
203201
case *plan.DeferredAsOfTable:
204202
return b.buildDeferredAsOfTable(ctx, n, row)
205203
case *plan.CreateUser:

sql/rowexec/priv.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,6 @@ func (b *BaseBuilder) buildRevoke(ctx *sql.Context, n *plan.Revoke, row sql.Row)
291291
return rowIterWithOkResultWithZeroRowsAffected(), nil
292292
}
293293

294-
func (b *BaseBuilder) buildRevokeAll(ctx *sql.Context, n *plan.RevokeAll, row sql.Row) (sql.RowIter, error) {
295-
return nil, fmt.Errorf("not yet implemented")
296-
}
297-
298294
func (b *BaseBuilder) buildGrant(ctx *sql.Context, n *plan.Grant, row sql.Row) (sql.RowIter, error) {
299295
mysqlDb, ok := n.MySQLDb.(*mysql_db.MySQLDb)
300296
if !ok {

0 commit comments

Comments
 (0)