~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/handler/ha_innodb.cc

  • Committer: Brian Aker
  • Date: 2010-10-27 20:29:24 UTC
  • mfrom: (1883 staging)
  • mto: This revision was merged to the branch mainline in revision 1885.
  • Revision ID: brian@tangent.org-20101027202924-7o9s4nhvqgj9oskq
Merge with trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
391
391
        /* out: 0 or error number */
392
392
    ::drizzled::XID *xid);  /* in: X/Open XA transaction identification */
393
393
 
394
 
  virtual Cursor *create(TableShare &table)
 
394
  virtual Cursor *create(Table &table)
395
395
  {
396
396
    return new ha_innobase(*this, table);
397
397
  }
1612
1612
Construct ha_innobase Cursor. */
1613
1613
UNIV_INTERN
1614
1614
ha_innobase::ha_innobase(plugin::StorageEngine &engine_arg,
1615
 
                         TableShare &table_arg)
 
1615
                         Table &table_arg)
1616
1616
  :Cursor(engine_arg, table_arg),
1617
1617
  primary_key(0), /* needs initialization because index_flags() may be called 
1618
1618
                     before this is set to the real value. It's ok to have any 
2897
2897
  const char* col_name;
2898
2898
  ulint   error;
2899
2899
 
2900
 
  col_name = table->found_next_number_field->field_name;
2901
 
  index = innobase_get_index(table->getShare()->next_number_index);
 
2900
  col_name = getTable()->found_next_number_field->field_name;
 
2901
  index = innobase_get_index(getTable()->getShare()->next_number_index);
2902
2902
 
2903
2903
  /* Execute SELECT MAX(col_name) FROM TABLE; */
2904
2904
  error = row_search_max_autoinc(index, col_name, &auto_inc);
2956
2956
  UT_NOT_USED(mode);
2957
2957
  UT_NOT_USED(test_if_locked);
2958
2958
 
2959
 
  session= table->in_use;
 
2959
  session= getTable()->in_use;
2960
2960
 
2961
2961
  /* Under some cases Drizzle seems to call this function while
2962
2962
  holding btr_search_latch. This breaks the latching order as
2980
2980
  stored the string length as the first byte. */
2981
2981
 
2982
2982
  upd_and_key_val_buff_len =
2983
 
        table->getShare()->stored_rec_length
2984
 
        + table->getShare()->max_key_length
 
2983
        getTable()->getShare()->stored_rec_length
 
2984
        + getTable()->getShare()->max_key_length
2985
2985
        + MAX_REF_PARTS * 3;
2986
2986
 
2987
2987
  upd_buff.resize(upd_and_key_val_buff_len);
3044
3044
 
3045
3045
  prebuilt = row_create_prebuilt(ib_table);
3046
3046
 
3047
 
  prebuilt->mysql_row_len = table->getShare()->stored_rec_length;
3048
 
  prebuilt->default_rec = table->getDefaultValues();
 
3047
  prebuilt->mysql_row_len = getTable()->getShare()->stored_rec_length;
 
3048
  prebuilt->default_rec = getTable()->getDefaultValues();
3049
3049
  ut_ad(prebuilt->default_rec);
3050
3050
 
3051
3051
  /* Looks like MySQL-3.23 sometimes has primary key number != 0 */
3052
3052
 
3053
 
  primary_key = table->getShare()->getPrimaryKey();
 
3053
  primary_key = getTable()->getShare()->getPrimaryKey();
3054
3054
  key_used_on_scan = primary_key;
3055
3055
 
3056
3056
  /* Allocate a buffer for a 'row reference'. A row reference is
3073
3073
    save space, because all row reference buffers are allocated
3074
3074
    based on ref_length. */
3075
3075
 
3076
 
    ref_length = table->key_info[primary_key].key_length;
 
3076
    ref_length = getTable()->key_info[primary_key].key_length;
3077
3077
  } else {
3078
3078
    if (primary_key != MAX_KEY) {
3079
3079
      errmsg_printf(ERRMSG_LVL_ERROR, "Table %s has no primary key in InnoDB data "
3125
3125
  info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
3126
3126
 
3127
3127
  /* Only if the table has an AUTOINC column. */
3128
 
  if (prebuilt->table != NULL && table->found_next_number_field != NULL) {
 
3128
  if (prebuilt->table != NULL && getTable()->found_next_number_field != NULL) {
3129
3129
    ulint error;
3130
3130
 
3131
3131
    dict_table_autoinc_lock(prebuilt->table);
3163
3163
{
3164
3164
  Session*  session;
3165
3165
 
3166
 
  session= table->in_use;
 
3166
  session= getTable()->in_use;
3167
3167
  if (session != NULL) {
3168
3168
    getTransactionalEngine()->releaseTemporaryLatches(session);
3169
3169
  }
3444
3444
  uint    buff_len,/*!< in: buffer length */
3445
3445
  const unsigned char*  record)/*!< in: row in MySQL format */
3446
3446
{
3447
 
  KeyInfo*    key_info  = &table->key_info[keynr];
 
3447
  KeyInfo*    key_info  = &getTable()->key_info[keynr];
3448
3448
  KeyPartInfo*  key_part  = key_info->key_part;
3449
3449
  KeyPartInfo*  end   = key_part + key_info->key_parts;
3450
3450
  char*   buff_start  = buff;
3520
3520
 
3521
3521
      data = row_mysql_read_true_varchar(&len,
3522
3522
        (byte*) (record
3523
 
        + (ulint)get_field_offset(table, field)),
 
3523
        + (ulint)get_field_offset(getTable(), field)),
3524
3524
        lenlen);
3525
3525
 
3526
3526
      true_len = len;
3583
3583
 
3584
3584
      blob_data = row_mysql_read_blob_ref(&blob_len,
3585
3585
        (byte*) (record
3586
 
        + (ulint)get_field_offset(table, field)),
 
3586
        + (ulint)get_field_offset(getTable(), field)),
3587
3587
          (ulint) field->pack_length());
3588
3588
 
3589
3589
      true_len = blob_len;
3590
3590
 
3591
 
      ut_a(get_field_offset(table, field)
 
3591
      ut_a(get_field_offset(getTable(), field)
3592
3592
        == key_part->offset);
3593
3593
 
3594
3594
      /* For multi byte character sets we need to calculate
4079
4079
  num_write_row++;
4080
4080
 
4081
4081
  /* This is the case where the table has an auto-increment column */
4082
 
  if (table->next_number_field && record == table->getInsertRecord()) {
 
4082
  if (getTable()->next_number_field && record == getTable()->getInsertRecord()) {
4083
4083
 
4084
4084
    /* Reset the error code before calling
4085
4085
    innobase_get_auto_increment(). */
4108
4108
    /* Build the template used in converting quickly between
4109
4109
    the two database formats */
4110
4110
 
4111
 
    build_template(prebuilt, NULL, table,
4112
 
             ROW_MYSQL_WHOLE_ROW);
 
4111
    build_template(prebuilt, NULL, getTable(), ROW_MYSQL_WHOLE_ROW);
4113
4112
  }
4114
4113
 
4115
4114
  innodb_srv_conc_enter_innodb(prebuilt->trx);
4133
4132
    /* We need the upper limit of the col type to check for
4134
4133
    whether we update the table autoinc counter or not. */
4135
4134
    col_max_value = innobase_get_int_col_max_value(
4136
 
      table->next_number_field);
4137
 
 
 
4135
      getTable()->next_number_field); 
4138
4136
    /* Get the value that MySQL attempted to store in the table.*/
4139
 
    auto_inc = table->next_number_field->val_int();
 
4137
    auto_inc = getTable()->next_number_field->val_int();
4140
4138
 
4141
4139
    switch (error) {
4142
4140
    case DB_DUPLICATE_KEY:
4386
4384
  /* Build an update vector from the modified fields in the rows
4387
4385
  (uses upd_buff of the handle) */
4388
4386
 
4389
 
  calc_row_difference(uvect, (unsigned char*) old_row, new_row, table,
 
4387
  calc_row_difference(uvect, (unsigned char*) old_row, new_row, getTable(),
4390
4388
      &upd_buff[0], (ulint)upd_and_key_val_buff_len,
4391
4389
      prebuilt, user_session);
4392
4390
 
4395
4393
 
4396
4394
  ut_a(prebuilt->template_type == ROW_MYSQL_WHOLE_ROW);
4397
4395
 
4398
 
  if (table->found_next_number_field)
 
4396
  if (getTable()->found_next_number_field)
4399
4397
  {
4400
4398
    uint64_t  auto_inc;
4401
4399
    uint64_t  col_max_value;
4402
4400
 
4403
 
    auto_inc = table->found_next_number_field->val_int();
 
4401
    auto_inc = getTable()->found_next_number_field->val_int();
4404
4402
 
4405
4403
    /* We need the upper limit of the col type to check for
4406
4404
    whether we update the table autoinc counter or not. */
4407
4405
    col_max_value = innobase_get_int_col_max_value(
4408
 
      table->found_next_number_field);
 
4406
      getTable()->found_next_number_field);
4409
4407
 
4410
4408
    uint64_t current_autoinc;
4411
4409
    ulint autoinc_error= innobase_get_autoinc(&current_autoinc);
4442
4440
  value used in the INSERT statement.*/
4443
4441
 
4444
4442
  if (error == DB_SUCCESS
4445
 
      && table->next_number_field
4446
 
      && new_row == table->getInsertRecord()
 
4443
      && getTable()->next_number_field
 
4444
      && new_row == getTable()->getInsertRecord()
4447
4445
      && session_sql_command(user_session) == SQLCOM_INSERT
4448
4446
      && (trx->duplicates & (TRX_DUP_IGNORE | TRX_DUP_REPLACE))
4449
4447
    == TRX_DUP_IGNORE)  {
4451
4449
    uint64_t  auto_inc;
4452
4450
    uint64_t  col_max_value;
4453
4451
 
4454
 
    auto_inc = table->next_number_field->val_int();
 
4452
    auto_inc = getTable()->next_number_field->val_int();
4455
4453
 
4456
4454
    /* We need the upper limit of the col type to check for
4457
4455
    whether we update the table autoinc counter or not. */
4458
4456
    col_max_value = innobase_get_int_col_max_value(
4459
 
      table->next_number_field);
 
4457
      getTable()->next_number_field);
4460
4458
 
4461
4459
    if (auto_inc <= col_max_value && auto_inc != 0) {
4462
4460
 
4586
4584
ha_innobase::try_semi_consistent_read(bool yes)
4587
4585
/*===========================================*/
4588
4586
{
4589
 
  ut_a(prebuilt->trx == session_to_trx(table->in_use));
 
4587
  ut_a(prebuilt->trx == session_to_trx(getTable()->in_use));
4590
4588
 
4591
4589
  /* Row read type is set to semi consistent read if this was
4592
4590
  requested by the MySQL and either innodb_locks_unsafe_for_binlog
4786
4784
  necessarily prebuilt->index, but can also be the clustered index */
4787
4785
 
4788
4786
  if (prebuilt->sql_stat_start) {
4789
 
    build_template(prebuilt, user_session, table,
 
4787
    build_template(prebuilt, user_session, getTable(),
4790
4788
             ROW_MYSQL_REC_FIELDS);
4791
4789
  }
4792
4790
 
4841
4839
  switch (ret) {
4842
4840
  case DB_SUCCESS:
4843
4841
    error = 0;
4844
 
    table->status = 0;
 
4842
    getTable()->status = 0;
4845
4843
    break;
4846
4844
  case DB_RECORD_NOT_FOUND:
4847
4845
    error = HA_ERR_KEY_NOT_FOUND;
4848
 
    table->status = STATUS_NOT_FOUND;
 
4846
    getTable()->status = STATUS_NOT_FOUND;
4849
4847
    break;
4850
4848
  case DB_END_OF_INDEX:
4851
4849
    error = HA_ERR_KEY_NOT_FOUND;
4852
 
    table->status = STATUS_NOT_FOUND;
 
4850
    getTable()->status = STATUS_NOT_FOUND;
4853
4851
    break;
4854
4852
  default:
4855
4853
    error = convert_error_code_to_mysql((int) ret,
4856
4854
                prebuilt->table->flags,
4857
4855
                user_session);
4858
 
    table->status = STATUS_NOT_FOUND;
 
4856
    getTable()->status = STATUS_NOT_FOUND;
4859
4857
    break;
4860
4858
  }
4861
4859
 
4897
4895
  ut_ad(user_session == table->in_use);
4898
4896
  ut_a(prebuilt->trx == session_to_trx(user_session));
4899
4897
 
4900
 
  if (keynr != MAX_KEY && table->getShare()->sizeKeys() > 0) 
 
4898
  if (keynr != MAX_KEY && getTable()->getShare()->sizeKeys() > 0) 
4901
4899
  {
4902
4900
    index = dict_table_get_index_on_name(prebuilt->table,
4903
 
                                         table->getShare()->getTableProto()->indexes(keynr).name().c_str());
 
4901
                                         getTable()->getShare()->getTableProto()->indexes(keynr).name().c_str());
4904
4902
  } else {
4905
4903
    index = dict_table_get_first_index(prebuilt->table);
4906
4904
  }
4909
4907
    errmsg_printf(ERRMSG_LVL_ERROR, 
4910
4908
      "Innodb could not find key n:o %u with name %s "
4911
4909
      "from dict cache for table %s",
4912
 
      keynr, table->getShare()->getTableProto()->indexes(keynr).name().c_str(),
 
4910
      keynr, getTable()->getShare()->getTableProto()->indexes(keynr).name().c_str(),
4913
4911
      prebuilt->table->name);
4914
4912
  }
4915
4913
 
4967
4965
  the flag ROW_MYSQL_WHOLE_ROW below, but that caused unnecessary
4968
4966
  copying. Starting from MySQL-4.1 we use a more efficient flag here. */
4969
4967
 
4970
 
  build_template(prebuilt, user_session, table, ROW_MYSQL_REC_FIELDS);
 
4968
  build_template(prebuilt, user_session, getTable(), ROW_MYSQL_REC_FIELDS);
4971
4969
 
4972
4970
  return(0);
4973
4971
}
5027
5025
  switch (ret) {
5028
5026
  case DB_SUCCESS:
5029
5027
    error = 0;
5030
 
    table->status = 0;
 
5028
    getTable()->status = 0;
5031
5029
    break;
5032
5030
  case DB_RECORD_NOT_FOUND:
5033
5031
    error = HA_ERR_END_OF_FILE;
5034
 
    table->status = STATUS_NOT_FOUND;
 
5032
    getTable()->status = STATUS_NOT_FOUND;
5035
5033
    break;
5036
5034
  case DB_END_OF_INDEX:
5037
5035
    error = HA_ERR_END_OF_FILE;
5038
 
    table->status = STATUS_NOT_FOUND;
 
5036
    getTable()->status = STATUS_NOT_FOUND;
5039
5037
    break;
5040
5038
  default:
5041
5039
    error = convert_error_code_to_mysql(
5042
5040
      (int) ret, prebuilt->table->flags, user_session);
5043
 
    table->status = STATUS_NOT_FOUND;
 
5041
    getTable()->status = STATUS_NOT_FOUND;
5044
5042
    break;
5045
5043
  }
5046
5044
 
5235
5233
 
5236
5234
  ha_statistic_increment(&system_status_var::ha_read_rnd_count);
5237
5235
 
5238
 
  ut_a(prebuilt->trx == session_to_trx(table->in_use));
 
5236
  ut_a(prebuilt->trx == session_to_trx(getTable()->in_use));
5239
5237
 
5240
5238
  if (prebuilt->clust_index_was_generated) {
5241
5239
    /* No primary key was defined for the table and we
5281
5279
{
5282
5280
  uint    len;
5283
5281
 
5284
 
  ut_a(prebuilt->trx == session_to_trx(table->in_use));
 
5282
  ut_a(prebuilt->trx == session_to_trx(getTable()->in_use));
5285
5283
 
5286
5284
  if (prebuilt->clust_index_was_generated) {
5287
5285
    /* No primary key was defined for the table and we
5950
5948
 
5951
5949
  ut_a(prebuilt->trx);
5952
5950
  ut_a(prebuilt->trx->magic_n == TRX_MAGIC_N);
5953
 
  ut_a(prebuilt->trx == session_to_trx(table->in_use));
 
5951
  ut_a(prebuilt->trx == session_to_trx(getTable()->in_use));
5954
5952
 
5955
5953
  dict_table = prebuilt->table;
5956
5954
  trx = prebuilt->trx;
5979
5977
  /* Get the transaction associated with the current session, or create one
5980
5978
  if not yet created, and update prebuilt->trx */
5981
5979
 
5982
 
  update_session(table->in_use);
 
5980
  update_session(getTable()->in_use);
5983
5981
 
5984
5982
  if (session_sql_command(user_session) != SQLCOM_TRUNCATE) {
5985
5983
  fallback:
6321
6319
  KeyInfo*    key;
6322
6320
  dict_index_t* index;
6323
6321
  unsigned char*    key_val_buff2 = (unsigned char*) malloc(
6324
 
              table->getShare()->stored_rec_length
6325
 
          + table->getShare()->max_key_length + 100);
6326
 
  ulint   buff2_len = table->getShare()->stored_rec_length
6327
 
          + table->getShare()->max_key_length + 100;
 
6322
              getTable()->getShare()->stored_rec_length
 
6323
          + getTable()->getShare()->max_key_length + 100);
 
6324
  ulint   buff2_len = getTable()->getShare()->stored_rec_length
 
6325
          + getTable()->getShare()->max_key_length + 100;
6328
6326
  dtuple_t* range_start;
6329
6327
  dtuple_t* range_end;
6330
6328
  ib_int64_t  n_rows;
6332
6330
  ulint   mode2;
6333
6331
  mem_heap_t* heap;
6334
6332
 
6335
 
  ut_a(prebuilt->trx == session_to_trx(table->in_use));
 
6333
  ut_a(prebuilt->trx == session_to_trx(getTable()->in_use));
6336
6334
 
6337
6335
  prebuilt->trx->op_info = (char*)"estimating records in index range";
6338
6336
 
6343
6341
 
6344
6342
  active_index = keynr;
6345
6343
 
6346
 
  key = &table->key_info[active_index];
 
6344
  key = &getTable()->key_info[active_index];
6347
6345
 
6348
 
  index = dict_table_get_index_on_name(prebuilt->table, table->getShare()->getTableProto()->indexes(active_index).name().c_str());
 
6346
  index = dict_table_get_index_on_name(prebuilt->table, getTable()->getShare()->getTableProto()->indexes(active_index).name().c_str());
6349
6347
 
6350
6348
  /* MySQL knows about this index and so we must be able to find it.*/
6351
6349
  ut_a(index);
6427
6425
  external_lock(). To be safe, update the session of the current table
6428
6426
  handle. */
6429
6427
 
6430
 
  update_session(table->in_use);
 
6428
  update_session(getTable()->in_use);
6431
6429
 
6432
6430
  prebuilt->trx->op_info = (char*)
6433
6431
         "calculating upper bound for table rows";
6491
6489
  ha_rows total_rows;
6492
6490
  double  time_for_scan;
6493
6491
 
6494
 
  if (index != table->getShare()->getPrimaryKey()) {
 
6492
  if (index != getTable()->getShare()->getPrimaryKey()) {
6495
6493
    /* Not clustered */
6496
6494
    return(Cursor::read_time(index, ranges, rows));
6497
6495
  }
6549
6547
  external_lock(). To be safe, update the session of the current table
6550
6548
  handle. */
6551
6549
 
6552
 
  update_session(table->in_use);
 
6550
  update_session(getTable()->in_use);
6553
6551
 
6554
6552
  /* In case MySQL calls this in the middle of a SELECT query, release
6555
6553
  possible adaptive hash latch to avoid deadlocks of threads */
6657
6655
 
6658
6656
        Session*  session;
6659
6657
 
6660
 
        session= table->in_use;
 
6658
        session= getTable()->in_use;
6661
6659
        assert(session);
6662
6660
 
6663
6661
        push_warning_printf(
6693
6691
      index = dict_table_get_next_index(index);
6694
6692
    }
6695
6693
 
6696
 
    for (i = 0; i < table->getShare()->sizeKeys(); i++) {
 
6694
    for (i = 0; i < getTable()->getShare()->sizeKeys(); i++) {
6697
6695
      if (index == NULL) {
6698
6696
        errmsg_printf(ERRMSG_LVL_ERROR, "Table %s contains fewer "
6699
6697
            "indexes inside InnoDB than "
6707
6705
        break;
6708
6706
      }
6709
6707
 
6710
 
      for (j = 0; j < table->key_info[i].key_parts; j++) {
 
6708
      for (j = 0; j < getTable()->key_info[i].key_parts; j++) {
6711
6709
 
6712
6710
        if (j + 1 > index->n_uniq) {
6713
6711
          errmsg_printf(ERRMSG_LVL_ERROR, 
6741
6739
          rec_per_key = 1;
6742
6740
        }
6743
6741
 
6744
 
        table->key_info[i].rec_per_key[j]=
 
6742
        getTable()->key_info[i].rec_per_key[j]=
6745
6743
          rec_per_key >= ~(ulong) 0 ? ~(ulong) 0 :
6746
6744
          (ulong) rec_per_key;
6747
6745
      }
6766
6764
    }
6767
6765
  }
6768
6766
 
6769
 
  if ((flag & HA_STATUS_AUTO) && table->found_next_number_field) {
 
6767
  if ((flag & HA_STATUS_AUTO) && getTable()->found_next_number_field) {
6770
6768
    stats.auto_increment_value = innobase_peek_autoinc();
6771
6769
  }
6772
6770
 
6810
6808
{
6811
6809
  ulint   ret;
6812
6810
 
6813
 
  assert(session == table->in_use);
 
6811
  assert(session == getTable()->in_use);
6814
6812
  ut_a(prebuilt->trx);
6815
6813
  ut_a(prebuilt->trx->magic_n == TRX_MAGIC_N);
6816
6814
  ut_a(prebuilt->trx == session_to_trx(session));
6819
6817
    /* Build the template; we will use a dummy template
6820
6818
    in index scans done in checking */
6821
6819
 
6822
 
    build_template(prebuilt, NULL, table, ROW_MYSQL_WHOLE_ROW);
 
6820
    build_template(prebuilt, NULL, getTable(), ROW_MYSQL_WHOLE_ROW);
6823
6821
  }
6824
6822
 
6825
6823
  ret = row_check_table_for_mysql(prebuilt);
6858
6856
    return((char*)comment); /* string too long */
6859
6857
  }
6860
6858
 
6861
 
  update_session(table->in_use);
 
6859
  update_session(getTable()->in_use);
6862
6860
 
6863
6861
  prebuilt->trx->op_info = (char*)"returning table comment";
6864
6862
 
6929
6927
  external_lock(). To be safe, update the session of the current table
6930
6928
  handle. */
6931
6929
 
6932
 
  update_session(table->in_use);
 
6930
  update_session(getTable()->in_use);
6933
6931
 
6934
6932
  prebuilt->trx->op_info = (char*)"getting info on foreign keys";
6935
6933
 
6978
6976
  dict_foreign_t* foreign;
6979
6977
 
6980
6978
  ut_a(prebuilt != NULL);
6981
 
  update_session(table->in_use);
 
6979
  update_session(getTable()->in_use);
6982
6980
  prebuilt->trx->op_info = (char*)"getting list of foreign keys";
6983
6981
  trx_search_latch_release_if_reserved(prebuilt->trx);
6984
6982
  mutex_enter(&(dict_sys->mutex));
7116
7114
{
7117
7115
  bool  can_switch;
7118
7116
 
7119
 
  ut_a(prebuilt->trx == session_to_trx(table->in_use));
 
7117
  ut_a(prebuilt->trx == session_to_trx(getTable()->in_use));
7120
7118
 
7121
7119
  prebuilt->trx->op_info =
7122
7120
      "determining if there are foreign key constraints";
7204
7202
      either, because the calling threads may change.
7205
7203
      CAREFUL HERE, OR MEMORY CORRUPTION MAY OCCUR! */
7206
7204
    case HA_EXTRA_IGNORE_DUP_KEY:
7207
 
      session_to_trx(table->in_use)->duplicates |= TRX_DUP_IGNORE;
 
7205
      session_to_trx(getTable()->in_use)->duplicates |= TRX_DUP_IGNORE;
7208
7206
      break;
7209
7207
    case HA_EXTRA_WRITE_CAN_REPLACE:
7210
 
      session_to_trx(table->in_use)->duplicates |= TRX_DUP_REPLACE;
 
7208
      session_to_trx(getTable()->in_use)->duplicates |= TRX_DUP_REPLACE;
7211
7209
      break;
7212
7210
    case HA_EXTRA_WRITE_CANNOT_REPLACE:
7213
 
      session_to_trx(table->in_use)->duplicates &= ~TRX_DUP_REPLACE;
 
7211
      session_to_trx(getTable()->in_use)->duplicates &= ~TRX_DUP_REPLACE;
7214
7212
      break;
7215
7213
    case HA_EXTRA_NO_IGNORE_DUP_KEY:
7216
 
      session_to_trx(table->in_use)->duplicates &=
 
7214
      session_to_trx(getTable()->in_use)->duplicates &=
7217
7215
        ~(TRX_DUP_IGNORE | TRX_DUP_REPLACE);
7218
7216
      break;
7219
7217
    default:/* Do nothing */
7854
7852
  uint64_t  autoinc = 0;
7855
7853
 
7856
7854
  /* Prepare prebuilt->trx in the table handle */
7857
 
  update_session(table->in_use);
 
7855
  update_session(getTable()->in_use);
7858
7856
 
7859
7857
  error = innobase_get_autoinc(&autoinc);
7860
7858
 
7908
7906
    /* We need the upper limit of the col type to check for
7909
7907
    whether we update the table autoinc counter or not. */
7910
7908
    col_max_value = innobase_get_int_col_max_value(
7911
 
      table->next_number_field);
 
7909
      getTable()->next_number_field);
7912
7910
 
7913
7911
    current = *first_value > col_max_value ? autoinc : *first_value;
7914
7912
    need = *nb_reserved_values * increment;
7951
7949
{
7952
7950
  int error;
7953
7951
 
7954
 
  update_session(table->in_use);
 
7952
  update_session(getTable()->in_use);
7955
7953
 
7956
7954
  error = row_lock_table_autoinc_for_mysql(prebuilt);
7957
7955
 
8017
8015
  /* Do a type-aware comparison of primary key fields. PK fields
8018
8016
  are always NOT NULL, so no checks for NULL are performed. */
8019
8017
 
8020
 
  key_part = table->key_info[table->getShare()->getPrimaryKey()].key_part;
 
8018
  key_part = getTable()->key_info[getTable()->getShare()->getPrimaryKey()].key_part;
8021
8019
 
8022
8020
  key_part_end = key_part
8023
 
      + table->key_info[table->getShare()->getPrimaryKey()].key_parts;
 
8021
      + getTable()->key_info[getTable()->getShare()->getPrimaryKey()].key_parts;
8024
8022
 
8025
8023
  for (; key_part != key_part_end; ++key_part) {
8026
8024
    field = key_part->field;