~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/key.cc

  • Committer: Brian Aker
  • Date: 2009-04-06 23:21:25 UTC
  • mto: This revision was merged to the branch mainline in revision 976.
  • Revision ID: brian@gaz-20090406232125-pfh5thw54drisx0h
LCOV cleanup.

Show diffs side-by-side

added added

removed removed

Lines of Context:
136
136
}
137
137
 
138
138
 
139
 
void key_copy(basic_string<unsigned char> &to_key,
140
 
              unsigned char *from_record, KEY *key_info,
141
 
              unsigned int key_length)
142
 
{
143
 
  uint32_t length;
144
 
  KEY_PART_INFO *key_part;
145
 
 
146
 
  if (key_length == 0)
147
 
    key_length= key_info->key_length;
148
 
  for (key_part= key_info->key_part; (int) key_length > 0; key_part++)
149
 
  {
150
 
    if (key_part->null_bit)
151
 
    {
152
 
      to_key.push_back(test(from_record[key_part->null_offset] &
153
 
                       key_part->null_bit) ? '1' : '0');
154
 
      key_length--;
155
 
    }
156
 
    if (key_part->key_part_flag & HA_BLOB_PART ||
157
 
        key_part->key_part_flag & HA_VAR_LENGTH_PART)
158
 
    {
159
 
      key_length-= HA_KEY_BLOB_LENGTH;
160
 
      length= cmin((uint16_t)key_length, key_part->length);
161
 
      key_part->field->get_key_image(to_key, length, Field::itRAW);
162
 
      to_key.append(HA_KEY_BLOB_LENGTH, '0');
163
 
    }
164
 
    else
165
 
    {
166
 
      length= cmin((uint16_t)key_length, key_part->length);
167
 
      Field *field= key_part->field;
168
 
      uint32_t bytes= field->get_key_image(to_key, length, Field::itRAW);
169
 
      if (bytes < length)
170
 
        to_key.append(length-bytes, ' ');
171
 
    }
172
 
    key_length-= length;
173
 
  }
174
 
}
175
 
 
176
 
 
177
139
/**
178
140
  Zero the null components of key tuple.
179
141
*/