func (se *SessionExecutor) GetCharset() string {
	return se.charset
}
GetCharset return charset
package server
import (
	"fmt"
	"strconv"
	"strings"
	"sync"
	"time"
	"github.com/nooncall/shazam/backend"
	"github.com/nooncall/shazam/core/errors"
	"github.com/nooncall/shazam/log"
	"github.com/nooncall/shazam/mysql"
	"github.com/nooncall/shazam/parser"
	"github.com/nooncall/shazam/parser/ast"
	"github.com/nooncall/shazam/parser/format"
	"github.com/nooncall/shazam/proxy/plan"
	"github.com/nooncall/shazam/util"
	"github.com/nooncall/shazam/util/hack"
)
const (
	masterComment = "/*master*/"
)
type SessionExecutor struct {
	manager *Manager
	namespace string
	user      string
	db        string
	status       uint16
	lastInsertID uint64
	collation        mysql.CollationID
	charset          string
	sessionVariables *mysql.SessionVariables
	txConns map[string]*backend.PooledConnection
	txLock  sync.Mutex
	stmtID uint32
	stmts  map[uint32]*Stmt  
	parser *parser.Parser
}
type Response struct {
	RespType int
	Status   uint16
	Data     interface{}
}
const (
	RespOK = iota
	RespResult
	RespError
	RespFieldList
	RespPrepare
	RespEOF
	RespNoop
)
func CreateOKResponse(status uint16) Response {
	return Response{
		RespType: RespOK,
		Status:   status,
	}
}
func CreateResultResponse(status uint16, result *mysql.Result) Response {
	return Response{
		RespType: RespResult,
		Status:   status,
		Data:     result,
	}
}
func CreateErrorResponse(status uint16, err error) Response {
	return Response{
		RespType: RespError,
		Status:   status,
		Data:     err,
	}
}
func CreateFieldListResponse(status uint16, fl []*mysql.Field) Response {
	return Response{
		RespType: RespFieldList,
		Status:   status,
		Data:     fl,
	}
}
func CreatePrepareResponse(status uint16, stmt *Stmt) Response {
	return Response{
		RespType: RespPrepare,
		Status:   status,
		Data:     stmt,
	}
}
func CreateEOFResponse(status uint16) Response {
	return Response{
		RespType: RespEOF,
		Status:   status,
	}
}
func CreateNoopResponse() Response {
	return Response{
		RespType: RespNoop,
	}
}
func newSessionExecutor(manager *Manager) *SessionExecutor {
	return &SessionExecutor{
		sessionVariables: mysql.NewSessionVariables(),
		txConns:          make(map[string]*backend.PooledConnection),
		stmts:            make(map[uint32]*Stmt),
		parser:           parser.New(),
		status:           initClientConnStatus,
		manager:          manager,
	}
}
func (se *SessionExecutor) GetNamespace() *Namespace {
	return se.manager.GetNamespace(se.namespace)
}
func (se *SessionExecutor) GetVariables() *mysql.SessionVariables {
	return se.sessionVariables
}
func (se *SessionExecutor) setIntSessionVariable(name string, valueStr string) error {
	if strings.ToLower(valueStr) == mysql.KeywordDefault {
		se.sessionVariables.Delete(name)
		return nil
	}
	value, err := strconv.ParseInt(valueStr, 10, 64)
	if err != nil {
		return err
	}
	if err = se.sessionVariables.Set(name, value); err != nil {
		return err
	}
	return nil
}
func (se *SessionExecutor) setStringSessionVariable(name string, valueStr string) error {
	if strings.ToLower(valueStr) == mysql.KeywordDefault {
		se.sessionVariables.Delete(name)
		return nil
	}
	return se.sessionVariables.Set(name, valueStr)
}
func (se *SessionExecutor) GetLastInsertID() uint64 {
	return se.lastInsertID
}
func (se *SessionExecutor) SetLastInsertID(id uint64) {
	se.lastInsertID = id
}
func (se *SessionExecutor) GetStatus() uint16 {
	return se.status
}
func (se *SessionExecutor) SetStatus(status uint16) {
	se.status = status
}
func (se *SessionExecutor) SetCollationID(id mysql.CollationID) {
	se.collation = id
}
func (se *SessionExecutor) SetNamespaceDefaultCollationID() {
	se.collation = se.manager.GetNamespace(se.namespace).GetDefaultCollationID()
}
func (se *SessionExecutor) GetCollationID() mysql.CollationID {
	return se.collation
}
func (se *SessionExecutor) SetCharset(charset string) {
	se.charset = charset
}
func (se SessionExecutor) SetNamespaceDefaultCharset() {
	se.charset = se.manager.GetNamespace(se.namespace).GetDefaultCharset()
}