Documentation ¶
Index ¶
- Constants
- Variables
- func BuildSpecialCommentPrefix(featureID string) string
- type ParamMarkerExpr
- type ValueExpr
- func (n *ValueExpr) Accept(v ast.Visitor) (ast.Node, bool)
- func (n *ValueExpr) Format(w io.Writer)
- func (n *ValueExpr) GetDatumString() string
- func (n *ValueExpr) GetProjectionOffset() int
- func (n *ValueExpr) Restore(ctx *format.RestoreCtx) error
- func (n *ValueExpr) SetProjectionOffset(offset int)
- func (n *ValueExpr) SetValue(res interface{})
Constants ¶
const SpecialCommentVersionPrefix = `/*T!`
SpecialCommentVersionPrefix is the prefix of TiDB executable comments.
Variables ¶
var FeatureIDPatterns = map[string]*regexp.Regexp{ tidb.FeatureIDAutoRandom: regexp.MustCompile(`(?P<REPLACE>(?i)AUTO_RANDOM\b\s*(\s*\(\s*\d+\s*\)\s*)?)`), tidb.FeatureIDAutoIDCache: regexp.MustCompile(`(?P<REPLACE>(?i)AUTO_ID_CACHE\s*=?\s*\d+\s*)`), tidb.FeatureIDAutoRandomBase: regexp.MustCompile(`(?P<REPLACE>(?i)AUTO_RANDOM_BASE\s*=?\s*\d+\s*)`), tidb.FeatureIDClusteredIndex: regexp.MustCompile(`(?i)(PRIMARY)?\s+KEY(\s*\(.*\))?\s+(?P<REPLACE>(NON)?CLUSTERED\b)`), tidb.FeatureIDForceAutoInc: regexp.MustCompile(`(?P<REPLACE>(?i)FORCE)\b\s*AUTO_INCREMENT\s*`), }
FeatureIDPatterns is used to record special comments patterns.
Functions ¶
func BuildSpecialCommentPrefix ¶
BuildSpecialCommentPrefix returns the prefix of `featureID` special comment. For some special feature in TiDB, we will refine ddl query with special comment, which may be useful when A: the downstream is directly MySQL instance (treat it as comment for compatibility). B: the downstream is lower version TiDB (ignore the unknown feature comment). C: the downstream is same/higher version TiDB (parse the feature syntax out).
Types ¶
type ParamMarkerExpr ¶
ParamMarkerExpr expression holds a place for another expression. Used in parsing prepare statement.
func (*ParamMarkerExpr) Format ¶
func (n *ParamMarkerExpr) Format(w io.Writer)
Format the ExprNode into a Writer.
func (*ParamMarkerExpr) Restore ¶
func (n *ParamMarkerExpr) Restore(ctx *format.RestoreCtx) error
Restore implements Node interface.
func (*ParamMarkerExpr) SetOrder ¶
func (n *ParamMarkerExpr) SetOrder(order int)
SetOrder implements the ast.ParamMarkerExpr interface.
type ValueExpr ¶
ValueExpr is the simple value expression.
func (*ValueExpr) GetDatumString ¶
GetDatumString implements the ast.ValueExpr interface.
func (*ValueExpr) GetProjectionOffset ¶
GetProjectionOffset returns ValueExpr.projectionOffset.
func (*ValueExpr) Restore ¶
func (n *ValueExpr) Restore(ctx *format.RestoreCtx) error
Restore implements Node interface.
func (*ValueExpr) SetProjectionOffset ¶
SetProjectionOffset sets ValueExpr.projectionOffset for logical plan builder.