~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/mi_range.c

Removed/replaced DBUG symbols and TRUE/FALSE

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
                            key_range *min_key, key_range *max_key)
48
48
{
49
49
  ha_rows start_pos,end_pos,res;
50
 
  DBUG_ENTER("mi_records_in_range");
51
50
 
52
51
  if ((inx = _mi_check_index(info,inx)) < 0)
53
 
    DBUG_RETURN(HA_POS_ERROR);
 
52
    return(HA_POS_ERROR);
54
53
 
55
54
  if (fast_mi_readinfo(info))
56
 
    DBUG_RETURN(HA_POS_ERROR);
 
55
    return(HA_POS_ERROR);
57
56
  info->update&= (HA_STATE_CHANGED+HA_STATE_ROW_CHANGED);
58
57
  if (info->s->concurrent_insert)
59
58
    rw_rdlock(&info->s->key_root_lock[inx]);
77
76
    rw_unlock(&info->s->key_root_lock[inx]);
78
77
  fast_mi_writeinfo(info);
79
78
 
80
 
  DBUG_PRINT("info",("records: %ld",(ulong) (res)));
81
 
  DBUG_RETURN(res);
 
79
  return(res);
82
80
}
83
81
 
84
82
 
93
91
  uchar *key_buff;
94
92
  double pos;
95
93
 
96
 
  DBUG_ENTER("_mi_record_pos");
97
 
  DBUG_PRINT("enter",("search_flag: %d",search_flag));
98
 
  DBUG_ASSERT(keypart_map);
 
94
  assert(keypart_map);
99
95
 
100
96
  key_buff=info->lastkey+info->s->base.max_key_length;
101
97
  key_len=_mi_pack_key(info,inx,key_buff,(uchar*) key, keypart_map,
102
98
                       (HA_KEYSEG**) 0);
103
 
  DBUG_EXECUTE("key",_mi_print_key(DBUG_FILE,keyinfo->seg,
104
 
                                    (uchar*) key_buff,key_len););
105
99
  nextflag=myisam_read_vec[search_flag];
106
100
  if (!(nextflag & (SEARCH_FIND | SEARCH_NO_FIND | SEARCH_LAST)))
107
101
    key_len=USE_WHOLE_KEY;
145
139
                     info->s->state.key_root[inx]);
146
140
  if (pos >= 0.0)
147
141
  {
148
 
    DBUG_PRINT("exit",("pos: %ld",(ulong) (pos*info->state->records)));
149
 
    DBUG_RETURN((ulong) (pos*info->state->records+0.5));
 
142
    return((ulong) (pos*info->state->records+0.5));
150
143
  }
151
 
  DBUG_RETURN(HA_POS_ERROR);
 
144
  return(HA_POS_ERROR);
152
145
}
153
146
 
154
147
 
165
158
  my_bool after_key;
166
159
  uchar *keypos,*buff;
167
160
  double offset;
168
 
  DBUG_ENTER("_mi_search_pos");
169
161
 
170
162
  if (pos == HA_OFFSET_ERROR)
171
 
    DBUG_RETURN(0.5);
 
163
    return(0.5);
172
164
 
173
165
  if (!(buff=_mi_fetch_keypage(info,keyinfo,pos,DFLT_INIT_HITS,info->buff,1)))
174
166
    goto err;
180
172
  if (flag)
181
173
  {
182
174
    if (flag == MI_FOUND_WRONG_KEY)
183
 
      DBUG_RETURN(-1);                          /* error */
 
175
      return(-1);                               /* error */
184
176
    /*
185
177
      Didn't found match. keypos points at next (bigger) key
186
178
      Try to find a smaller, better matching key.
190
182
      offset= 1.0;
191
183
    else if ((offset=_mi_search_pos(info,keyinfo,key,key_len,nextflag,
192
184
                                    _mi_kpos(nod_flag,keypos))) < 0)
193
 
      DBUG_RETURN(offset);
 
185
      return(offset);
194
186
  }
195
187
  else
196
188
  {
209
201
      */
210
202
      if ((offset=_mi_search_pos(info,keyinfo,key,key_len,SEARCH_FIND,
211
203
                                 _mi_kpos(nod_flag,keypos))) < 0)
212
 
        DBUG_RETURN(offset);                    /* Read error */
 
204
        return(offset);                 /* Read error */
213
205
    }
214
206
  }
215
 
  DBUG_PRINT("info",("keynr: %d  offset: %g  max_keynr: %d  nod: %d  flag: %d",
216
 
                     keynr,offset,max_keynr,nod_flag,flag));
217
 
  DBUG_RETURN((keynr+offset)/(max_keynr+1));
 
207
  return((keynr+offset)/(max_keynr+1));
218
208
err:
219
 
  DBUG_PRINT("exit",("Error: %d",my_errno));
220
 
  DBUG_RETURN (-1.0);
 
209
  return (-1.0);
221
210
}
222
211
 
223
212