~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/heap/hp_hash.c

  • Committer: Jay Pipes
  • Date: 2008-07-16 16:14:22 UTC
  • mto: This revision was merged to the branch mainline in revision 182.
  • Revision ID: jay@mysql.com-20080716161422-fy1bl8o5q7m8kglq
Removed all DBUG symbols from heap storage engine

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
  HP_KEYDEF *keyinfo= info->s->keydef + inx;
54
54
  TREE *rb_tree = &keyinfo->rb_tree;
55
55
  heap_rb_param custom_arg;
56
 
  DBUG_ENTER("hp_rb_records_in_range");
57
56
 
58
57
  info->lastinx= inx;
59
58
  custom_arg.keyseg= keyinfo->seg;
84
83
    end_pos= rb_tree->elements_in_tree + (ha_rows)1;
85
84
  }
86
85
 
87
 
  DBUG_PRINT("info",("start_pos: %lu  end_pos: %lu", (ulong) start_pos,
88
 
                     (ulong) end_pos));
89
86
  if (start_pos == HA_POS_ERROR || end_pos == HA_POS_ERROR)
90
 
    DBUG_RETURN(HA_POS_ERROR);
91
 
  DBUG_RETURN(end_pos < start_pos ? (ha_rows) 0 :
 
87
    return(HA_POS_ERROR);
 
88
  return(end_pos < start_pos ? (ha_rows) 0 :
92
89
              (end_pos == start_pos ? (ha_rows) 1 : end_pos - start_pos));
93
90
}
94
91
 
104
101
  int flag;
105
102
  uint old_nextflag;
106
103
  HP_SHARE *share=info->s;
107
 
  DBUG_ENTER("hp_search");
108
104
  old_nextflag=nextflag;
109
105
  flag=1;
110
106
  prev_ptr=0;
119
115
      {
120
116
        switch (nextflag) {
121
117
        case 0:                                 /* Search after key */
122
 
          DBUG_PRINT("exit", ("found key at 0x%lx", (long) pos->ptr_to_rec));
123
118
          info->current_hash_ptr=pos;
124
 
          DBUG_RETURN(info->current_ptr= pos->ptr_to_rec);
 
119
          return(info->current_ptr= pos->ptr_to_rec);
125
120
        case 1:                                 /* Search next */
126
121
          if (pos->ptr_to_rec == info->current_ptr)
127
122
            nextflag=0;
131
126
          {
132
127
            my_errno=HA_ERR_KEY_NOT_FOUND;      /* If gpos == 0 */
133
128
            info->current_hash_ptr=prev_ptr;
134
 
            DBUG_RETURN(info->current_ptr=prev_ptr ? prev_ptr->ptr_to_rec : 0);
 
129
            return(info->current_ptr=prev_ptr ? prev_ptr->ptr_to_rec : 0);
135
130
          }
136
131
          prev_ptr=pos;                         /* Prev. record found */
137
132
          break;
139
134
          if (pos->ptr_to_rec == info->current_ptr)
140
135
          {
141
136
            info->current_hash_ptr=pos;
142
 
            DBUG_RETURN(info->current_ptr);
 
137
            return(info->current_ptr);
143
138
          }
144
139
        }
145
140
      }
159
154
  {
160
155
    /* Do a previous from end */
161
156
    info->current_hash_ptr=prev_ptr;
162
 
    DBUG_RETURN(info->current_ptr=prev_ptr ? prev_ptr->ptr_to_rec : 0);
 
157
    return(info->current_ptr=prev_ptr ? prev_ptr->ptr_to_rec : 0);
163
158
  }
164
159
 
165
160
  if (old_nextflag && nextflag)
166
161
    my_errno=HA_ERR_RECORD_CHANGED;             /* Didn't find old record */
167
 
  DBUG_PRINT("exit",("Error: %d",my_errno));
168
162
  info->current_hash_ptr=0;  
169
 
  DBUG_RETURN((info->current_ptr= 0));
 
163
  return((info->current_ptr= 0));
170
164
}
171
165
 
172
166
 
178
172
uchar *hp_search_next(HP_INFO *info, HP_KEYDEF *keyinfo, const uchar *key,
179
173
                      HASH_INFO *pos)
180
174
{
181
 
  DBUG_ENTER("hp_search_next");
182
 
 
183
175
  while ((pos= pos->next_key))
184
176
  {
185
177
    if (! hp_key_cmp(keyinfo, pos->ptr_to_rec, key))
186
178
    {
187
179
      info->current_hash_ptr=pos;
188
 
      DBUG_RETURN (info->current_ptr= pos->ptr_to_rec);
 
180
      return (info->current_ptr= pos->ptr_to_rec);
189
181
    }
190
182
  }
191
183
  my_errno=HA_ERR_KEY_NOT_FOUND;
192
 
  DBUG_PRINT("exit",("Error: %d",my_errno));
193
184
  info->current_hash_ptr=0;
194
 
  DBUG_RETURN ((info->current_ptr= 0));
 
185
  return ((info->current_ptr= 0));
195
186
}
196
187
 
197
188
 
298
289
      }
299
290
    }
300
291
  }
301
 
  DBUG_PRINT("exit", ("hash: 0x%lx", nr));
302
292
  return((ulong) nr);
303
293
}
304
294
 
356
346
      }
357
347
    }
358
348
  }
359
 
  DBUG_PRINT("exit", ("hash: 0x%lx", nr));
360
349
  return(nr);
361
350
}
362
351
 
427
416
      }
428
417
    }
429
418
  }
430
 
  DBUG_PRINT("exit", ("hash: 0x%lx", nr));
431
419
  return(nr);
432
420
}
433
421
 
472
460
      }
473
461
    }
474
462
  }
475
 
  DBUG_PRINT("exit", ("hash: 0x%lx", nr));
476
463
  return(nr);
477
464
}
478
465
 
983
970
    value= uint8korr(key);
984
971
    break;
985
972
  default:
986
 
    DBUG_ASSERT(0);
 
973
    assert(0);
987
974
    value=0;                                    /* Error */
988
975
    break;
989
976
  }