Documentation
¶
Index ¶
- Constants
- Variables
- func CheckUserGrantPriv(store *gorm.DB, issuerUser, curUser *auth.UserIdentity, privs []*ast.PrivElem) error
- func Run(ctx sessionctx.Context, stmt string, is infoschema.InfoSchema) ([]*scql.Tensor, error)
- func SetAllGrantPrivTo(level ast.GrantLevelType, attributes map[string]interface{}, value bool) error
- type DDLExec
- type Executor
- type GrantExec
- type RevokeExec
- type SetExecutor
- type ShowExec
- type SimpleExec
Constants ¶
const ( ResultMaxRows = 1024 InitChunkSize = 1024 MaxChunkSize = 1024 )
const ( TableTypeBase = `BASE TABLE` TableTypeView = `VIEW` )
Variables ¶
var ( ErrUnknownPlan = terror.ClassExecutor.New(mysql.ErrUnknownPlan, mysql.MySQLErrName[mysql.ErrUnknownPlan]) ErrPasswordFormat = terror.ClassExecutor.New(mysql.ErrPasswordFormat, mysql.MySQLErrName[mysql.ErrPasswordFormat]) ErrBadDB = terror.ClassExecutor.New(mysql.ErrBadDB, mysql.MySQLErrName[mysql.ErrBadDB]) ErrCantCreateUserWithGrant = terror.ClassExecutor.New(mysql.ErrCantCreateUserWithGrant, mysql.MySQLErrName[mysql.ErrCantCreateUserWithGrant]) ErrDBaccessDenied = terror.ClassExecutor.New(mysql.ErrDBaccessDenied, mysql.MySQLErrName[mysql.ErrDBaccessDenied]) ErrTableaccessDenied = terror.ClassExecutor.New(mysql.ErrTableaccessDenied, mysql.MySQLErrName[mysql.ErrTableaccessDenied]) )
Error instances.
Functions ¶
func CheckUserGrantPriv ¶
func Run ¶
func Run(ctx sessionctx.Context, stmt string, is infoschema.InfoSchema) ([]*scql.Tensor, error)
Run runs an DDL/DCL statement on SCDB
func SetAllGrantPrivTo ¶
func SetAllGrantPrivTo(level ast.GrantLevelType, attributes map[string]interface{}, value bool) error
Types ¶
type DDLExec ¶
type DDLExec struct {
// contains filtered or unexported fields
}
DDLExec represents a DDL executor. It grabs a DDL instance from Domain, calling the DDL methods to do the work.
func (*DDLExec) Close ¶
func (e *DDLExec) Close() error
Close closes all executors and release all resources.
func (*DDLExec) Open ¶
Open initializes children recursively and "childrenResults" according to children's schemas.
func (*DDLExec) Schema ¶
func (e *DDLExec) Schema() *expression.Schema
Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.
type Executor ¶
type Executor interface {
Open(context.Context) error
Next(ctx context.Context, req *chunk.Chunk) error
Close() error
Schema() *expression.Schema
// contains filtered or unexported methods
}
Executor is the physical implementation of a algebra operator.
In TiDB, all algebra operators are implemented as iterators, i.e., they support a simple Open-Next-Close protocol. See this paper for more details:
"Volcano-An Extensible and Parallel Query Evaluation System"
Different from Volcano's execution model, a "Next" function call in TiDB will return a batch of rows, other than a single row in Volcano. NOTE: Executors must call "chk.Reset()" before appending their results to it.
type GrantExec ¶
type GrantExec struct {
Privs []*ast.PrivElem
ObjectType ast.ObjectTypeType
Level *ast.GrantLevel
Users []*ast.UserSpec
TLSOptions []*ast.TLSOption
WithGrant bool
// contains filtered or unexported fields
}
GrantExec executes GrantStmt.
func (*GrantExec) Close ¶
func (e *GrantExec) Close() error
Close closes all executors and release all resources.
func (*GrantExec) Open ¶
Open initializes children recursively and "childrenResults" according to children's schemas.
func (*GrantExec) Schema ¶
func (e *GrantExec) Schema() *expression.Schema
Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.
type RevokeExec ¶
type RevokeExec struct {
Privs []*ast.PrivElem
ObjectType ast.ObjectTypeType
Level *ast.GrantLevel
Users []*ast.UserSpec
// contains filtered or unexported fields
}
RevokeExec executes RevokeStmt.
func (*RevokeExec) Close ¶
func (e *RevokeExec) Close() error
Close closes all executors and release all resources.
func (*RevokeExec) Open ¶
Open initializes children recursively and "childrenResults" according to children's schemas.
func (*RevokeExec) Schema ¶
func (e *RevokeExec) Schema() *expression.Schema
Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.
type SetExecutor ¶
type SetExecutor struct {
// contains filtered or unexported fields
}
SetExecutor executes set statement.
func (*SetExecutor) Close ¶
func (e *SetExecutor) Close() error
Close closes all executors and release all resources.
func (*SetExecutor) Open ¶
Open initializes children recursively and "childrenResults" according to children's schemas.
func (*SetExecutor) Schema ¶
func (e *SetExecutor) Schema() *expression.Schema
Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.
type ShowExec ¶
type ShowExec struct {
Tp ast.ShowStmtType // Databases/Tables/Columns/....
DBName model.CIStr
Table *ast.TableName // Used for showing columns.
Column *ast.ColumnName // Used for `desc table column`.
IndexName model.CIStr // Used for show table regions.
Flag int // Some flag parsed from sql, such as FULL.
Roles []*auth.RoleIdentity // Used for show grants.
User *auth.UserIdentity // Used by show grants, show create user.
Full bool
IfNotExists bool // Used for `show create database if not exists`
GlobalScope bool // GlobalScope is used by show variables
Extended bool // Used for `show extended columns from ...`
// contains filtered or unexported fields
}
ShowExec represents a show executor.
func (*ShowExec) Close ¶
func (e *ShowExec) Close() error
Close closes all executors and release all resources.
func (*ShowExec) Open ¶
Open initializes children recursively and "childrenResults" according to children's schemas.
func (*ShowExec) Schema ¶
func (e *ShowExec) Schema() *expression.Schema
Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.
type SimpleExec ¶
SimpleExec represents simple statement executor. For statements do simple execution. includes `UseStmt`, 'SetStmt`, `DoStmt`, `BeginStmt`, `CommitStmt`, `RollbackStmt`.
func (*SimpleExec) Close ¶
func (e *SimpleExec) Close() error
Close closes all executors and release all resources.
func (*SimpleExec) Open ¶
Open initializes children recursively and "childrenResults" according to children's schemas.
func (*SimpleExec) Schema ¶
func (e *SimpleExec) Schema() *expression.Schema
Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.