defines

package
v1.2.3-hotfix-20240916 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OKHeader          byte = 0x00
	ErrHeader         byte = 0xff
	EOFHeader         byte = 0xfe
	LocalInFileHeader byte = 0xfb
)

Header information.

View Source
const (
	SharedFileServiceName = "SHARED"
	LocalFileServiceName  = "LOCAL"
	ETLFileServiceName    = "ETL"
)
View Source
const (
	// TEMPORARY_DBNAME used to store all temporary table created by session.
	// when a user tries to create a database with this name, will be rejected at the plan stage.
	TEMPORARY_DBNAME = "%!%mo_temp_db"

	// TEMPORARY_TABLE_TN_ADDR marked as virtual tn address only for temporary table
	// When a TargetDN.address in TxnRequest is TEMPORARY_TABLE_TN_ADDR, this TxnRequest is for temporary table
	// and execution flow will go to the func in handleTemp
	TEMPORARY_TABLE_TN_ADDR = "%!%mo_temp_db_dn_address"
)
View Source
const (
	MORPCMinVersion    int64 = math.MinInt64
	MORPCVersion1      int64 = 1
	MORPCVersion2      int64 = 2
	MORPCVersion3      int64 = 3 // start from 1.3.0, 1.2.3
	MORPCLatestVersion       = MORPCVersion3
)
View Source
const (
	NOT_NULL_FLAG     uint32 = 1 << 0 /**< Field can't be NULL */
	PRI_KEY_FLAG      uint32 = 1 << 1 /**< Field is part of a primary key */
	UNIQUE_KEY_FLAG   uint32 = 1 << 2 /**< Field is part of a unique key */
	MULTIPLE_KEY_FLAG uint32 = 1 << 3 /**< Field is part of a key */
	BLOB_FLAG         uint32 = 1 << 4 /**< Field is a blob */
	UNSIGNED_FLAG     uint32 = 1 << 5 /**< Field is unsigned */
	ZEROFILL_FLAG     uint32 = 1 << 6 /**< Field is zerofill */
	BINARY_FLAG       uint32 = 1 << 7 /**< Field is binary   */

	/* The following are only sent to new clients */
	ENUM_FLAG               uint32 = 1 << 8  /**< field is an enum */
	AUTO_INCREMENT_FLAG     uint32 = 1 << 9  /**< field is a autoincrement field */
	TIMESTAMP_FLAG          uint32 = 1 << 10 /**< Field is a timestamp */
	SET_FLAG                uint32 = 1 << 11 /**< field is a set */
	NO_DEFAULT_VALUE_FLAG   uint32 = 1 << 12 /**< Field doesn't have default value */
	ON_UPDATE_NOW_FLAG      uint32 = 1 << 13 /**< Field is set to NOW on UPDATE */
	NUM_FLAG                uint32 = 1 << 15 /**< Field is num (for clients) */
	PART_KEY_FLAG           uint32 = 1 << 14 /**< Intern; Part of some key */
	GROUP_FLAG              uint32 = 1 << 15 /**< Intern: Group field */
	UNIQUE_FLAG             uint32 = 1 << 16 /**< Intern: Used by sql_yacc */
	BINCMP_FLAG             uint32 = 1 << 17 /**< Intern: Used by sql_yacc */
	GET_FIXED_FIELDS_FLAG   uint32 = 1 << 18 /**< Used to get fields in item tree */
	FIELD_IN_PART_FUNC_FLAG uint32 = 1 << 19 /**< Field part of partition func */
	/**
	Intern: Field in TABLE object for new version of altered table,
		  which participates in a newly added index.
	*/
	FIELD_IN_ADD_INDEX             uint32 = (1 << 20)
	FIELD_IS_RENAMED               uint32 = (1 << 21) /**< Intern: Field is being renamed */
	FIELD_FLAGS_STORAGE_MEDIA      uint32 = 22        /**< Field storage media, bit 22-23 */
	FIELD_FLAGS_STORAGE_MEDIA_MASK uint32 = (3 << FIELD_FLAGS_STORAGE_MEDIA)
	FIELD_FLAGS_COLUMN_FORMAT      uint32 = 24 /**< Field column format, bit 24-25 */
	FIELD_FLAGS_COLUMN_FORMAT_MASK uint32 = (3 << FIELD_FLAGS_COLUMN_FORMAT)
	FIELD_IS_DROPPED               uint32 = (1 << 26) /**< Intern: Field is being dropped */
	EXPLICIT_NULL_FLAG             uint32 = (1 << 27) /**< Field is explicitly specified as NULL by the user */
	FIELD_IS_MARKED                uint32 = (1 << 28) /**< Intern: field is marked, general purpose */

	/** Field will not be loaded in secondary engine. */
	NOT_SECONDARY_FLAG uint32 = (1 << 29)
	/** Field is explicitly marked as invisible by the user. */
	FIELD_IS_INVISIBLE uint32 = (1 << 30)
)

flags in mysql 8.0.23 source code : include/mysql_com.h

View Source
const (
	MaxUint24 = 1<<24 - 1
	MaxInt24  = 1<<23 - 1
	MinInt24  = -1 << 23
)

TypeInt24 bounds.

Variables

View Source
var CarryOnCtxKeys = []any{TenantIDKey{}, UserIDKey{}, RoleIDKey{}}

CarryOnCtxKeys defines keys needed to be serialized when pass context through net

Functions

func AttachAccount added in v1.1.1

func AttachAccount(ctx context.Context, accId uint32, userId uint32, roleId uint32) context.Context

func AttachAccountId added in v1.1.1

func AttachAccountId(ctx context.Context, accId uint32) context.Context

func AttachRoleId added in v1.1.1

func AttachRoleId(ctx context.Context, roleId uint32) context.Context

func AttachUserId added in v1.1.1

func AttachUserId(ctx context.Context, userId uint32) context.Context

func GetAccountId added in v0.8.0

func GetAccountId(ctx context.Context) (uint32, error)

func GetRoleId added in v1.1.1

func GetRoleId(ctx context.Context) uint32

func GetUserId added in v1.1.1

func GetUserId(ctx context.Context) uint32

Types

type AutoIncrCache added in v0.7.0

type AutoIncrCache struct {
	CurNum uint64
	MaxNum uint64
	Step   uint64
}

type AutoIncrCacheManager added in v0.8.0

type AutoIncrCacheManager struct {
	Mu             *sync.Mutex
	AutoIncrCaches map[string]AutoIncrCache
	MaxSize        uint64
}

The autoIncrCacheManager is initialized with a starting CN. The autoIncrCacheManager instance of each CN is stored in type service in package cnservice. The logic to manipulate the cache is in auto_incr.go

type BgKey added in v0.8.0

type BgKey struct{}

Determine if now is a bg sql.

type DatTypKey added in v0.8.0

type DatTypKey struct{}

type EngineKey added in v0.7.0

type EngineKey struct{}

EngineKey use EngineKey{} to get engine from Context

type InSp added in v0.8.0

type InSp struct{}

Determine if it is a stored procedure

type IsMoLogger added in v0.8.0

type IsMoLogger struct{}

type MysqlType added in v0.6.0

type MysqlType uint8
const (
	MYSQL_TYPE_DECIMAL     MysqlType = 0x00 //lenenc_str
	MYSQL_TYPE_TINY        MysqlType = 0x01 //int<1> int8
	MYSQL_TYPE_SHORT       MysqlType = 0x02 //int<2> int16
	MYSQL_TYPE_LONG        MysqlType = 0x03 //int<4> int32
	MYSQL_TYPE_FLOAT       MysqlType = 0x04 //(string.fix_len) -- (len=4) float
	MYSQL_TYPE_DOUBLE      MysqlType = 0x05 //(string.fix_len) -- (len=8) double
	MYSQL_TYPE_NULL        MysqlType = 0x06 //Text ResultSet: 0xFB; Binary ResultSet: The binary protocol sends NULL values as bits inside a bitmap instead of a full byte
	MYSQL_TYPE_TIMESTAMP   MysqlType = 0x07 //
	MYSQL_TYPE_LONGLONG    MysqlType = 0x08 //int<8> int64
	MYSQL_TYPE_INT24       MysqlType = 0x09 //int<4> int32
	MYSQL_TYPE_DATE        MysqlType = 0x0a //
	MYSQL_TYPE_TIME        MysqlType = 0x0b
	MYSQL_TYPE_DATETIME    MysqlType = 0x0c
	MYSQL_TYPE_YEAR        MysqlType = 0x0d //int<2> int16
	MYSQL_TYPE_NEWDATE     MysqlType = 0x0e /**< Internal to MySQL. Not used in protocol */
	MYSQL_TYPE_VARCHAR     MysqlType = 0x0f //lenenc_str
	MYSQL_TYPE_BIT         MysqlType = 0x10 //lenenc_str
	MYSQL_TYPE_TIMESTAMP2  MysqlType = 0x11 //
	MYSQL_TYPE_DATETIME2   MysqlType = 0x12 /**< Internal to MySQL. Not used in protocol */
	MYSQL_TYPE_TIME2       MysqlType = 0x13 /**< Internal to MySQL. Not used in protocol */
	MYSQL_TYPE_TYPED_ARRAY MysqlType = 0x14 /**< Used for replication only */

	MYSQL_TYPE_TEXT        MysqlType = 241 // add text to distinct blob and blob
	MYSQL_TYPE_INVALID     MysqlType = 242
	MYSQL_TYPE_UUID        MysqlType = 243
	MYSQL_TYPE_BOOL        MysqlType = 244 /**< Currently just a placeholder */
	MYSQL_TYPE_JSON        MysqlType = 0xf5
	MYSQL_TYPE_NEWDECIMAL  MysqlType = 0xf6
	MYSQL_TYPE_ENUM        MysqlType = 0xf7
	MYSQL_TYPE_SET         MysqlType = 0xf8
	MYSQL_TYPE_TINY_BLOB   MysqlType = 0xf9
	MYSQL_TYPE_MEDIUM_BLOB MysqlType = 0xfa
	MYSQL_TYPE_LONG_BLOB   MysqlType = 0xfb
	MYSQL_TYPE_BLOB        MysqlType = 0xfc
	MYSQL_TYPE_VAR_STRING  MysqlType = 0xfd //lenenc_str
	MYSQL_TYPE_STRING      MysqlType = 0xfe //lenenc_str
	MYSQL_TYPE_GEOMETRY    MysqlType = 0xff
)

func (*MysqlType) GetLength added in v0.6.0

func (typ *MysqlType) GetLength(width int32) uint32

type NodeIDKey added in v1.0.0

type NodeIDKey struct{}

type PkCheckByTN added in v1.0.0

type PkCheckByTN struct{}

PkCheckByTN whether TN does primary key uniqueness check against transaction's workspace or not.

type RoleIDKey added in v0.6.0

type RoleIDKey struct{}

type SourceScanResKey added in v1.1.0

type SourceScanResKey struct{}

type SqlKey added in v0.6.0

type SqlKey struct{}

SqlKey use SqlKey{} to get string value from Context

type StartTS added in v1.0.0

type StartTS struct{}

StartTS is the start timestamp of a statement.

type TemporaryTN added in v1.0.0

type TemporaryTN struct{}

TemporaryTN use TemporaryTN to get temporary storage from Context

type TenantIDKey added in v0.6.0

type TenantIDKey struct{}

type UserIDKey added in v0.6.0

type UserIDKey struct{}

type VarScopeKey added in v0.8.0

type VarScopeKey struct{}

Sp variable scope

Jump to

Keyboard shortcuts

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