bindinfo

package
v0.0.0-...-3633c1a Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Using is the bind info's in use status.
	Using = "using"

	// Invalid is the bind info's invalid status.
	Invalid = "invalid"
)
View Source
const SessionBindInfoKeyType sessionBindInfoKeyType = 0

SessionBindInfoKeyType is a variable key for store session bind info.

Variables

View Source
var Lease = 3 * time.Second

Lease influences the duration of loading bind info and handling invalid bind.

Functions

func BindHint

func BindHint(originStmt, hintedStmt ast.StmtNode) ast.StmtNode

BindHint will add hints for originStmt according to hintedStmt' hints.

Types

type BindHandle

type BindHandle struct {
	// contains filtered or unexported fields
}

BindHandle is used to handle all global sql bind operations.

func NewBindHandle

func NewBindHandle(ctx sessionctx.Context) *BindHandle

NewBindHandle creates a new BindHandle.

func (*BindHandle) AddBindRecord

func (h *BindHandle) AddBindRecord(record *BindRecord) (err error)

AddBindRecord adds a BindRecord to the storage and BindMeta to the cache.

func (*BindHandle) AddDropInvalidBindTask

func (h *BindHandle) AddDropInvalidBindTask(invalidBindRecord *BindRecord)

AddDropInvalidBindTask add bindRecord to invalidBindRecordMap when the bindRecord need to be deleted.

func (*BindHandle) DropBindRecord

func (h *BindHandle) DropBindRecord(record *BindRecord) (err error)

DropBindRecord drops a BindRecord to the storage and BindMeta int the cache.

func (*BindHandle) DropInvalidBindRecord

func (h *BindHandle) DropInvalidBindRecord()

DropInvalidBindRecord execute the drop bindRecord task.

func (*BindHandle) GetAllBindRecord

func (h *BindHandle) GetAllBindRecord() (bindRecords []*BindMeta)

GetAllBindRecord return all bind record in cache.

func (*BindHandle) GetBindRecord

func (h *BindHandle) GetBindRecord(hash, normdOrigSQL, db string) *BindMeta

GetBindRecord return the bindMeta of the (normdOrigSQL,db) if bindMeta exist.

func (*BindHandle) Size

func (h *BindHandle) Size() int

Size return the size of bind info cache.

func (*BindHandle) Update

func (h *BindHandle) Update(fullLoad bool) (err error)

Update updates the global sql bind cache.

type BindMeta

type BindMeta struct {
	*BindRecord
	Ast ast.StmtNode //ast will be used to do query sql bind check
}

BindMeta stores the basic bind info and bindSql astNode.

type BindRecord

type BindRecord struct {
	OriginalSQL string
	BindSQL     string
	Db          string
	// Status represents the status of the binding. It can only be one of the following values:
	// 1. deleted: BindRecord is deleted, can not be used anymore.
	// 2. using: BindRecord is in the normal active mode.
	Status     string
	CreateTime types.Time
	UpdateTime types.Time
	Charset    string
	Collation  string
}

BindRecord represents a sql bind record retrieved from the storage.

type SessionHandle

type SessionHandle struct {
	// contains filtered or unexported fields
}

SessionHandle is used to handle all session sql bind operations.

func NewSessionBindHandle

func NewSessionBindHandle(parser *parser.Parser) *SessionHandle

NewSessionBindHandle creates a new SessionBindHandle.

func (*SessionHandle) AddBindRecord

func (h *SessionHandle) AddBindRecord(record *BindRecord) error

AddBindRecord new a BindRecord with BindMeta, add it to the cache.

func (*SessionHandle) DropBindRecord

func (h *SessionHandle) DropBindRecord(record *BindRecord)

DropBindRecord drops a BindRecord in the cache.

func (*SessionHandle) GetAllBindRecord

func (h *SessionHandle) GetAllBindRecord() (bindRecords []*BindMeta)

GetAllBindRecord return all session bind info.

func (*SessionHandle) GetBindRecord

func (h *SessionHandle) GetBindRecord(normdOrigSQL, db string) *BindMeta

GetBindRecord return the BindMeta of the (normdOrigSQL,db) if BindMeta exist.

Jump to

Keyboard shortcuts

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