~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/heap/hp_update.cc

  • Committer: Monty Taylor
  • Date: 2009-04-14 19:16:51 UTC
  • mto: (997.2.5 mordred)
  • mto: This revision was merged to the branch mainline in revision 994.
  • Revision ID: mordred@inaugust.com-20090414191651-ltbww6hpqks8k7qk
Clarified instructions in README.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
/* Update current record in heap-database */
17
17
 
18
 
#include "heap_priv.h"
19
 
 
20
 
using namespace drizzled;
 
18
#include "heapdef.h"
21
19
 
22
20
int heap_update(HP_INFO *info, const unsigned char *old_record, const unsigned char *new_record)
23
21
{
32
30
  pos=info->current_ptr;
33
31
 
34
32
  if (info->opt_flag & READ_CHECK_USED && hp_rectest(info,old_record))
35
 
    return(errno);                              /* Record changed */
 
33
    return(my_errno);                           /* Record changed */
36
34
 
37
35
  old_length = hp_get_encoded_data_length(share, old_record, &old_chunk_count);
38
36
  new_length = hp_get_encoded_data_length(share, new_record, &new_chunk_count);
40
38
  if (new_chunk_count > old_chunk_count) {
41
39
    /* extend the old chunkset size as necessary, but do not shrink yet */
42
40
    if (hp_reallocate_chunkset(&share->recordspace, new_chunk_count, pos)) {
43
 
      return(errno);                          /* Out of memory or table space */
 
41
      return(my_errno);                          /* Out of memory or table space */
44
42
    }
45
43
  }
46
44
 
72
70
  return(0);
73
71
 
74
72
 err:
75
 
  if (errno == HA_ERR_FOUND_DUPP_KEY)
 
73
  if (my_errno == HA_ERR_FOUND_DUPP_KEY)
76
74
  {
77
75
    info->errkey = (int) (keydef - share->keydef);
78
76
    if (keydef->algorithm == HA_KEY_ALG_BTREE)
82
80
      {
83
81
        if (++(share->records) == share->blength)
84
82
          share->blength+= share->blength;
85
 
        return(errno);
 
83
        return(my_errno);
86
84
      }
87
85
      keydef--;
88
86
    }
106
104
    hp_reallocate_chunkset(&share->recordspace, old_chunk_count, pos);
107
105
  }
108
106
 
109
 
  return(errno);
 
107
  return(my_errno);
110
108
} /* heap_update */