~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/key.cc

  • Committer: Brian Aker
  • Date: 2008-10-06 06:47:29 UTC
  • Revision ID: brian@tangent.org-20081006064729-2i9mhjkzyvow9xsm
RemoveĀ uint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
       key_length is set to length of key before (not including) field
46
46
*/
47
47
 
48
 
int find_ref_key(KEY *key, uint key_count, unsigned char *record, Field *field,
49
 
                 uint *key_length, uint *keypart)
 
48
int find_ref_key(KEY *key, uint32_t key_count, unsigned char *record, Field *field,
 
49
                 uint32_t *key_length, uint32_t *keypart)
50
50
{
51
51
  register int i;
52
52
  register KEY *key_info;
53
 
  uint fieldpos;
 
53
  uint32_t fieldpos;
54
54
 
55
55
  fieldpos= field->offset(record);
56
56
 
71
71
       i < (int) key_count ;
72
72
       i++, key_info++)
73
73
  {
74
 
    uint j;
 
74
    uint32_t j;
75
75
    KEY_PART_INFO *key_part;
76
76
    *key_length=0;
77
77
    for (j=0, key_part=key_info->key_part ;
108
108
void key_copy(unsigned char *to_key, unsigned char *from_record, KEY *key_info,
109
109
              unsigned int key_length)
110
110
{
111
 
  uint length;
 
111
  uint32_t length;
112
112
  KEY_PART_INFO *key_part;
113
113
 
114
114
  if (key_length == 0)
134
134
      length= cmin((uint16_t)key_length, key_part->length);
135
135
      Field *field= key_part->field;
136
136
      const CHARSET_INFO * const cs= field->charset();
137
 
      uint bytes= field->get_key_image(to_key, length, Field::itRAW);
 
137
      uint32_t bytes= field->get_key_image(to_key, length, Field::itRAW);
138
138
      if (bytes < length)
139
139
        cs->cset->fill(cs, (char*) to_key + bytes, length - bytes, ' ');
140
140
    }
176
176
void key_restore(unsigned char *to_record, unsigned char *from_key, KEY *key_info,
177
177
                 uint16_t key_length)
178
178
{
179
 
  uint length;
 
179
  uint32_t length;
180
180
  KEY_PART_INFO *key_part;
181
181
 
182
182
  if (key_length == 0)
203
203
        Maybe this branch is to be removed, but now we
204
204
        have to ignore GCov compaining.
205
205
      */
206
 
      uint blob_length= uint2korr(from_key);
 
206
      uint32_t blob_length= uint2korr(from_key);
207
207
      Field_blob *field= (Field_blob*) key_part->field;
208
208
      from_key+= HA_KEY_BLOB_LENGTH;
209
209
      key_length-= HA_KEY_BLOB_LENGTH;
255
255
    1   Key has changed
256
256
*/
257
257
 
258
 
bool key_cmp_if_same(Table *table,const unsigned char *key,uint idx,uint key_length)
 
258
bool key_cmp_if_same(Table *table,const unsigned char *key,uint32_t idx,uint32_t key_length)
259
259
{
260
 
  uint store_length;
 
260
  uint32_t store_length;
261
261
  KEY_PART_INFO *key_part;
262
262
  const unsigned char *key_end= key + key_length;;
263
263
 
265
265
       key < key_end ; 
266
266
       key_part++, key+= store_length)
267
267
  {
268
 
    uint length;
 
268
    uint32_t length;
269
269
    store_length= key_part->store_length;
270
270
 
271
271
    if (key_part->null_bit)
290
290
                                FIELDFLAG_PACK)))
291
291
    {
292
292
      const CHARSET_INFO * const cs= key_part->field->charset();
293
 
      uint char_length= key_part->length / cs->mbmaxlen;
 
293
      uint32_t char_length= key_part->length / cs->mbmaxlen;
294
294
      const unsigned char *pos= table->record[0] + key_part->offset;
295
295
      if (length > char_length)
296
296
      {
323
323
     idx        Key number
324
324
*/
325
325
 
326
 
void key_unpack(String *to,Table *table,uint idx)
 
326
void key_unpack(String *to,Table *table,uint32_t idx)
327
327
{
328
328
  KEY_PART_INFO *key_part,*key_part_end;
329
329
  Field *field;
360
360
          which can break a multi-byte characters in the middle.
361
361
          Align, returning not more than "char_length" characters.
362
362
        */
363
 
        uint charpos, char_length= key_part->length / cs->mbmaxlen;
 
363
        uint32_t charpos, char_length= key_part->length / cs->mbmaxlen;
364
364
        if ((charpos= my_charpos(cs, tmp.ptr(),
365
365
                                 tmp.ptr() + tmp.length(),
366
366
                                 char_length)) < key_part->length)
397
397
    FALSE  Otherwise
398
398
*/
399
399
 
400
 
bool is_key_used(Table *table, uint idx, const MY_BITMAP *fields)
 
400
bool is_key_used(Table *table, uint32_t idx, const MY_BITMAP *fields)
401
401
{
402
402
  bitmap_clear_all(&table->tmp_set);
403
403
  table->mark_columns_used_by_index_no_reset(idx, &table->tmp_set);
429
429
    -   1               Key is larger than range
430
430
*/
431
431
 
432
 
int key_cmp(KEY_PART_INFO *key_part, const unsigned char *key, uint key_length)
 
432
int key_cmp(KEY_PART_INFO *key_part, const unsigned char *key, uint32_t key_length)
433
433
{
434
 
  uint store_length;
 
434
  uint32_t store_length;
435
435
 
436
436
  for (const unsigned char *end=key + key_length;
437
437
       key < end;
493
493
int key_rec_cmp(void *key, unsigned char *first_rec, unsigned char *second_rec)
494
494
{
495
495
  KEY *key_info= (KEY*)key;
496
 
  uint key_parts= key_info->key_parts, i= 0;
 
496
  uint32_t key_parts= key_info->key_parts, i= 0;
497
497
  KEY_PART_INFO *key_part= key_info->key_part;
498
498
  unsigned char *rec0= key_part->field->ptr - key_part->offset;
499
499
  my_ptrdiff_t first_diff= first_rec - rec0, sec_diff= second_rec - rec0;