~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/blitzdb/blitzcmp.cc

  • Committer: Patrick Galbraith
  • Date: 2010-10-03 13:40:30 UTC
  • mto: (1812.1.3 build)
  • mto: This revision was merged to the branch mainline in revision 1813.
  • Revision ID: patg@patg-desktop-20101003134030-j13wf1e79za77jtf
Added license to start_mc.sh.in to clear up ambiguity

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
  /* For now, we are only interested in supporting a PRIMARY KEY. In the
36
36
     next phase of BlitzDB, this should loop through the key array. */
37
37
  if (share->primary_key_exists) {
38
 
    KeyInfo *pk = &getTable()->key_info[getTable()->getShare()->getPrimaryKey()];
 
38
    KeyInfo *pk = &table->key_info[table->s->getPrimaryKey()];
39
39
    KeyPartInfo *key_part = pk->key_part;
40
40
    KeyPartInfo *key_part_end = key_part + pk->key_parts;
41
41
    int key_changed = 0;
67
67
       would violate the unique contraint. */
68
68
    if (key_changed) {
69
69
      key = key_buffer;
70
 
      key_len = make_index_key(key, getTable()->getMutableShare()->getPrimaryKey(), new_row);
 
70
      key_len = make_index_key(key, table->s->getPrimaryKey(), new_row);
71
71
      fetched = share->dict.get_row(key, key_len, &fetched_len);
72
72
 
73
73
      /* Key Exists. It's a violation. */
74
74
      if (fetched != NULL) {
75
75
        free(fetched);
76
 
        this->errkey_id = getTable()->getShare()->getPrimaryKey();
 
76
        this->errkey_id = table->s->getPrimaryKey();
77
77
        return HA_ERR_FOUND_DUPP_KEY;
78
78
      }
79
79
    }
256
256
      a_next_offset = b_next_offset = curr_part->length;
257
257
      break;
258
258
    }
259
 
    case HA_KEYTYPE_VARTEXT1:
 
259
    case HA_KEYTYPE_VARTEXT1: {
 
260
      uint8_t a_varchar_len = *(uint8_t *)a_pos;
 
261
      uint8_t b_varchar_len = *(uint8_t *)b_pos;
 
262
      int key_changed;
 
263
 
 
264
      a_pos++;
 
265
      b_pos++;
 
266
 
 
267
      *a_compared_len += a_varchar_len + sizeof(a_varchar_len);
 
268
      *b_compared_len += b_varchar_len + sizeof(b_varchar_len);
 
269
 
 
270
      /* Compare the texts by respecting collation. */
 
271
      key_changed = my_strnncoll(&my_charset_utf8_general_ci,
 
272
                                 (unsigned char *)a_pos, a_varchar_len,
 
273
                                 (unsigned char *)b_pos, b_varchar_len);
 
274
      if (key_changed < 0)
 
275
        return -1;
 
276
      else if (key_changed > 0)
 
277
        return 1;
 
278
 
 
279
      a_next_offset = a_varchar_len;
 
280
      b_next_offset = b_varchar_len;
 
281
      break;
 
282
    }
260
283
    case HA_KEYTYPE_VARTEXT2: {
261
284
      uint16_t a_varchar_len = uint2korr(a_pos);
262
285
      uint16_t b_varchar_len = uint2korr(b_pos);