Documentation
¶
Index ¶
- func ANTLRParseTiDB(statement string) ([]*base.ParseResult, error)
- func DealWithDelimiter(statement string) (string, error)
- func Diagnose(_ context.Context, _ base.DiagnoseContext, statement string) ([]base.Diagnostic, error)
- func ExtractDelimiter(stmt string) (string, error)
- func ExtractMySQLTableList(in ast.Node, asName bool) []*ast.TableName
- func GetQuerySpan(ctx context.Context, gCtx base.GetQuerySpanContext, ...) (*base.QuerySpan, error)
- func GetStatementTypes(asts []base.AST) ([]string, error)
- func IsDelimiter(stmt string) bool
- func IsTiDBUnsupportDDLStmt(stmt string) bool
- func NormalizeTiDBIdentifier(identifier parser.IIdentifierContext) string
- func NormalizeTiDBTextOrIdentifier(ctx parser.ITextOrIdentifierContext) string
- func ParseTiDB(sql string, charset string, collation string) ([]ast.StmtNode, error)
- func ParseTiDBForSyntaxCheck(statement string) ([]base.AST, error)
- func SetLineForMySQLCreateTableStmt(node *ast.CreateTableStmt) error
- func SplitSQL(statement string) ([]base.SingleSQL, error)
- func TransformDMLToSelect(ctx context.Context, tCtx base.TransformContext, statement string, ...) ([]base.BackupStatement, error)
- func TypeString(tp byte) string
- type AST
- type TableReference
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ANTLRParseTiDB ¶
func ANTLRParseTiDB(statement string) ([]*base.ParseResult, error)
func DealWithDelimiter ¶
DealWithDelimiter converts the delimiter statement to comment, also converts the following statement's delimiter to semicolon(`;`).
func Diagnose ¶
func Diagnose(_ context.Context, _ base.DiagnoseContext, statement string) ([]base.Diagnostic, error)
func ExtractDelimiter ¶
ExtractDelimiter extracts the delimiter from the delimiter statement.
func ExtractMySQLTableList ¶
ExtractMySQLTableList extracts all the TableNames from node. If asName is true, extract AsName prior to OrigName.
func GetQuerySpan ¶
func IsDelimiter ¶
IsDelimiter returns true if the statement is a delimiter statement.
func IsTiDBUnsupportDDLStmt ¶
IsTiDBUnsupportDDLStmt checks whether the `stmt` is unsupported DDL statement in TiDB, the following statements are unsupported: 1. `CREATE TRIGGER` 2. `CREATE EVENT` 3. `CREATE FUNCTION` 4. `CREATE PROCEDURE`.
func NormalizeTiDBIdentifier ¶
func NormalizeTiDBIdentifier(identifier parser.IIdentifierContext) string
NormalizeTiDBIdentifier normalizes the given identifier.
func NormalizeTiDBTextOrIdentifier ¶
func NormalizeTiDBTextOrIdentifier(ctx parser.ITextOrIdentifierContext) string
NormalizeTiDBTextOrIdentifier normalizes the given TextOrIdentifier.
func ParseTiDBForSyntaxCheck ¶
ParseTiDBForSyntaxCheck parses TiDB SQL for syntax checking purposes. Returns []base.AST with *TiDBAST instances.
func SetLineForMySQLCreateTableStmt ¶
func SetLineForMySQLCreateTableStmt(node *ast.CreateTableStmt) error
SetLineForMySQLCreateTableStmt sets the line for columns and table constraints in MySQL CREATE TABLE statments. This is a temporary function. Because we do not convert tidb AST to our AST. So we have to implement this. TODO(rebelice): remove it.
func TransformDMLToSelect ¶
func TypeString ¶
TypeString returns the string representation of the type for MySQL.
Types ¶
type AST ¶
type AST struct {
// StartPosition is the 1-based position where this statement starts.
StartPosition *storepb.Position
Node tidbast.StmtNode
}
AST is the AST implementation for TiDB parser. It implements the base.AST interface.
func GetTiDBAST ¶
GetTiDBAST extracts the TiDB AST from a base.AST. Returns the AST and true if it is a TiDB AST, nil and false otherwise.
func (*AST) ASTStartPosition ¶
ASTStartPosition implements base.AST interface.