stmtctx

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: Apache-2.0, Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// WarnLevelError represents level "Error" for 'SHOW WARNINGS' syntax.
	WarnLevelError = "Error"
	// WarnLevelWarning represents level "Warning" for 'SHOW WARNINGS' syntax.
	WarnLevelWarning = "Warning"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type SQLWarn

type SQLWarn struct {
	Level string
	Err   error
}

SQLWarn relates a sql warning and it's level.

type StatementContext

type StatementContext struct {

	// InReorgAttribute is indicated for cast function that the transition is a kind of reorg process.
	InReorgAttribute bool

	IgnoreTruncate            bool
	UseCache                  bool
	InNullRejectCheck         bool
	OptimDependOnMutableConst bool

	// Copied from SessionVars.TimeZone.
	TimeZone *time.Location

	TblInfo2UnionScan map[*model.TableInfo]bool
	// contains filtered or unexported fields
}

StatementContext contains variables for a statement. It should be reset before executing a statement.

func (*StatementContext) AppendError

func (sc *StatementContext) AppendError(warn error)

AppendError appends a warning with level 'Error'.

func (*StatementContext) AppendWarning

func (sc *StatementContext) AppendWarning(warn error)

AppendWarning appends a warning with level 'Warning'.

func (*StatementContext) GetNow

func (sc *StatementContext) GetNow() time.Time

func (*StatementContext) HandleOverflow

func (sc *StatementContext) HandleOverflow(err error, warnErr error) error

HandleOverflow treats ErrOverflow as warnings or returns the error based on the StmtCtx.OverflowAsWarning state.

func (*StatementContext) HandleTruncate

func (sc *StatementContext) HandleTruncate(err error) error

HandleTruncate ignores or returns the error based on the StatementContext state.

func (*StatementContext) ShouldClipToZero

func (sc *StatementContext) ShouldClipToZero() bool

ShouldClipToZero indicates whether values less than 0 should be clipped to 0 for unsigned integer types. This is the case for `insert`, `update`, `alter table`, `create table` and `load data infile` statements, when not in strict SQL mode. see https://dev.mysql.com/doc/refman/5.7/en/out-of-range-and-overflow.html

func (*StatementContext) ShouldIgnoreOverflowError

func (sc *StatementContext) ShouldIgnoreOverflowError() bool

ShouldIgnoreOverflowError indicates whether we should ignore the error when type conversion overflows, so we can leave it for further processing like clipping values less than 0 to 0 for unsigned integer types.

func (*StatementContext) TruncateWarnings

func (sc *StatementContext) TruncateWarnings(start int) []SQLWarn

TruncateWarnings truncates warnings begin from start and returns the truncated warnings.

func (*StatementContext) WarningCount

func (sc *StatementContext) WarningCount() uint16

WarningCount gets warning count.

type TableEntry

type TableEntry struct {
	DB    string
	Table string
}

TableEntry presents table in db.

Jump to

Keyboard shortcuts

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