Documentation ¶
Index ¶
- Constants
- Variables
- func CompileExecutePreparedStmt(ctx context.Context, ID uint32, args ...interface{}) ast.Statement
- func NewSubQueryBuilder(is infoschema.InfoSchema) plan.SubQueryBuilder
- type AggregateExec
- type CheckTableExec
- type Compiler
- type DDLExec
- type DeallocateExec
- type DeleteExec
- type DistinctExec
- type ExecuteExec
- type Executor
- type ExplainExec
- type FilterExec
- type GrantExec
- type IndexRangeExec
- type IndexScanExec
- type InsertExec
- type InsertValues
- type JoinInnerExec
- type JoinOuterExec
- type LimitExec
- type PrepareExec
- type Prepared
- type ReplaceExec
- type ReverseExec
- type Row
- type RowKeyEntry
- type SelectFieldsExec
- type SelectLockExec
- type ShowDDLExec
- type ShowExec
- type SimpleExec
- type SortExec
- type TableDualExec
- type TableScanExec
- type UnionExec
- type UpdateExec
- type XSelectIndexExec
- type XSelectTableExec
Constants ¶
const ( CodeUnknownPlan terror.ErrCode = 1 CodePrepareMulti terror.ErrCode = 2 CodeStmtNotFound terror.ErrCode = 3 CodeSchemaChanged terror.ErrCode = 4 CodeWrongParamCount terror.ErrCode = 5 )
Error codes.
Variables ¶
var ( ErrUnknownPlan = terror.ClassExecutor.New(CodeUnknownPlan, "Unknown plan") ErrPrepareMulti = terror.ClassExecutor.New(CodePrepareMulti, "Can not prepare multiple statements") ErrStmtNotFound = terror.ClassExecutor.New(CodeStmtNotFound, "Prepared statement not found") ErrSchemaChanged = terror.ClassExecutor.New(CodeSchemaChanged, "Schema has changed") ErrWrongParamCount = terror.ClassExecutor.New(CodeWrongParamCount, "Wrong parameter count") )
Error instances.
var BaseLookupTableTaskSize = 1024
BaseLookupTableTaskSize represents base number of handles for a lookupTableTask.
var MaxLookupTableTaskSize = 1024
MaxLookupTableTaskSize represents max number of handles for a lookupTableTask.
var SortBufferSize = 500
SortBufferSize represents the total extra row count that sort can use.
Functions ¶
func CompileExecutePreparedStmt ¶
CompileExecutePreparedStmt compiles a session Execute command to a stmt.Statement.
func NewSubQueryBuilder ¶
func NewSubQueryBuilder(is infoschema.InfoSchema) plan.SubQueryBuilder
NewSubQueryBuilder builds and returns a new SubQuery builder.
Types ¶
type AggregateExec ¶
type AggregateExec struct { Src Executor ResultFields []*ast.ResultField AggFuncs []*ast.AggregateFuncExpr GroupByItems []*ast.ByItem // contains filtered or unexported fields }
AggregateExec deals with all the aggregate functions. It is built from Aggregate Plan. When Next() is called, it reads all the data from Src and updates all the items in AggFuncs. TODO: Support having.
func (*AggregateExec) Close ¶
func (e *AggregateExec) Close() error
Close implements Executor Close interface.
func (*AggregateExec) Fields ¶
func (e *AggregateExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
func (*AggregateExec) Next ¶
func (e *AggregateExec) Next() (*Row, error)
Next implements Executor Next interface.
type CheckTableExec ¶
type CheckTableExec struct {
// contains filtered or unexported fields
}
CheckTableExec represents a check table executor.
func (*CheckTableExec) Close ¶
func (e *CheckTableExec) Close() error
Close implements plan.Plan Close interface.
func (*CheckTableExec) Fields ¶
func (e *CheckTableExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
func (*CheckTableExec) Next ¶
func (e *CheckTableExec) Next() (*Row, error)
Next implements Executor Next interface.
type Compiler ¶
type Compiler struct { }
Compiler compiles an ast.StmtNode to a stmt.Statement.
type DDLExec ¶
DDLExec represents a DDL executor.
func (*DDLExec) Fields ¶
func (e *DDLExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
type DeallocateExec ¶
type DeallocateExec struct { Name string // contains filtered or unexported fields }
DeallocateExec represent a DEALLOCATE executor.
func (*DeallocateExec) Close ¶
func (e *DeallocateExec) Close() error
Close implements plan.Plan Close interface.
func (*DeallocateExec) Fields ¶
func (e *DeallocateExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
func (*DeallocateExec) Next ¶
func (e *DeallocateExec) Next() (*Row, error)
Next implements Executor Next interface.
type DeleteExec ¶
type DeleteExec struct { SelectExec Executor Tables []*ast.TableName IsMultiTable bool // contains filtered or unexported fields }
DeleteExec represents a delete executor. See: https://dev.mysql.com/doc/refman/5.7/en/delete.html
func (*DeleteExec) Close ¶
func (e *DeleteExec) Close() error
Close implements Executor Close interface.
func (*DeleteExec) Fields ¶
func (e *DeleteExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface. Returns nil to indicate there is no output.
func (*DeleteExec) Next ¶
func (e *DeleteExec) Next() (*Row, error)
Next implements Executor Next interface.
type DistinctExec ¶
type DistinctExec struct { Src Executor // contains filtered or unexported fields }
DistinctExec represents Distinct executor.
func (*DistinctExec) Close ¶
func (e *DistinctExec) Close() error
Close implements Executor Close interface.
func (*DistinctExec) Fields ¶
func (e *DistinctExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
func (*DistinctExec) Next ¶
func (e *DistinctExec) Next() (*Row, error)
Next implements Executor Next interface.
type ExecuteExec ¶
type ExecuteExec struct { IS infoschema.InfoSchema Ctx context.Context Name string UsingVars []ast.ExprNode ID uint32 StmtExec Executor Stmt ast.StmtNode }
ExecuteExec represents an EXECUTE executor. It executes a prepared statement.
func (*ExecuteExec) Build ¶
func (e *ExecuteExec) Build() error
Build builds a prepared statement into an executor.
func (*ExecuteExec) Close ¶
func (e *ExecuteExec) Close() error
Close implements plan.Plan Close interface.
func (*ExecuteExec) Fields ¶
func (e *ExecuteExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
func (*ExecuteExec) Next ¶
func (e *ExecuteExec) Next() (*Row, error)
Next implements Executor Next interface.
type Executor ¶
type Executor interface { Fields() []*ast.ResultField Next() (*Row, error) Close() error }
Executor executes a query.
type ExplainExec ¶
ExplainExec represents an explain executor. See: https://dev.mysql.com/doc/refman/5.7/en/explain-output.html
func (*ExplainExec) Close ¶
func (e *ExplainExec) Close() error
Close implements Executor Close interface.
func (*ExplainExec) Fields ¶
func (e *ExplainExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
func (*ExplainExec) Next ¶
func (e *ExplainExec) Next() (*Row, error)
Next implements Execution Next interface.
type FilterExec ¶
type FilterExec struct { Src Executor Condition ast.ExprNode // contains filtered or unexported fields }
FilterExec represents a filter executor.
func (*FilterExec) Close ¶
func (e *FilterExec) Close() error
Close implements Executor Close interface.
func (*FilterExec) Fields ¶
func (e *FilterExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
func (*FilterExec) Next ¶
func (e *FilterExec) Next() (*Row, error)
Next implements Executor Next interface.
type GrantExec ¶
type GrantExec struct { Privs []*ast.PrivElem ObjectType ast.ObjectTypeType Level *ast.GrantLevel Users []*ast.UserSpec // contains filtered or unexported fields }
GrantExec executes GrantStmt.
func (*GrantExec) Fields ¶
func (e *GrantExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
type IndexRangeExec ¶
type IndexRangeExec struct {
// contains filtered or unexported fields
}
IndexRangeExec represents an index range scan executor.
func (*IndexRangeExec) Close ¶
func (e *IndexRangeExec) Close() error
Close implements Executor Close interface.
func (*IndexRangeExec) Fields ¶
func (e *IndexRangeExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
func (*IndexRangeExec) Next ¶
func (e *IndexRangeExec) Next() (*Row, error)
Next implements Executor Next interface.
type IndexScanExec ¶
type IndexScanExec struct { Ranges []*IndexRangeExec Desc bool // contains filtered or unexported fields }
IndexScanExec represents an index scan executor.
func (*IndexScanExec) Close ¶
func (e *IndexScanExec) Close() error
Close implements Executor Close interface.
func (*IndexScanExec) Fields ¶
func (e *IndexScanExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
func (*IndexScanExec) Next ¶
func (e *IndexScanExec) Next() (*Row, error)
Next implements Executor Next interface.
type InsertExec ¶
type InsertExec struct { *InsertValues OnDuplicate []*ast.Assignment Priority int // contains filtered or unexported fields }
InsertExec represents an insert executor.
func (*InsertExec) Close ¶
func (e *InsertExec) Close() error
Close implements Executor Close interface.
func (*InsertExec) Fields ¶
func (e *InsertExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface. Returns nil to indicate there is no output.
func (*InsertExec) Next ¶
func (e *InsertExec) Next() (*Row, error)
Next implements Executor Next interface.
type InsertValues ¶
type InsertValues struct { SelectExec Executor Table table.Table Columns []*ast.ColumnName Lists [][]ast.ExprNode Setlist []*ast.Assignment IsPrepare bool // contains filtered or unexported fields }
InsertValues is the data to insert.
type JoinInnerExec ¶
type JoinInnerExec struct { InnerPlans []plan.Plan Condition ast.ExprNode // contains filtered or unexported fields }
JoinInnerExec represents an inner join executor.
func (*JoinInnerExec) Close ¶
func (e *JoinInnerExec) Close() error
Close implements Executor Close interface.
func (*JoinInnerExec) Fields ¶
func (e *JoinInnerExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
func (*JoinInnerExec) Next ¶
func (e *JoinInnerExec) Next() (*Row, error)
Next implements Executor Next interface. The data in the returned row is not used by caller.
type JoinOuterExec ¶
type JoinOuterExec struct { OuterExec Executor InnerPlan plan.Plan // contains filtered or unexported fields }
JoinOuterExec represents an outer join executor.
func (*JoinOuterExec) Close ¶
func (e *JoinOuterExec) Close() error
Close implements Executor Close interface.
func (*JoinOuterExec) Fields ¶
func (e *JoinOuterExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
func (*JoinOuterExec) Next ¶
func (e *JoinOuterExec) Next() (*Row, error)
Next implements Executor Next interface. The data in the returned row is not used by caller. If inner executor didn't get any row for an outer executor row, a row with 0 len Data indicates there is no inner row matched for an outer row.
type LimitExec ¶
LimitExec represents limit executor
func (*LimitExec) Fields ¶
func (e *LimitExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
type PrepareExec ¶
type PrepareExec struct { IS infoschema.InfoSchema Ctx context.Context Name string SQLText string ID uint32 ResultFields []*ast.ResultField ParamCount int Err error }
PrepareExec represents a PREPARE executor.
func (*PrepareExec) Close ¶
func (e *PrepareExec) Close() error
Close implements plan.Plan Close interface.
func (*PrepareExec) DoPrepare ¶
func (e *PrepareExec) DoPrepare()
DoPrepare prepares the statement, it can be called multiple times without side effect.
func (*PrepareExec) Fields ¶
func (e *PrepareExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
func (*PrepareExec) Next ¶
func (e *PrepareExec) Next() (*Row, error)
Next implements Executor Next interface.
type Prepared ¶
type Prepared struct { Stmt ast.StmtNode Params []*ast.ParamMarkerExpr SchemaVersion int64 }
Prepared represents a prepared statement.
type ReplaceExec ¶
type ReplaceExec struct { *InsertValues Priority int // contains filtered or unexported fields }
ReplaceExec represents a replace executor.
func (*ReplaceExec) Close ¶
func (e *ReplaceExec) Close() error
Close implements Executor Close interface.
func (*ReplaceExec) Fields ¶
func (e *ReplaceExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface. Returns nil to indicate there is no output.
func (*ReplaceExec) Next ¶
func (e *ReplaceExec) Next() (*Row, error)
Next implements Executor Next interface.
type ReverseExec ¶
type ReverseExec struct { Src Executor // contains filtered or unexported fields }
ReverseExec produces reverse ordered result, it is used to wrap executors that do not support reverse scan.
func (*ReverseExec) Close ¶
func (e *ReverseExec) Close() error
Close implements Executor Close interface.
func (*ReverseExec) Fields ¶
func (e *ReverseExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
func (*ReverseExec) Next ¶
func (e *ReverseExec) Next() (*Row, error)
Next implements Executor Next interface.
type Row ¶
type Row struct { // Data is the output record data for current Plan. Data []types.Datum RowKeys []*RowKeyEntry }
Row represents a record row.
type RowKeyEntry ¶
type RowKeyEntry struct { // The table which this row come from. Tbl table.Table // Row key. Handle int64 // Table alias name. TableAsName *model.CIStr }
RowKeyEntry is designed for Delete statement in multi-table mode, we should know which table this row comes from.
type SelectFieldsExec ¶
type SelectFieldsExec struct { Src Executor ResultFields []*ast.ResultField // contains filtered or unexported fields }
SelectFieldsExec represents a select fields executor.
func (*SelectFieldsExec) Close ¶
func (e *SelectFieldsExec) Close() error
Close implements Executor Close interface.
func (*SelectFieldsExec) Fields ¶
func (e *SelectFieldsExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
func (*SelectFieldsExec) Next ¶
func (e *SelectFieldsExec) Next() (*Row, error)
Next implements Executor Next interface.
type SelectLockExec ¶
type SelectLockExec struct { Src Executor Lock ast.SelectLockType // contains filtered or unexported fields }
SelectLockExec represents a select lock executor.
func (*SelectLockExec) Close ¶
func (e *SelectLockExec) Close() error
Close implements Executor Close interface.
func (*SelectLockExec) Fields ¶
func (e *SelectLockExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
func (*SelectLockExec) Next ¶
func (e *SelectLockExec) Next() (*Row, error)
Next implements Executor Next interface.
type ShowDDLExec ¶
type ShowDDLExec struct {
// contains filtered or unexported fields
}
ShowDDLExec represents a show DDL executor.
func (*ShowDDLExec) Close ¶
func (e *ShowDDLExec) Close() error
Close implements Executor Close interface.
func (*ShowDDLExec) Fields ¶
func (e *ShowDDLExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
func (*ShowDDLExec) Next ¶
func (e *ShowDDLExec) Next() (*Row, error)
Next implements Executor Next interface.
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`. Flag int // Some flag parsed from sql, such as FULL. Full bool User string // Used for show grants. // Used by show variables GlobalScope bool // contains filtered or unexported fields }
ShowExec represents a show executor.
func (*ShowExec) Fields ¶
func (e *ShowExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
type SimpleExec ¶
SimpleExec represents simple statement executor. For statements do simple execution. includes `UseStmt`, 'SetStmt`, `SetCharsetStmt`. `DoStmt`, `BeginStmt`, `CommitStmt`, `RollbackStmt`. TODO: list all simple statements.
func (*SimpleExec) Close ¶
func (e *SimpleExec) Close() error
Close implements Executor Close interface.
func (*SimpleExec) Fields ¶
func (e *SimpleExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
func (*SimpleExec) Next ¶
func (e *SimpleExec) Next() (*Row, error)
Next implements Execution Next interface.
type SortExec ¶
type SortExec struct { Src Executor ByItems []*ast.ByItem Rows []*orderByRow Limit *plan.Limit Idx int // contains filtered or unexported fields }
SortExec represents sorting executor.
func (*SortExec) Fields ¶
func (e *SortExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
type TableDualExec ¶
type TableDualExec struct {
// contains filtered or unexported fields
}
TableDualExec represents a dual table executor.
func (*TableDualExec) Close ¶
func (e *TableDualExec) Close() error
Close implements plan.Plan Close interface.
func (*TableDualExec) Fields ¶
func (e *TableDualExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
func (*TableDualExec) Next ¶
func (e *TableDualExec) Next() (*Row, error)
Next implements Executor Next interface.
type TableScanExec ¶
type TableScanExec struct {
// contains filtered or unexported fields
}
TableScanExec represents a table scan executor.
func (*TableScanExec) Close ¶
func (e *TableScanExec) Close() error
Close implements Executor Close interface.
func (*TableScanExec) Fields ¶
func (e *TableScanExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
func (*TableScanExec) Next ¶
func (e *TableScanExec) Next() (*Row, error)
Next implements Executor Next interface.
type UnionExec ¶
type UnionExec struct { Sels []Executor // contains filtered or unexported fields }
UnionExec represents union executor.
func (*UnionExec) Fields ¶
func (e *UnionExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
type UpdateExec ¶
type UpdateExec struct { SelectExec Executor OrderedList []*ast.Assignment // contains filtered or unexported fields }
UpdateExec represents an update executor.
func (*UpdateExec) Close ¶
func (e *UpdateExec) Close() error
Close implements Executor Close interface.
func (*UpdateExec) Fields ¶
func (e *UpdateExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface. Returns nil to indicate there is no output.
func (*UpdateExec) Next ¶
func (e *UpdateExec) Next() (*Row, error)
Next implements Executor Next interface.
type XSelectIndexExec ¶
type XSelectIndexExec struct {
// contains filtered or unexported fields
}
XSelectIndexExec represents XAPI select index executor.
func (*XSelectIndexExec) Close ¶
func (e *XSelectIndexExec) Close() error
Close implements Executor Close interface.
func (*XSelectIndexExec) Fields ¶
func (e *XSelectIndexExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
func (*XSelectIndexExec) Next ¶
func (e *XSelectIndexExec) Next() (*Row, error)
Next implements Executor Next interface.
type XSelectTableExec ¶
type XSelectTableExec struct {
// contains filtered or unexported fields
}
XSelectTableExec represents XAPI select executor.
func (*XSelectTableExec) Close ¶
func (e *XSelectTableExec) Close() error
Close implements Executor Close interface.
func (*XSelectTableExec) Fields ¶
func (e *XSelectTableExec) Fields() []*ast.ResultField
Fields implements Executor Fields interface.
func (*XSelectTableExec) Next ¶
func (e *XSelectTableExec) Next() (*Row, error)
Next implements Executor Next interface.