MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
函数
MySQLProtocolStore

根据MySQL协议的描述实现的数据写入函数 更多...

函数

int store_int1 (char *buf, int8_t value)
 将数据写入到缓存中 更多...
 
int store_int2 (char *buf, int16_t value)
 将数据写入到缓存中 更多...
 
int store_int3 (char *buf, int32_t value)
 将数据写入到缓存中 更多...
 
int store_int4 (char *buf, int32_t value)
 将数据写入到缓存中 更多...
 
int store_int6 (char *buf, int64_t value)
 将数据写入到缓存中 更多...
 
int store_int8 (char *buf, int64_t value)
 将数据写入到缓存中 更多...
 
int store_lenenc_int (char *buf, uint64_t value)
 将数据写入到缓存中 更多...
 
int store_null_terminated_string (char *buf, const char *s)
 将以'\0'结尾的字符串写入到缓存中 更多...
 
int store_fix_length_string (char *buf, const char *s, int len)
 将指定长度的字符串写入到缓存中 更多...
 
int store_lenenc_string (char *buf, const char *s)
 按照带有长度标识的字符串写入到缓存,长度标识以变长整数编码 更多...
 

详细描述

根据MySQL协议的描述实现的数据写入函数

注解
当前仅考虑小端模式,所以当前的代码仅能运行在小端模式的机器上,比如Intel。

函数说明

◆ store_fix_length_string()

int store_fix_length_string ( char *  buf,
const char *  s,
int  len 
)

将指定长度的字符串写入到缓存中

参数
buf数据缓存
s要写入的字符串
len字符串的长度
返回
int 写入的字节数

◆ store_int1()

int store_int1 ( char *  buf,
int8_t  value 
)

将数据写入到缓存中

参数
buf数据缓存
value要写入的值
返回
int 写入的字节数

◆ store_int2()

int store_int2 ( char *  buf,
int16_t  value 
)

将数据写入到缓存中

参数
buf数据缓存
value要写入的值
返回
int 写入的字节数

◆ store_int3()

int store_int3 ( char *  buf,
int32_t  value 
)

将数据写入到缓存中

参数
buf数据缓存
value要写入的值
返回
int 写入的字节数

◆ store_int4()

int store_int4 ( char *  buf,
int32_t  value 
)

将数据写入到缓存中

参数
buf数据缓存
value要写入的值
返回
int 写入的字节数

◆ store_int6()

int store_int6 ( char *  buf,
int64_t  value 
)

将数据写入到缓存中

参数
buf数据缓存
value要写入的值
返回
int 写入的字节数

◆ store_int8()

int store_int8 ( char *  buf,
int64_t  value 
)

将数据写入到缓存中

参数
buf数据缓存
value要写入的值
返回
int 写入的字节数

◆ store_lenenc_int()

int store_lenenc_int ( char *  buf,
uint64_t  value 
)

将数据写入到缓存中

按照MySQL协议的描述,这是一个变长编码的整数,最大可以编码8个字节的整数。不同大小的数字,第一个字节的值不同。

参数
buf数据缓存
value要写入的值
返回
int 写入的字节数

◆ store_lenenc_string()

int store_lenenc_string ( char *  buf,
const char *  s 
)

按照带有长度标识的字符串写入到缓存,长度标识以变长整数编码

参数
buf数据缓存
s要写入的字符串
返回
int 写入的字节数

◆ store_null_terminated_string()

int store_null_terminated_string ( char *  buf,
const char *  s 
)

将以'\0'结尾的字符串写入到缓存中

参数
buf数据缓存
s要写入的字符串
返回
int 写入的字节数