xeval

package
v0.0.0-...-ea486a4 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FlagIgnoreTruncate indicates if truncate error should be ignored.
	// Read-only statements should ignore truncate error, write statements should not ignore truncate error.
	FlagIgnoreTruncate uint64 = 1
	// FlagTruncateAsWarning indicates if truncate error should be returned as warning.
	// This flag only matters if FlagIgnoreTruncate is not set, in strict sql mode, truncate error should
	// be returned as error, in non-strict sql mode, truncate error should be saved as warning.
	FlagTruncateAsWarning uint64 = 1 << 1
)

Flags are used by tipb.SelectRequest.Flags to handle execution mode, like how to handle truncate error.

View Source
const (
	CodeInvalid = 3
)

Error codes.

Variables

View Source
var (
	ErrInvalid = terror.ClassXEval.New(CodeInvalid, "invalid operation")
)

Error instances.

Functions

func ComputeArithmetic

func ComputeArithmetic(sc *variable.StatementContext, op tipb.ExprType, left types.Datum, right types.Datum) (types.Datum, error)

ComputeArithmetic computes the arithmetic operation on two datums.

func ComputeBit

func ComputeBit(sc *variable.StatementContext, op tipb.ExprType, left, right types.Datum) (types.Datum, error)

ComputeBit computes the bitwise operation on two datums.

func FlagsToStatementContext

func FlagsToStatementContext(flags uint64) *variable.StatementContext

FlagsToStatementContext creates a StatementContext from a `tipb.SelectRequest.Flags`.

Types

type Evaluator

type Evaluator struct {
	Row map[int64]types.Datum // column values.
	// contains filtered or unexported fields
}

Evaluator evaluates tipb.Expr.

func NewEvaluator

func NewEvaluator(sc *variable.StatementContext) *Evaluator

NewEvaluator creates a new Evaluator instance.

func (*Evaluator) Eval

func (e *Evaluator) Eval(expr *tipb.Expr) (types.Datum, error)

Eval evaluates expr to a Datum.

Jump to

Keyboard shortcuts

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