~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/mi_update.c

  • Committer: Brian Aker
  • Date: 2008-11-04 15:39:09 UTC
  • mfrom: (575.1.2 devel)
  • Revision ID: brian@tangent.org-20081104153909-c72hn65udxs1ccal
Merge of Monty's work

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
/* Update an old row in a MyISAM table */
17
17
 
18
18
#include "myisamdef.h"
 
19
#include <drizzled/util/test.h>
19
20
 
20
 
int mi_update(register MI_INFO *info, const uchar *oldrec, uchar *newrec)
 
21
int mi_update(register MI_INFO *info, const unsigned char *oldrec, unsigned char *newrec)
21
22
{
22
23
  int flag,key_changed,save_errno;
23
24
  register my_off_t pos;
24
 
  uint i;
25
 
  uchar old_key[MI_MAX_KEY_BUFF],*new_key;
 
25
  uint32_t i;
 
26
  unsigned char old_key[MI_MAX_KEY_BUFF],*new_key;
26
27
  bool auto_key_changed=0;
27
28
  uint64_t changed;
28
29
  MYISAM_SHARE *share= info->s;
81
82
    if (mi_is_key_active(share->state.key_map, i))
82
83
    {
83
84
      {
84
 
        uint new_length=_mi_make_key(info,i,new_key,newrec,pos);
85
 
        uint old_length=_mi_make_key(info,i,old_key,oldrec,pos);
 
85
        uint32_t new_length=_mi_make_key(info,i,new_key,newrec,pos);
 
86
        uint32_t old_length=_mi_make_key(info,i,old_key,oldrec,pos);
86
87
 
87
88
        /* The above changed info->lastkey2. Inform mi_rnext_same(). */
88
89
        info->update&= ~HA_STATE_RNEXT_SAME;
153
154
    mi_update() must always pass !0 value as operation, since even if
154
155
    there is no index change there could be data change.
155
156
  */
156
 
  VOID(_mi_writeinfo(info, WRITEINFO_UPDATE_KEYFILE));
 
157
  _mi_writeinfo(info, WRITEINFO_UPDATE_KEYFILE);
157
158
  if (info->invalidator != 0)
158
159
  {
159
160
    (*info->invalidator)(info->filename);
175
176
      if (((uint64_t) 1 << i) & changed)
176
177
      {
177
178
        {
178
 
          uint new_length=_mi_make_key(info,i,new_key,newrec,pos);
179
 
          uint old_length= _mi_make_key(info,i,old_key,oldrec,pos);
 
179
          uint32_t new_length=_mi_make_key(info,i,new_key,newrec,pos);
 
180
          uint32_t old_length= _mi_make_key(info,i,old_key,oldrec,pos);
180
181
          if ((flag++ && _mi_ck_delete(info,i,new_key,new_length)) ||
181
182
              _mi_ck_write(info,i,old_key,old_length))
182
183
            break;
193
194
                 key_changed);
194
195
 
195
196
 err_end:
196
 
  VOID(_mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE));
 
197
  _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
197
198
  if (save_errno == HA_ERR_KEY_NOT_FOUND)
198
199
  {
199
200
    mi_print_error(info->s, HA_ERR_CRASHED);