~drizzle-trunk/drizzle/development

« back to all changes in this revision

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