~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/hash.h

  • Committer: Brian Aker
  • Date: 2009-02-21 00:18:15 UTC
  • Revision ID: brian@tangent.org-20090221001815-x20e8h71e984lvs1
Completion (?) of uint conversion.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
19
19
 
20
20
/* Dynamic hashing of record with different key-length */
21
21
 
22
 
#ifndef DRIZZLED_MY_HASH_H
23
 
#define DRIZZLED_MY_HASH_H
24
 
 
25
 
#include "drizzled/dynamic_array.h"
26
 
 
27
 
namespace drizzled
28
 
{
29
 
 
30
 
typedef struct charset_info_st CHARSET_INFO;
 
22
#ifndef MYSYS_HASH_H
 
23
#define MYSYS_HASH_H
 
24
 
 
25
#include <mysys/my_sys.h>
 
26
 
 
27
#ifdef __cplusplus
 
28
extern "C" {
 
29
#endif
31
30
 
32
31
/*
33
32
  Overhead to store an element in hash
44
43
typedef struct st_hash {
45
44
  /* Length of key if const length */
46
45
  size_t key_offset,key_length;
47
 
  uint32_t blength;
 
46
  size_t blength;
48
47
  uint32_t records;
49
48
  uint32_t flags;
50
49
  /* Place for hash_keys */
63
62
           hash_get_key get_key,
64
63
           hash_free_key free_element, uint32_t flags);
65
64
#define hash_init(A,B,C,D,E,F,G,H) _hash_init(A,0,B,C,D,E,F,G,H)
 
65
#define hash_init2(A,B,C,D,E,F,G,H,I) _hash_init(A,B,C,D,E,F,G,H,I)
66
66
void hash_free(HASH *tree);
 
67
void my_hash_reset(HASH *hash);
67
68
unsigned char *hash_element(HASH *hash,uint32_t idx);
68
69
unsigned char *hash_search(const HASH *info, const unsigned char *key,
69
70
                           size_t length);
73
74
                         size_t length, HASH_SEARCH_STATE *state);
74
75
bool my_hash_insert(HASH *info,const unsigned char *data);
75
76
bool hash_delete(HASH *hash,unsigned char *record);
 
77
bool hash_update(HASH *hash,unsigned char *record, unsigned char *old_key,
 
78
                 size_t old_key_length);
 
79
void hash_replace(HASH *hash, HASH_SEARCH_STATE *state, unsigned char *new_row);
76
80
 
 
81
#define hash_clear(H) memset((H), 0, sizeof(*(H)))
77
82
#define hash_inited(H) ((H)->array.buffer != 0)
78
 
 
79
 
} /* namespace drizzled */
80
 
 
81
 
#endif /* DRIZZLED_MY_HASH_H */
 
83
#define hash_init_opt(A,B,C,D,E,F,G,H)                                  \
 
84
  (!hash_inited(A) && _hash_init(A,0,B,C,D,E,F,G, H))
 
85
 
 
86
#ifdef __cplusplus
 
87
}
 
88
#endif
 
89
#endif