您现在的位置:主页 > 技术中心 > 数据库技术 > Mysql

Mysql源码学习——没那么简单的Hash(3)

来源:未知 责任编辑:责任编辑 发表时间:2014-01-06 18:17 点击:

 

 

 

初始化函数

 

   Hash初始化函数对外提供两个,my_hash_init和my_hash_init2,其区别即是否定义了growth_size(用于设置DYNAMIC_ARRAY的alloc_increment)。代码在mysys/hash.c中。

 

#define my_hash_init(A,B,C,D,E,F,G,H) \

          _my_hash_init(A,0,B,C,D,E,F,G,H)

#define my_hash_init2(A,B,C,D,E,F,G,H,I) \

          _my_hash_init(A,B,C,D,E,F,G,H,I)

 

/**

  @brief Initialize the hash

 

  @details

 

  Initialize the hash, by defining and giving valid values for

  its elements. The failure to allocate memory for the

  hash->array element will not result in a fatal failure. The

  dynamic array that is part of the hash will allocate memory

  as required during insertion.

 

  @param[in,out] hash         The hash that is initialized

  @param[in]     charset      The charater set information

  @param[in]     size         The hash size

  @param[in]     key_offest   The key offset for the hash

  @param[in]     key_length   The length of the key used in

                              the hash

  @param[in]     get_key      get the key for the hash

  @param[in]     free_element pointer to the function that

                              does cleanup

  @return        inidicates success or failure of initialization

    @retval 0 success

    @retval 1 failure

*/

my_bool

_my_hash_init(HASH *hash, uint growth_size, CHARSET_INFO *charset,

              ulong size, size_t key_offset, size_t key_length,

              my_hash_get_key get_key,

              void (*free_element)(void*), uint flags)

发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片

推荐热点

  • mysql-mmm
  • mysqldump命令——MySQL数据库备份还原
  • Oracle数据导入MySQL的快捷工具:MySQL Migration Tool
  • 简简单单储存过程——循环一个select结果集
  • MySQL数据库十大优化技巧
  • Mysql安装笔记
  • Mysql主主复制架构配置
  • Mysql的Procedure 参数为NULL问题分析
  • MySQL Stmt预处理提高效率问题的小研究
?? - ?? - ÝřŝžľŘÝź - TAGąęÇŠ - RSSśŠÔÄ - ??
Copyright © 2004-2024 上海卓卓网络科技有限公司