~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/mi_update.c

  • Committer: Brian Aker
  • Date: 2008-10-06 06:47:29 UTC
  • Revision ID: brian@tangent.org-20081006064729-2i9mhjkzyvow9xsm
RemoveĀ uint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
/* Update an old row in a MyISAM table */
17
17
 
18
 
#include "myisam_priv.h"
19
 
#include <drizzled/util/test.h>
20
 
 
21
 
using namespace drizzled;
 
18
#include "myisamdef.h"
22
19
 
23
20
int mi_update(register MI_INFO *info, const unsigned char *oldrec, unsigned char *newrec)
24
21
{
25
22
  int flag,key_changed,save_errno;
26
 
  register internal::my_off_t pos;
 
23
  register my_off_t pos;
27
24
  uint32_t i;
28
25
  unsigned char old_key[MI_MAX_KEY_BUFF],*new_key;
29
26
  bool auto_key_changed=0;
30
27
  uint64_t changed;
31
28
  MYISAM_SHARE *share= info->s;
32
 
  internal::ha_checksum old_checksum= 0;
 
29
  ha_checksum old_checksum= 0;
33
30
 
34
31
  if (!(info->update & HA_STATE_AKTIV))
35
32
  {
36
 
    return(errno=HA_ERR_KEY_NOT_FOUND);
 
33
    return(my_errno=HA_ERR_KEY_NOT_FOUND);
37
34
  }
38
35
  if (share->options & HA_OPTION_READ_ONLY_DATA)
39
36
  {
40
 
    return(errno=EACCES);
 
37
    return(my_errno=EACCES);
41
38
  }
42
39
  if (info->state->key_file_length >= share->base.margin_key_file_length)
43
40
  {
44
 
    return(errno=HA_ERR_INDEX_FILE_FULL);
 
41
    return(my_errno=HA_ERR_INDEX_FILE_FULL);
45
42
  }
46
43
  pos=info->lastpos;
47
44
  if (_mi_readinfo(info,F_WRLCK,1))
48
 
    return(errno);
 
45
    return(my_errno);
49
46
 
50
47
  if (share->calc_checksum)
51
48
    old_checksum=info->checksum=(*share->calc_checksum)(info,oldrec);
52
49
  if ((*share->compare_record)(info,oldrec))
53
50
  {
54
 
    save_errno=errno;
 
51
    save_errno=my_errno;
55
52
    goto err_end;                       /* Record has changed */
56
53
  }
57
54
 
65
62
        mi_check_unique(info, def, newrec, mi_unique_hash(def, newrec),
66
63
                        info->lastpos))
67
64
    {
68
 
      save_errno=errno;
 
65
      save_errno=my_errno;
69
66
      goto err_end;
70
67
    }
71
68
  }
72
69
  if (_mi_mark_file_changed(info))
73
70
  {
74
 
    save_errno=errno;
 
71
    save_errno=my_errno;
75
72
    goto err_end;
76
73
  }
77
74
 
125
122
    */
126
123
    MI_STATUS_INFO state;
127
124
    ha_rows org_split;
128
 
    internal::my_off_t org_delete_link;
 
125
    my_off_t org_delete_link;
129
126
 
130
127
    memcpy(&state, info->state, sizeof(state));
131
128
    org_split=       share->state.split;
157
154
    there is no index change there could be data change.
158
155
  */
159
156
  _mi_writeinfo(info, WRITEINFO_UPDATE_KEYFILE);
 
157
  if (info->invalidator != 0)
 
158
  {
 
159
    (*info->invalidator)(info->filename);
 
160
    info->invalidator=0;
 
161
  }
160
162
  return(0);
161
163
 
162
164
err:
163
 
  save_errno=errno;
 
165
  save_errno=my_errno;
164
166
  if (changed)
165
167
    key_changed|= HA_STATE_CHANGED;
166
 
  if (errno == HA_ERR_FOUND_DUPP_KEY || errno == HA_ERR_OUT_OF_MEM ||
167
 
      errno == HA_ERR_RECORD_FILE_FULL)
 
168
  if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_OUT_OF_MEM ||
 
169
      my_errno == HA_ERR_RECORD_FILE_FULL)
168
170
  {
169
171
    info->errkey= (int) i;
170
172
    flag=0;
197
199
    mi_print_error(info->s, HA_ERR_CRASHED);
198
200
    save_errno=HA_ERR_CRASHED;
199
201
  }
200
 
  return(errno=save_errno);
 
202
  return(my_errno=save_errno);
201
203
} /* mi_update */