MySQL 9.1.0
Source Code Documentation
mi_packrec.cc File Reference
#include "my_config.h"
#include <sys/types.h>
#include <algorithm>
#include "my_byteorder.h"
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_io.h"
#include "my_macros.h"
#include "my_pointer_arithmetic.h"
#include "sql/field.h"
#include "storage/myisam/fulltext.h"
#include "storage/myisam/myisamdef.h"
#include <sys/mman.h>

Macros

#define IS_CHAR   ((uint)32768) /* Bit if char (not offset) in tree */
 
#define HEAD_LENGTH   32 /* Length of fixed header */
 
#define BITS_SAVED   16
 
#define MAX_QUICK_TABLE_BITS   6
 
#define get_bit(BU)
 
#define skip_to_next_byte(BU)   ((BU)->bits &= ~7)
 
#define get_bits(BU, count)
 
#define decode_bytes_test_bit(bit)
 
#define OFFSET_TABLE_SIZE   512
 

Typedefs

typedef void(* unpack_function_t) (MI_COLUMNDEF *field, MI_BIT_BUFF *buff, uchar *to, uchar *end)
 

Functions

static uint read_huff_table (MI_BIT_BUFF *bit_buff, MI_DECODE_TREE *decode_tree, uint16 **decode_table, uchar **intervall_buff, uint16 *tmp_buff)
 
static void make_quick_table (uint16 *to_table, uint16 *decode_table, uint *next_free, uint value, uint bits, uint max_bits)
 
static void fill_quick_table (uint16 *table, uint bits, uint max_bits, uint value)
 
static uint copy_decode_table (uint16 *to_pos, uint offset, uint16 *decode_table)
 
static uint find_longest_bitstream (uint16 *table, uint16 *end)
 
static unpack_function_t get_unpack_function (MI_COLUMNDEF *rec)
 
static void uf_zerofill_skip_zero (MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, uchar *end)
 
static void uf_skip_zero (MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, uchar *end)
 
static void uf_space_normal (MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, uchar *end)
 
static void uf_space_endspace_selected (MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, uchar *end)
 
static void uf_endspace_selected (MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, uchar *end)
 
static void uf_space_endspace (MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, uchar *end)
 
static void uf_endspace (MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, uchar *end)
 
static void uf_space_prespace_selected (MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, uchar *end)
 
static void uf_prespace_selected (MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, uchar *end)
 
static void uf_space_prespace (MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, uchar *end)
 
static void uf_prespace (MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, uchar *end)
 
static void uf_zerofill_normal (MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, uchar *end)
 
static void uf_constant (MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, uchar *end)
 
static void uf_intervall (MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, uchar *end)
 
static void uf_zero (MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, uchar *end)
 
static void uf_blob (MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, uchar *end)
 
static void uf_varchar1 (MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, uchar *end)
 
static void uf_varchar2 (MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, uchar *end)
 
static void decode_bytes (MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to, uchar *end)
 
static uint decode_pos (MI_BIT_BUFF *bit_buff, MI_DECODE_TREE *decode_tree)
 
static void init_bit_buffer (MI_BIT_BUFF *bit_buff, uchar *buffer, uint length)
 
static uint fill_and_get_bits (MI_BIT_BUFF *bit_buff, uint count)
 
static void fill_buffer (MI_BIT_BUFF *bit_buff)
 
static uint max_bit (uint value)
 
static uchar_mi_mempack_get_block_info (MI_INFO *myisam, MI_BIT_BUFF *bit_buff, MI_BLOCK_INFO *info, uchar **rec_buff_p, uchar *header)
 
bool _mi_read_pack_info (MI_INFO *info, bool fix_keys)
 
int _mi_read_pack_record (MI_INFO *info, my_off_t filepos, uchar *buf)
 
int _mi_pack_rec_unpack (MI_INFO *info, MI_BIT_BUFF *bit_buff, uchar *to, uchar *from, ulong reclength)
 
int _mi_read_rnd_pack_record (MI_INFO *info, uchar *buf, my_off_t filepos, bool skip_deleted_blocks)
 
uint _mi_pack_get_block_info (MI_INFO *myisam, MI_BIT_BUFF *bit_buff, MI_BLOCK_INFO *info, uchar **rec_buff_p, File file, my_off_t filepos)
 
static int _mi_read_mempack_record (MI_INFO *info, my_off_t filepos, uchar *buf)
 
static int _mi_read_rnd_mempack_record (MI_INFO *, uchar *, my_off_t, bool)
 
bool _mi_memmap_file (MI_INFO *info)
 
void _mi_unmap_file (MI_INFO *info)
 
uint save_pack_length (uint version, uchar *block_buff, ulong length)
 
uint read_pack_length (uint version, const uchar *buf, ulong *length)
 
uint calc_pack_length (uint version, ulong length)
 

Variables

static mi_bit_type mask []
 

Macro Definition Documentation

◆ BITS_SAVED

#define BITS_SAVED   16

◆ decode_bytes_test_bit

#define decode_bytes_test_bit (   bit)
Value:
if (low_byte & (1 << (7 - bit))) pos++; \
if (*pos & IS_CHAR) { \
bits -= (bit + 1); \
break; \
} \
pos += *pos
#define IS_CHAR
Definition: mi_packrec.cc:43

◆ get_bit

#define get_bit (   BU)
Value:
((BU)->bits ? (BU)->current_byte & ((mi_bit_type)1 << --(BU)->bits) \
: (fill_buffer(BU), (BU)->bits = BITS_SAVED - 1, \
(BU)->current_byte & ((mi_bit_type)1 << (BITS_SAVED - 1))))
#define BITS_SAVED
Definition: mi_packrec.cc:52
static void fill_buffer(MI_BIT_BUFF *bit_buff)
Definition: mi_packrec.cc:1286
uint mi_bit_type
Definition: myisamdef.h:243

◆ get_bits

#define get_bits (   BU,
  count 
)
Value:
(((BU)->bits >= count) \
? (((BU)->current_byte >> ((BU)->bits -= count)) & mask[count]) \
static uint fill_and_get_bits(MI_BIT_BUFF *bit_buff, uint count)
Definition: mi_packrec.cc:1274
static mi_bit_type mask[]
Definition: mi_packrec.cc:141
static int count
Definition: myisam_ftdump.cc:45

◆ HEAD_LENGTH

#define HEAD_LENGTH   32 /* Length of fixed header */

◆ IS_CHAR

#define IS_CHAR   ((uint)32768) /* Bit if char (not offset) in tree */

◆ MAX_QUICK_TABLE_BITS

#define MAX_QUICK_TABLE_BITS   6

◆ OFFSET_TABLE_SIZE

#define OFFSET_TABLE_SIZE   512

◆ skip_to_next_byte

#define skip_to_next_byte (   BU)    ((BU)->bits &= ~7)

Typedef Documentation

◆ unpack_function_t

typedef void(* unpack_function_t) (MI_COLUMNDEF *field, MI_BIT_BUFF *buff, uchar *to, uchar *end)

Function Documentation

◆ _mi_memmap_file()

bool _mi_memmap_file ( MI_INFO info)

◆ _mi_mempack_get_block_info()

static uchar * _mi_mempack_get_block_info ( MI_INFO myisam,
MI_BIT_BUFF bit_buff,
MI_BLOCK_INFO info,
uchar **  rec_buff_p,
uchar header 
)
static

◆ _mi_pack_get_block_info()

uint _mi_pack_get_block_info ( MI_INFO myisam,
MI_BIT_BUFF bit_buff,
MI_BLOCK_INFO info,
uchar **  rec_buff_p,
File  file,
my_off_t  filepos 
)

◆ _mi_pack_rec_unpack()

int _mi_pack_rec_unpack ( MI_INFO info,
MI_BIT_BUFF bit_buff,
uchar to,
uchar from,
ulong  reclength 
)

◆ _mi_read_mempack_record()

static int _mi_read_mempack_record ( MI_INFO info,
my_off_t  filepos,
uchar buf 
)
static

◆ _mi_read_pack_info()

bool _mi_read_pack_info ( MI_INFO info,
bool  fix_keys 
)

◆ _mi_read_pack_record()

int _mi_read_pack_record ( MI_INFO info,
my_off_t  filepos,
uchar buf 
)

◆ _mi_read_rnd_mempack_record()

static int _mi_read_rnd_mempack_record ( MI_INFO info,
uchar buf,
my_off_t  filepos,
bool  skip_deleted_blocks 
)
static

◆ _mi_read_rnd_pack_record()

int _mi_read_rnd_pack_record ( MI_INFO info,
uchar buf,
my_off_t  filepos,
bool  skip_deleted_blocks 
)

◆ _mi_unmap_file()

void _mi_unmap_file ( MI_INFO info)

◆ calc_pack_length()

uint calc_pack_length ( uint  version,
ulong  length 
)

◆ copy_decode_table()

static uint copy_decode_table ( uint16 to_pos,
uint  offset,
uint16 decode_table 
)
static

◆ decode_bytes()

static void decode_bytes ( MI_COLUMNDEF rec,
MI_BIT_BUFF bit_buff,
uchar to,
uchar end 
)
static

◆ decode_pos()

static uint decode_pos ( MI_BIT_BUFF bit_buff,
MI_DECODE_TREE decode_tree 
)
static

◆ fill_and_get_bits()

static uint fill_and_get_bits ( MI_BIT_BUFF bit_buff,
uint  count 
)
static

◆ fill_buffer()

static void fill_buffer ( MI_BIT_BUFF bit_buff)
static

◆ fill_quick_table()

static void fill_quick_table ( uint16 table,
uint  bits,
uint  max_bits,
uint  value 
)
static

◆ find_longest_bitstream()

static uint find_longest_bitstream ( uint16 table,
uint16 end 
)
static

◆ get_unpack_function()

static unpack_function_t get_unpack_function ( MI_COLUMNDEF rec)
static

◆ init_bit_buffer()

static void init_bit_buffer ( MI_BIT_BUFF bit_buff,
uchar buffer,
uint  length 
)
static

◆ make_quick_table()

static void make_quick_table ( uint16 to_table,
uint16 decode_table,
uint *  next_free,
uint  value,
uint  bits,
uint  max_bits 
)
static

◆ max_bit()

static uint max_bit ( uint  value)
static

◆ read_huff_table()

static uint read_huff_table ( MI_BIT_BUFF bit_buff,
MI_DECODE_TREE decode_tree,
uint16 **  decode_table,
uchar **  intervall_buff,
uint16 tmp_buff 
)
static

◆ read_pack_length()

uint read_pack_length ( uint  version,
const uchar buf,
ulong *  length 
)

◆ save_pack_length()

uint save_pack_length ( uint  version,
uchar block_buff,
ulong  length 
)

◆ uf_blob()

static void uf_blob ( MI_COLUMNDEF rec,
MI_BIT_BUFF bit_buff,
uchar to,
uchar end 
)
static

◆ uf_constant()

static void uf_constant ( MI_COLUMNDEF rec,
MI_BIT_BUFF bit_buff,
uchar to,
uchar end 
)
static

◆ uf_endspace()

static void uf_endspace ( MI_COLUMNDEF rec,
MI_BIT_BUFF bit_buff,
uchar to,
uchar end 
)
static

◆ uf_endspace_selected()

static void uf_endspace_selected ( MI_COLUMNDEF rec,
MI_BIT_BUFF bit_buff,
uchar to,
uchar end 
)
static

◆ uf_intervall()

static void uf_intervall ( MI_COLUMNDEF rec,
MI_BIT_BUFF bit_buff,
uchar to,
uchar end 
)
static

◆ uf_prespace()

static void uf_prespace ( MI_COLUMNDEF rec,
MI_BIT_BUFF bit_buff,
uchar to,
uchar end 
)
static

◆ uf_prespace_selected()

static void uf_prespace_selected ( MI_COLUMNDEF rec,
MI_BIT_BUFF bit_buff,
uchar to,
uchar end 
)
static

◆ uf_skip_zero()

static void uf_skip_zero ( MI_COLUMNDEF rec,
MI_BIT_BUFF bit_buff,
uchar to,
uchar end 
)
static

◆ uf_space_endspace()

static void uf_space_endspace ( MI_COLUMNDEF rec,
MI_BIT_BUFF bit_buff,
uchar to,
uchar end 
)
static

◆ uf_space_endspace_selected()

static void uf_space_endspace_selected ( MI_COLUMNDEF rec,
MI_BIT_BUFF bit_buff,
uchar to,
uchar end 
)
static

◆ uf_space_normal()

static void uf_space_normal ( MI_COLUMNDEF rec,
MI_BIT_BUFF bit_buff,
uchar to,
uchar end 
)
static

◆ uf_space_prespace()

static void uf_space_prespace ( MI_COLUMNDEF rec,
MI_BIT_BUFF bit_buff,
uchar to,
uchar end 
)
static

◆ uf_space_prespace_selected()

static void uf_space_prespace_selected ( MI_COLUMNDEF rec,
MI_BIT_BUFF bit_buff,
uchar to,
uchar end 
)
static

◆ uf_varchar1()

static void uf_varchar1 ( MI_COLUMNDEF rec,
MI_BIT_BUFF bit_buff,
uchar to,
uchar end 
)
static

◆ uf_varchar2()

static void uf_varchar2 ( MI_COLUMNDEF rec,
MI_BIT_BUFF bit_buff,
uchar to,
uchar end 
)
static

◆ uf_zero()

static void uf_zero ( MI_COLUMNDEF rec,
MI_BIT_BUFF bit_buff,
uchar to,
uchar end 
)
static

◆ uf_zerofill_normal()

static void uf_zerofill_normal ( MI_COLUMNDEF rec,
MI_BIT_BUFF bit_buff,
uchar to,
uchar end 
)
static

◆ uf_zerofill_skip_zero()

static void uf_zerofill_skip_zero ( MI_COLUMNDEF rec,
MI_BIT_BUFF bit_buff,
uchar to,
uchar end 
)
static

Variable Documentation

◆ mask

mi_bit_type mask[]
static
Initial value:
= {
0x00000000, 0x00000001, 0x00000003, 0x00000007, 0x0000000f, 0x0000001f,
0x0000003f, 0x0000007f, 0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff,
0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff, 0x0000ffff,
}