Documentation ¶
Index ¶
- Constants
- Variables
- func BindHint(originStmt, hintedStmt ast.StmtNode) ast.StmtNode
- type BindHandle
- func (h *BindHandle) AddBindRecord(record *BindRecord) (err error)
- func (h *BindHandle) AddDropInvalidBindTask(invalidBindRecord *BindRecord)
- func (h *BindHandle) DropBindRecord(record *BindRecord) (err error)
- func (h *BindHandle) DropInvalidBindRecord()
- func (h *BindHandle) GetAllBindRecord() (bindRecords []*BindMeta)
- func (h *BindHandle) GetBindRecord(hash, normdOrigSQL, db string) *BindMeta
- func (h *BindHandle) Size() int
- func (h *BindHandle) Update(fullLoad bool) (err error)
- type BindMeta
- type BindRecord
- type SessionHandle
Constants ¶
const ( // Using is the bind info's in use status. Using = "using" // Invalid is the bind info's invalid status. Invalid = "invalid" )
const SessionBindInfoKeyType sessionBindInfoKeyType = 0
SessionBindInfoKeyType is a variable key for store session bind info.
Variables ¶
var Lease = 3 * time.Second
Lease influences the duration of loading bind info and handling invalid bind.
Functions ¶
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) 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.