~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Mark Atwood
  • Date: 2011-08-12 04:08:33 UTC
  • mfrom: (2385.2.17 refactor5)
  • Revision ID: me@mark.atwood.name-20110812040833-u6j85nc6ahuc0dtz
mergeĀ lp:~olafvdspek/drizzle/refactor5

Show diffs side-by-side

added added

removed removed

Lines of Context:
6957
6957
 
6958
6958
  ut_a(prebuilt->trx == session_to_trx(getTable()->in_use));
6959
6959
 
6960
 
  prebuilt->trx->op_info = (char*)"estimating records in index range";
 
6960
  prebuilt->trx->op_info = "estimating records in index range";
6961
6961
 
6962
6962
  /* In case MySQL calls this in the middle of a SELECT query, release
6963
6963
  possible adaptive hash latch to avoid deadlocks of threads */
7029
7029
func_exit:
7030
7030
  free(key_val_buff2);
7031
7031
 
7032
 
  prebuilt->trx->op_info = (char*)"";
 
7032
  prebuilt->trx->op_info = "";
7033
7033
 
7034
7034
  /* The MySQL optimizer seems to believe an estimate of 0 rows is
7035
7035
  always accurate and may return the result 'Empty set' based on that.
7090
7090
  estimate = 2 * local_data_file_length /
7091
7091
           dict_index_calc_min_rec_len(index);
7092
7092
 
7093
 
  prebuilt->trx->op_info = (char*)"";
 
7093
  prebuilt->trx->op_info = "";
7094
7094
 
7095
7095
  return((ha_rows) estimate);
7096
7096
}
7280
7280
  /* In case MySQL calls this in the middle of a SELECT query, release
7281
7281
  possible adaptive hash latch to avoid deadlocks of threads */
7282
7282
 
7283
 
  prebuilt->trx->op_info = (char*)"returning various info to MySQL";
 
7283
  prebuilt->trx->op_info = "returning various info to MySQL";
7284
7284
 
7285
7285
  trx_search_latch_release_if_reserved(prebuilt->trx);
7286
7286
 
7527
7527
  }
7528
7528
 
7529
7529
func_exit:
7530
 
  prebuilt->trx->op_info = (char*)"";
 
7530
  prebuilt->trx->op_info = "";
7531
7531
 
7532
7532
  return(0);
7533
7533
}
7738
7738
 
7739
7739
  update_session(getTable()->in_use);
7740
7740
 
7741
 
  prebuilt->trx->op_info = (char*)"returning table comment";
 
7741
  prebuilt->trx->op_info = "returning table comment";
7742
7742
 
7743
7743
  /* In case MySQL calls this in the middle of a SELECT query, release
7744
7744
  possible adaptive hash latch to avoid deadlocks of threads */
7783
7783
 
7784
7784
  mutex_exit(&srv_dict_tmpfile_mutex);
7785
7785
 
7786
 
  prebuilt->trx->op_info = (char*)"";
 
7786
  prebuilt->trx->op_info = "";
7787
7787
 
7788
7788
  return(str ? str : (char*) comment);
7789
7789
}
7809
7809
 
7810
7810
  update_session(getTable()->in_use);
7811
7811
 
7812
 
  prebuilt->trx->op_info = (char*)"getting info on foreign keys";
 
7812
  prebuilt->trx->op_info = "getting info on foreign keys";
7813
7813
 
7814
7814
  /* In case MySQL calls this in the middle of a SELECT query,
7815
7815
  release possible adaptive hash latch to avoid
7823
7823
  /* output the data to a temporary file */
7824
7824
  dict_print_info_on_foreign_keys(TRUE, srv_dict_tmpfile,
7825
7825
        prebuilt->trx, prebuilt->table);
7826
 
  prebuilt->trx->op_info = (char*)"";
 
7826
  prebuilt->trx->op_info = "";
7827
7827
 
7828
7828
  flen = ftell(srv_dict_tmpfile);
7829
7829
  if (flen < 0) {
7851
7851
int
7852
7852
ha_innobase::get_foreign_key_list(Session *session, List<ForeignKeyInfo> *f_key_list)
7853
7853
{
7854
 
  dict_foreign_t* foreign;
7855
 
 
7856
7854
  ut_a(prebuilt != NULL);
7857
7855
  update_session(getTable()->in_use);
7858
 
  prebuilt->trx->op_info = (char*)"getting list of foreign keys";
 
7856
  prebuilt->trx->op_info = "getting list of foreign keys";
7859
7857
  trx_search_latch_release_if_reserved(prebuilt->trx);
7860
7858
  mutex_enter(&(dict_sys->mutex));
7861
 
  foreign = UT_LIST_GET_FIRST(prebuilt->table->foreign_list);
 
7859
  dict_foreign_t* foreign = UT_LIST_GET_FIRST(prebuilt->table->foreign_list);
7862
7860
 
7863
7861
  while (foreign != NULL) {
7864
7862
 
7865
 
    uint i;
7866
 
    lex_string_t *name = 0;
7867
7863
    uint ulen;
7868
7864
    char uname[NAME_LEN + 1];           /* Unencoded name */
7869
7865
    char db_name[NAME_LEN + 1];
7871
7867
 
7872
7868
    /** Foreign id **/
7873
7869
    tmp_buff = foreign->id;
7874
 
    i = 0;
 
7870
    uint i = 0;
7875
7871
    while (tmp_buff[i] != '/')
7876
7872
      i++;
7877
7873
    tmp_buff += i + 1;
7878
 
    lex_string_t *tmp_foreign_id = session->make_lex_string(NULL, tmp_buff, strlen(tmp_buff), true);
 
7874
    lex_string_t *tmp_foreign_id = session->make_lex_string(NULL, str_ref(tmp_buff));
7879
7875
 
7880
7876
    /* Database name */
7881
7877
    tmp_buff = foreign->referenced_table_name;
7888
7884
    }
7889
7885
    db_name[i] = 0;
7890
7886
    ulen= identifier::Table::filename_to_tablename(db_name, uname, sizeof(uname));
7891
 
    lex_string_t *tmp_referenced_db = session->make_lex_string(NULL, uname, ulen, true);
 
7887
    lex_string_t *tmp_referenced_db = session->make_lex_string(NULL, str_ref(uname, ulen));
7892
7888
 
7893
7889
    /* Table name */
7894
7890
    tmp_buff += i + 1;
7895
7891
    ulen= identifier::Table::filename_to_tablename(tmp_buff, uname, sizeof(uname));
7896
 
    lex_string_t *tmp_referenced_table = session->make_lex_string(NULL, uname, ulen, true);
 
7892
    lex_string_t *tmp_referenced_table = session->make_lex_string(NULL, str_ref(uname, ulen));
7897
7893
 
7898
7894
    /** Foreign Fields **/
7899
7895
    List<lex_string_t> tmp_foreign_fields;
7900
7896
    List<lex_string_t> tmp_referenced_fields;
7901
 
    for (i= 0;;) {
7902
 
      tmp_buff= foreign->foreign_col_names[i];
7903
 
      name = session->make_lex_string(name, tmp_buff, strlen(tmp_buff), true);
7904
 
      tmp_foreign_fields.push_back(name);
7905
 
      tmp_buff= foreign->referenced_col_names[i];
7906
 
      name = session->make_lex_string(name, tmp_buff, strlen(tmp_buff), true);
7907
 
      tmp_referenced_fields.push_back(name);
 
7897
    for (i= 0;;) 
 
7898
                {
 
7899
      tmp_foreign_fields.push_back(session->make_lex_string(NULL, str_ref(foreign->foreign_col_names[i])));
 
7900
      tmp_referenced_fields.push_back(session->make_lex_string(NULL, str_ref(foreign->referenced_col_names[i])));
7908
7901
      if (++i >= foreign->n_fields)
7909
7902
        break;
7910
7903
    }
7930
7923
      length=8;
7931
7924
      tmp_buff= "RESTRICT";
7932
7925
    }
7933
 
    lex_string_t *tmp_delete_method = session->make_lex_string(NULL, tmp_buff, length, true);
 
7926
    lex_string_t *tmp_delete_method = session->make_lex_string(NULL, str_ref(tmp_buff, length));
7934
7927
 
7935
7928
 
7936
7929
    if (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE)
7953
7946
      length=8;
7954
7947
      tmp_buff= "RESTRICT";
7955
7948
    }
7956
 
    lex_string_t *tmp_update_method = session->make_lex_string(NULL, tmp_buff, length, true);
 
7949
    lex_string_t *tmp_update_method = session->make_lex_string(NULL, str_ref(tmp_buff, length));
7957
7950
 
7958
7951
    lex_string_t *tmp_referenced_key_name = NULL;
7959
7952
 
7960
 
    if (foreign->referenced_index &&
7961
 
        foreign->referenced_index->name)
 
7953
    if (foreign->referenced_index && foreign->referenced_index->name)
7962
7954
    {
7963
 
      tmp_referenced_key_name = session->make_lex_string(NULL,
7964
 
                                                         foreign->referenced_index->name, strlen(foreign->referenced_index->name), true);
 
7955
      tmp_referenced_key_name = session->make_lex_string(NULL, str_ref(foreign->referenced_index->name));
7965
7956
    }
7966
7957
 
7967
7958
    ForeignKeyInfo f_key_info(
7969
7960
                              tmp_update_method, tmp_delete_method, tmp_referenced_key_name,
7970
7961
                              tmp_foreign_fields, tmp_referenced_fields);
7971
7962
 
7972
 
    ForeignKeyInfo *pf_key_info = (ForeignKeyInfo*)session->mem.memdup(&f_key_info, sizeof(ForeignKeyInfo));
7973
 
    f_key_list->push_back(pf_key_info);
 
7963
    f_key_list->push_back((ForeignKeyInfo*)session->mem.memdup(&f_key_info, sizeof(ForeignKeyInfo)));
7974
7964
    foreign = UT_LIST_GET_NEXT(foreign_list, foreign);
7975
7965
  }
7976
7966
  mutex_exit(&(dict_sys->mutex));
7977
 
  prebuilt->trx->op_info = (char*)"";
 
7967
  prebuilt->trx->op_info = "";
7978
7968
 
7979
7969
  return(0);
7980
7970
}
8549
8539
 
8550
8540
    HASH_DELETE(INNOBASE_SHARE, table_name_hash,
8551
8541
          innobase_open_tables, fold, share);
8552
 
    share->lock.deinit();
8553
8542
 
8554
8543
    /* Free any memory from index translation table */
8555
8544
    free(share->idx_trans_tbl.index_mapping);