7846
7846
mutex_enter(&(dict_sys->mutex));
7847
7847
dict_foreign_t* foreign = UT_LIST_GET_FIRST(prebuilt->table->foreign_list);
7849
while (foreign != NULL) {
7849
while (foreign != NULL)
7852
7852
char uname[NAME_LEN + 1]; /* Unencoded name */
7853
7853
char db_name[NAME_LEN + 1];
7894
7893
if (foreign->type & DICT_FOREIGN_ON_DELETE_CASCADE)
7897
7894
tmp_buff= "CASCADE";
7899
7895
else if (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL)
7902
7896
tmp_buff= "SET NULL";
7904
7897
else if (foreign->type & DICT_FOREIGN_ON_DELETE_NO_ACTION)
7907
7898
tmp_buff= "NO ACTION";
7912
7900
tmp_buff= "RESTRICT";
7914
lex_string_t *tmp_delete_method = session->make_lex_string(NULL, str_ref(tmp_buff, length));
7901
lex_string_t *tmp_delete_method = session->make_lex_string(NULL, str_ref(tmp_buff));
7917
7903
if (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE)
7920
7904
tmp_buff= "CASCADE";
7922
7905
else if (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL)
7925
7906
tmp_buff= "SET NULL";
7927
7907
else if (foreign->type & DICT_FOREIGN_ON_UPDATE_NO_ACTION)
7930
7908
tmp_buff= "NO ACTION";
7935
7910
tmp_buff= "RESTRICT";
7937
lex_string_t *tmp_update_method = session->make_lex_string(NULL, str_ref(tmp_buff, length));
7939
lex_string_t *tmp_referenced_key_name = NULL;
7941
if (foreign->referenced_index && foreign->referenced_index->name)
7943
tmp_referenced_key_name = session->make_lex_string(NULL, str_ref(foreign->referenced_index->name));
7911
lex_string_t *tmp_update_method = session->make_lex_string(NULL, str_ref(tmp_buff));
7913
lex_string_t *tmp_referenced_key_name = foreign->referenced_index && foreign->referenced_index->name
7914
? session->make_lex_string(NULL, str_ref(foreign->referenced_index->name))
7946
7917
ForeignKeyInfo f_key_info(
7947
tmp_foreign_id, tmp_referenced_db, tmp_referenced_table,
7948
tmp_update_method, tmp_delete_method, tmp_referenced_key_name,
7949
tmp_foreign_fields, tmp_referenced_fields);
7918
tmp_foreign_id, tmp_referenced_db, tmp_referenced_table,
7919
tmp_update_method, tmp_delete_method, tmp_referenced_key_name,
7920
tmp_foreign_fields, tmp_referenced_fields);
7951
7922
f_key_list->push_back((ForeignKeyInfo*)session->mem.memdup(&f_key_info, sizeof(ForeignKeyInfo)));
7952
7923
foreign = UT_LIST_GET_NEXT(foreign_list, foreign);