505
505
case DB_CANNOT_ADD_CONSTRAINT:
506
506
case DB_TOO_MANY_CONCURRENT_TRXS:
507
507
case DB_OUT_OF_FILE_SPACE:
510
509
/* Roll back the latest, possibly incomplete
511
510
insertion or update */
609
608
prebuilt->select_lock_type = LOCK_NONE;
610
609
prebuilt->stored_select_lock_type = 99999999;
611
UNIV_MEM_INVALID(&prebuilt->stored_select_lock_type,
612
sizeof prebuilt->stored_select_lock_type);
614
611
prebuilt->search_tuple = dtuple_create(
615
612
heap, 2 * dict_table_get_n_cols(table));
1415
1412
/*********************************************************************//**
1416
This can only be used when srv_locks_unsafe_for_binlog is TRUE or this
1417
session is using a READ COMMITTED or READ UNCOMMITTED isolation level.
1418
Before calling this function row_search_for_mysql() must have
1419
initialized prebuilt->new_rec_locks to store the information which new
1420
record locks really were set. This function removes a newly set
1421
clustered index record lock under prebuilt->pcur or
1422
prebuilt->clust_pcur. Thus, this implements a 'mini-rollback' that
1423
releases the latest clustered index record lock we set.
1424
@return error code or DB_SUCCESS */
1413
This can only be used when srv_locks_unsafe_for_binlog is TRUE or
1414
this session is using a READ COMMITTED isolation level. Before
1415
calling this function we must use trx_reset_new_rec_lock_info() and
1416
trx_register_new_rec_lock() to store the information which new record locks
1417
really were set. This function removes a newly set lock under prebuilt->pcur,
1418
and also under prebuilt->clust_pcur. Currently, this is only used and tested
1419
in the case of an UPDATE or a DELETE statement, where the row lock is of the
1421
Thus, this implements a 'mini-rollback' that releases the latest record
1423
@return error code or DB_SUCCESS */
1427
1426
row_unlock_for_mysql(
1428
1427
/*=================*/
1429
row_prebuilt_t* prebuilt, /*!< in/out: prebuilt struct in MySQL
1428
row_prebuilt_t* prebuilt, /*!< in: prebuilt struct in MySQL
1431
ibool has_latches_on_recs)/*!< in: TRUE if called so
1432
that we have the latches on
1433
the records under pcur and
1434
clust_pcur, and we do not need
1435
to reposition the cursors. */
1430
ibool has_latches_on_recs)/*!< TRUE if called so that we have
1431
the latches on the records under pcur
1432
and clust_pcur, and we do not need to
1433
reposition the cursors. */
1437
1435
btr_pcur_t* pcur = prebuilt->pcur;
1438
1436
btr_pcur_t* clust_pcur = prebuilt->clust_pcur;
1632
1630
/*********************************************************************//**
1631
Calculates the key number used inside MySQL for an Innobase index. We have
1632
to take into account if we generated a default clustered index for the table
1633
@return the key number used inside MySQL */
1636
row_get_mysql_key_number_for_index(
1637
/*===============================*/
1638
const dict_index_t* index) /*!< in: index */
1640
const dict_index_t* ind;
1646
ind = dict_table_get_first_index(index->table);
1648
while (index != ind) {
1649
ind = dict_table_get_next_index(ind);
1653
if (row_table_got_default_clust_index(index->table)) {
1661
/*********************************************************************//**
1633
1662
Locks the data dictionary in shared mode from modifications, for performing
1634
1663
foreign key check, rollback, or other operation invisible to MySQL. */
2001
2030
FOREIGN KEY (a, b) REFERENCES table2(c, d),
2002
2031
table2 can be written also with the
2003
2032
database name before it: test.table2 */
2004
size_t sql_length, /*!< in: length of sql_string */
2005
2033
const char* name, /*!< in: table full name in the
2006
2034
normalized form
2007
2035
database_name/table_name */
2024
2052
trx_set_dict_operation(trx, TRX_DICT_OP_TABLE);
2026
err = dict_create_foreign_constraints(trx, sql_string, sql_length,
2054
err = dict_create_foreign_constraints(trx, sql_string, name,
2028
2056
if (err == DB_SUCCESS) {
2029
2057
/* Check that also referencing constraints are ok */
2030
2058
err = dict_load_foreigns(name, TRUE);
2368
2396
goto funct_exit;
2371
dict_hdr_get_new_id(&new_id, NULL, NULL);
2399
new_id = dict_hdr_get_new_id(DICT_HDR_TABLE_ID);
2373
2401
/* Remove all locks except the table-level S and X locks. */
2374
2402
lock_remove_all_on_table(table, FALSE);
2731
2759
dict_index_t* index;
2733
dict_hdr_get_new_id(NULL, NULL, &space);
2735
if (space == ULINT_UNDEFINED
2736
|| fil_create_new_single_table_tablespace(
2737
space, table->name, FALSE, flags,
2763
if (fil_create_new_single_table_tablespace(
2764
&space, table->name, FALSE, flags,
2738
2765
FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
2739
2766
ut_print_timestamp(stderr);
2740
2767
fprintf(stderr,