结构体key

 http://www.cnblogs.com/xpchild/p/3770823.html

 

http://blog.sae.sina.com.cn/archives/3968

 

实例

http://blog.sae.sina.com.cn/archives/3968

http://www.cnblogs.com/xpchild/p/3770823.html

 

typedef struct st_key {
  uint    key_length;            /* Tot length of key */
  ulong flags;                          /* dupp key and pack flags */
  uint    key_parts;            /* How many key_parts */ //一共有多少个column
  uint  extra_length;
  uint    usable_key_parts;        /* Should normally be = key_parts */
  uint  block_size;
  enum  ha_key_alg algorithm;
  /*
    Note that parser is used when the table is opened for use, and
    parser_name is used when the table is being created.
  */
  union
  {
    plugin_ref parser;                  /* Fulltext [pre]parser */
    LEX_STRING *parser_name;            /* Fulltext [pre]parser name */
  };
  KEY_PART_INFO *key_part; //key中具体的column
  char    *name;                /* Name of key */
  /*
    Array of AVG(#records with the same field value) for 1st ... Nth key part.
    0 means 'not known'.
    For temporary heap tables this member is NULL.
  */
  ulong *rec_per_key;
  union {
    int  bdb_return_if_eq;
  } handler;
  TABLE *table;
  LEX_STRING comment;
} KEY;

 

typedef struct st_key_part_info {    /* Info about a key part */
  Field *field;
  uint    offset;                /* offset in record (from 0) */
  uint    null_offset;            /* Offset to null_bit in record */
  uint16 length;                        /* Length of keypart value in bytes */
  /* 
    Number of bytes required to store the keypart value. This may be
    different from the "length" field as it also counts
     - possible NULL-flag byte (see HA_KEY_NULL_LENGTH)
     - possible HA_KEY_BLOB_LENGTH bytes needed to store actual value length.
  */
  uint16 store_length;
  uint16 key_type;
  uint16 fieldnr;            /* Fieldnum in UNIREG */
  uint16 key_part_flag;            /* 0 or HA_REVERSE_SORT */
  uint8 type;
  uint8 null_bit;            /* Position to null_bit */
} KEY_PART_INFO ;

 

 

typedef struct st_keyfile_info {    /* used with ha_info() */
  uchar ref[MAX_REFLENGTH];        /* Pointer to current row */
  uchar dupp_ref[MAX_REFLENGTH];    /* Pointer to dupp row */
  uint ref_length;            /* Length of ref (1-8) */
  uint block_size;            /* index block size */
  File filenr;                /* (uniq) filenr for table */
  ha_rows records;            /* Records i datafilen */
  ha_rows deleted;            /* Deleted records */
  ulonglong data_file_length;        /* Length off data file */
  ulonglong max_data_file_length;    /* Length off data file */
  ulonglong index_file_length;
  ulonglong max_index_file_length;
  ulonglong delete_length;        /* Free bytes */
  ulonglong auto_increment_value;
  int errkey,sortkey;            /* Last errorkey and sorted by */
  time_t create_time;            /* When table was created */
  time_t check_time;
  time_t update_time;
  ulong mean_rec_length;        /* physical reclength */
} KEYFILE_INFO;

 

posted @ 2015-12-24 16:48  taek  阅读(423)  评论(0编辑  收藏  举报