mysql

package
v1.2204.0-pre1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2022 License: MPL-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SchemaNotExistMessage              = "schema %s 不存在"
	SchemaExistMessage                 = "schema %s 已存在"
	TableNotExistMessage               = "表 %s 不存在"
	TableExistMessage                  = "表 %s 已存在"
	ColumnNotExistMessage              = "字段 %s 不存在"
	ColumnExistMessage                 = "字段 %s 已存在"
	ColumnIsAmbiguousMessage           = "字段 %s 指代不明"
	IndexNotExistMessage               = "索引 %s 不存在"
	IndexExistMessage                  = "索引 %s 已存在"
	DuplicateColumnsMessage            = "字段名 %s 重复"
	DuplicateIndexesMessage            = "索引名 %s 重复"
	MultiPrimaryKeyMessage             = "主键只能设置一个"
	KeyedColumnNotExistMessage         = "索引字段 %s 不存在"
	PrimaryKeyExistMessage             = "已经存在主键,不能再添加"
	PrimaryKeyNotExistMessage          = "当前没有主键,不能执行删除"
	ColumnsValuesNotMatchMessage       = "指定的值列数与字段列数不匹配"
	DuplicatePrimaryKeyedColumnMessage = "主键字段 %s 重复"
	DuplicateIndexedColumnMessage      = "索引 %s 字段 %s重复"
)
View Source
const (
	PTOSCNoUniqueIndexOrPrimaryKey          = "至少要包含主键或者唯一键索引才能使用 pt-online-schema-change"
	PTOSCAvoidUniqueIndex                   = "" /* 127-byte string literal not displayed */
	PTOSCAvoidRenameTable                   = "pt-online-schema-change 不支持使用rename table 来重命名表"
	PTOSCAvoidNoDefaultValueOnNotNullColumn = "非空字段必须设置默认值,不然 pt-online-schema-change 会执行失败"
)
View Source
const (
	NotSupportStatementRollback               = "暂不支持回滚该类型的语句"
	NotSupportMultiTableStatementRollback     = "暂不支持回滚多表的 DML 语句"
	NotSupportOnDuplicatStatementRollback     = "暂不支持回滚 ON DUPLICATE 语句"
	NotSupportSubQueryStatementRollback       = "暂不支持回滚带子查询的语句"
	NotSupportNoPrimaryKeyTableRollback       = "不支持回滚没有主键的表的DML语句"
	NotSupportInsertWithoutPrimaryKeyRollback = "不支持回滚 INSERT 没有指定主键的语句"
	NotSupportExceedMaxRowsRollback           = "预计影响行数超过配置的最大值,不生成回滚语句"
)
View Source
const CheckInvalidErrorFormat = "预检查失败: %v"

Variables

This section is empty.

Functions

func LoadPtTemplateFromFile

func LoadPtTemplateFromFile(fileName string) error

Types

type Config

type Config struct {
	DMLRollbackMaxRows int64
	DDLOSCMinSize      int64
	DDLGhostMinSize    int64
	// contains filtered or unexported fields
}

type Inspect

type Inspect struct {
	// Ctx is SQL session.
	Ctx *session.Context

	// HasInvalidSql represent one of the commit sql base-validation failed.
	HasInvalidSql bool
	// contains filtered or unexported fields
}

Inspect implements driver.Driver interface

func (*Inspect) Audit

func (i *Inspect) Audit(ctx context.Context, sql string) (*driver.AuditResult, error)

func (*Inspect) CheckExplain added in v1.2201.0

func (i *Inspect) CheckExplain(node ast.Node) error

func (*Inspect) CheckInvalid

func (i *Inspect) CheckInvalid(node ast.Node) error

func (*Inspect) CheckInvalidOffline

func (i *Inspect) CheckInvalidOffline(node ast.Node) error

func (*Inspect) Close

func (i *Inspect) Close(ctx context.Context)

func (*Inspect) Context

func (i *Inspect) Context() *session.Context

func (*Inspect) Exec

func (i *Inspect) Exec(ctx context.Context, query string) (_driver.Result, error)

func (*Inspect) GenRollbackSQL

func (i *Inspect) GenRollbackSQL(ctx context.Context, sql string) (string, string, error)

func (*Inspect) GenerateDDLStmtRollbackSql

func (i *Inspect) GenerateDDLStmtRollbackSql(node ast.Node) (rollbackSql, unableRollbackReason string, err error)

func (*Inspect) GenerateDMLStmtRollbackSql

func (i *Inspect) GenerateDMLStmtRollbackSql(node ast.Node) (rollbackSql, unableRollbackReason string, err error)

func (*Inspect) GenerateRollbackSql

func (i *Inspect) GenerateRollbackSql(node ast.Node) (string, string, error)

func (*Inspect) IsOfflineAudit

func (i *Inspect) IsOfflineAudit() bool

func (*Inspect) Logger

func (i *Inspect) Logger() *logrus.Entry

func (*Inspect) Parse

func (i *Inspect) Parse(ctx context.Context, sqlText string) ([]driver.Node, error)

func (*Inspect) ParseSql

func (i *Inspect) ParseSql(sql string) ([]ast.Node, error)

func (*Inspect) Ping

func (i *Inspect) Ping(ctx context.Context) error

func (*Inspect) Query

func (i *Inspect) Query(ctx context.Context, query string, args ...interface{}) ([]map[string]sql.NullString, error)

func (*Inspect) Schemas

func (i *Inspect) Schemas(ctx context.Context) ([]string, error)

func (*Inspect) Tx

func (i *Inspect) Tx(ctx context.Context, queries ...string) ([]_driver.Result, error)

Directories

Path Synopsis
optimizer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL