Documentation ¶
Index ¶
- Variables
- func BuildSettingQuery(settings []string, parser *sqlparser.Parser) (query string, resetQuery string, err error)
- func GenerateFieldQuery(statement sqlparser.Statement) *sqlparser.ParsedQuery
- func GenerateFullQuery(statement sqlparser.Statement) *sqlparser.ParsedQuery
- func GenerateLimitQuery(selStmt sqlparser.SelectStatement) *sqlparser.ParsedQuery
- type Permission
- type Plan
- type PlanType
Constants ¶
This section is empty.
Variables ¶
var ( // PassthroughDMLs will return plans that pass-through the DMLs without changing them. PassthroughDMLs = false )
Functions ¶
func BuildSettingQuery ¶
func BuildSettingQuery(settings []string, parser *sqlparser.Parser) (query string, resetQuery string, err error)
BuildSettingQuery builds a query for system settings.
func GenerateFieldQuery ¶
func GenerateFieldQuery(statement sqlparser.Statement) *sqlparser.ParsedQuery
GenerateFieldQuery generates a query to just fetch the field info by adding impossible where clauses as needed.
func GenerateFullQuery ¶
func GenerateFullQuery(statement sqlparser.Statement) *sqlparser.ParsedQuery
GenerateFullQuery generates the full query from the ast.
func GenerateLimitQuery ¶
func GenerateLimitQuery(selStmt sqlparser.SelectStatement) *sqlparser.ParsedQuery
GenerateLimitQuery generates a select query with a limit clause.
Types ¶
type Permission ¶
Permission associates the required access permission for each table.
func BuildPermissions ¶
func BuildPermissions(stmt sqlparser.Statement) []Permission
BuildPermissions builds the list of required permissions for all the tables referenced in a query.
func (*Permission) CachedSize ¶
func (cached *Permission) CachedSize(alloc bool) int64
type Plan ¶
type Plan struct { PlanID PlanType // When the query indicates a single table Table *schema.Table // SELECT, UPDATE, DELETE statements may list multiple tables AllTables []*schema.Table // Permissions stores the permissions for the tables accessed in the query. Permissions []Permission // FullQuery will be set for all plans. FullQuery *sqlparser.ParsedQuery // NextCount stores the count for "select next". NextCount evalengine.Expr // WhereClause is set for DMLs. It is used by the hot row protection // to serialize e.g. UPDATEs going to the same row. WhereClause *sqlparser.ParsedQuery // FullStmt can be used when the query does not operate on tables FullStmt sqlparser.Statement // NeedsReservedConn indicates at a reserved connection is needed to execute this plan NeedsReservedConn bool }
Plan contains the parameters for executing a request.
func Build ¶
func Build(env *vtenv.Environment, statement sqlparser.Statement, tables map[string]*schema.Table, dbName string, viewsEnabled bool) (plan *Plan, err error)
Build builds a plan based on the schema.
func BuildMessageStreaming ¶
BuildMessageStreaming builds a plan for message streaming.
func BuildStreaming ¶
BuildStreaming builds a streaming plan based on the schema.
func (*Plan) CachedSize ¶
func (*Plan) TableName ¶
func (plan *Plan) TableName() sqlparser.IdentifierCS
TableName returns the table name for the plan.
func (*Plan) TableNames ¶
TableNames returns the table names for all tables in the plan.
type PlanType ¶
type PlanType int
PlanType indicates a query plan type.
const ( PlanSelect PlanType = iota PlanNextval PlanSelectImpossible PlanSelectLockFunc PlanInsert PlanInsertMessage PlanUpdate PlanUpdateLimit PlanDelete PlanDeleteLimit PlanDDL PlanSet // PlanOtherRead is for statements like show, etc. PlanOtherRead // PlanOtherAdmin is for statements like repair, lock table, etc. PlanOtherAdmin PlanSelectStream // PlanMessageStream is for "stream" statements. PlanMessageStream PlanSavepoint PlanRelease PlanSRollback PlanShow // PlanLoad is for Load data statements PlanLoad // PlanFlush is for FLUSH statements PlanFlush PlanLockTables PlanUnlockTables PlanCallProc PlanAlterMigration PlanRevertMigration PlanShowMigrations PlanShowMigrationLogs PlanShowThrottledApps PlanShowThrottlerStatus NumPlans )
The following are PlanType values.
func PlanByName ¶
PlanByName find a PlanType by its string name.
func PlanByNameIC ¶
PlanByNameIC finds a plan type by its string name without case sensitivity
func (PlanType) MarshalJSON ¶
MarshalJSON returns a json string for PlanType.