~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/mi_rkey.c

  • Committer: Brian Aker
  • Date: 2009-01-17 02:46:52 UTC
  • Revision ID: brian@gir-3.local-20090117024652-4ducefje08ajbs1q
Refactor append_identifier and remove dead OPTION_QUOTE_SHOW_CREATE option
(we always quote).

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
/* Read record based on a key */
17
17
 
18
 
#include "myisam_priv.h"
19
 
 
20
 
using namespace drizzled;
 
18
#include "myisamdef.h"
21
19
 
22
20
        /* Read a record using key */
23
21
        /* Ordinary search_flag is 0 ; Give error if no record with key */
34
32
  int res= 0;
35
33
 
36
34
  if ((inx = _mi_check_index(info,inx)) < 0)
37
 
    return(errno);
 
35
    return(my_errno);
38
36
 
39
37
  info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
40
38
  info->last_key_func= search_flag;
127
125
            ha_key_cmp(keyinfo->seg, key_buff, info->lastkey, use_key_length,
128
126
                       SEARCH_FIND, not_used))
129
127
        {
130
 
          errno= HA_ERR_KEY_NOT_FOUND;
 
128
          my_errno= HA_ERR_KEY_NOT_FOUND;
131
129
          info->lastpos= HA_OFFSET_ERROR;
132
130
          break;
133
131
        }
137
135
        info->lastpos= HA_OFFSET_ERROR;
138
136
        if (share->concurrent_insert)
139
137
          pthread_rwlock_unlock(&share->key_root_lock[inx]);
140
 
        return((errno= HA_ERR_KEY_NOT_FOUND));
 
138
        return((my_errno= HA_ERR_KEY_NOT_FOUND));
141
139
      }
142
140
      /*
143
141
        Error if no row found within the data file. (Bug #29838)
144
 
        Do not overwrite errno if already at HA_OFFSET_ERROR.
 
142
        Do not overwrite my_errno if already at HA_OFFSET_ERROR.
145
143
      */
146
144
      if (info->lastpos != HA_OFFSET_ERROR &&
147
145
          info->lastpos >= info->state->data_file_length)
148
146
      {
149
147
        info->lastpos= HA_OFFSET_ERROR;
150
 
        errno= HA_ERR_KEY_NOT_FOUND;
 
148
        my_errno= HA_ERR_KEY_NOT_FOUND;
151
149
      }
152
150
    }
153
151
  }
164
162
 
165
163
  /* Check if we don't want to have record back, only error message */
166
164
  if (!buf)
167
 
    return(info->lastpos == HA_OFFSET_ERROR ? errno : 0);
 
165
    return(info->lastpos == HA_OFFSET_ERROR ? my_errno : 0);
168
166
 
169
167
  if (!(*info->read_record)(info,info->lastpos,buf))
170
168
  {
183
181
  if (search_flag == HA_READ_AFTER_KEY)
184
182
    info->update|=HA_STATE_NEXT_FOUND;          /* Previous gives last row */
185
183
err:
186
 
  return(errno);
 
184
  return(my_errno);
187
185
} /* _mi_rkey */