diff options
author | unknown <heikki@donna.mysql.fi> | 2001-03-06 19:45:10 +0200 |
---|---|---|
committer | unknown <heikki@donna.mysql.fi> | 2001-03-06 19:45:10 +0200 |
commit | e58c19253841961fa558625746a8a0e780427f0d (patch) | |
tree | 8379d144f3d45e35f34cbed179ce3e5d5c26c30a /innobase | |
parent | 277d59b86e14fc5443bc5a87fc399ee2d5491069 (diff) | |
download | mariadb-git-e58c19253841961fa558625746a8a0e780427f0d.tar.gz |
trx0trx.h Innobase now returns the key number in a duplicate key error, removed innobase/include from make dirs
row0ins.c Innobase now returns the key number in a duplicate key error, removed innobase/include from make dirs
row0mysql.c Innobase now returns the key number in a duplicate key error, removed innobase/include from make dirs
row0mysql.h Innobase now returns the key number in a duplicate key error, removed innobase/include from make dirs
ha_innobase.cc Innobase now returns the key number in a duplicate key error, removed innobase/include from make dirs
sql/ha_innobase.cc:
Innobase now returns the key number in a duplicate key error, removed innobase/include from make dirs
innobase/include/row0mysql.h:
Innobase now returns the key number in a duplicate key error, removed innobase/include from make dirs
innobase/include/trx0trx.h:
Innobase now returns the key number in a duplicate key error, removed innobase/include from make dirs
innobase/row/row0ins.c:
Innobase now returns the key number in a duplicate key error, removed innobase/include from make dirs
innobase/row/row0mysql.c:
Innobase now returns the key number in a duplicate key error, removed innobase/include from make dirs
Diffstat (limited to 'innobase')
-rw-r--r-- | innobase/include/row0mysql.h | 8 | ||||
-rw-r--r-- | innobase/include/trx0trx.h | 3 | ||||
-rw-r--r-- | innobase/row/row0ins.c | 5 | ||||
-rw-r--r-- | innobase/row/row0mysql.c | 30 |
4 files changed, 45 insertions, 1 deletions
diff --git a/innobase/include/row0mysql.h b/innobase/include/row0mysql.h index ee631bc02dc..d47fa729dce 100644 --- a/innobase/include/row0mysql.h +++ b/innobase/include/row0mysql.h @@ -170,6 +170,14 @@ row_table_got_default_clust_index( /*==============================*/ dict_table_t* table); /************************************************************************* +Calculates the key number used inside MySQL for an Innobase index. We have +to take into account if we generated a default clustered index for the table */ + +ulint +row_get_mysql_key_number_for_index( +/*===============================*/ + dict_index_t* index); +/************************************************************************* Does an update or delete of a row for MySQL. */ int diff --git a/innobase/include/trx0trx.h b/innobase/include/trx0trx.h index e2a1b4435e7..b74dea2319e 100644 --- a/innobase/include/trx0trx.h +++ b/innobase/include/trx0trx.h @@ -307,6 +307,9 @@ struct trx_struct{ /*------------------------------*/ ulint error_state; /* 0 if no error, otherwise error number */ + void* error_info; /* if the error number indicates a + duplicate key error, a pointer to + the problematic index is stored here */ sess_t* sess; /* session of the trx, NULL if none */ ulint que_state; /* TRX_QUE_RUNNING, TRX_QUE_LOCK_WAIT, ... */ diff --git a/innobase/row/row0ins.c b/innobase/row/row0ins.c index 89a85a39a55..4c5a46536cb 100644 --- a/innobase/row/row0ins.c +++ b/innobase/row/row0ins.c @@ -407,6 +407,7 @@ row_ins_scan_sec_index_for_duplicate( ut_a(dupl_count >= 1); if (dupl_count > 1) { + trx->error_info = index; return(DB_DUPLICATE_KEY); } @@ -468,7 +469,8 @@ row_ins_duplicate_error( if (row_ins_dupl_error_with_rec(rec, entry, cursor->index, trx)) { *dupl_rec = rec; - + trx->error_info = cursor->index; + return(DB_DUPLICATE_KEY); } } @@ -484,6 +486,7 @@ row_ins_duplicate_error( if (row_ins_dupl_error_with_rec(rec, entry, cursor->index, trx)) { *dupl_rec = rec; + trx->error_info = cursor->index; return(DB_DUPLICATE_KEY); } diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index 8a745dc216e..10ddf381166 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -762,6 +762,36 @@ row_table_got_default_clust_index( } /************************************************************************* +Calculates the key number used inside MySQL for an Innobase index. We have +to take into account if we generated a default clustered index for the table */ + +ulint +row_get_mysql_key_number_for_index( +/*===============================*/ + dict_index_t* index) +{ + dict_index_t* ind; + ulint i; + + ut_a(index); + + i = 0; + ind = dict_table_get_first_index(index->table); + + while (index != ind) { + ind = dict_table_get_next_index(ind); + i++; + } + + if (row_table_got_default_clust_index(index->table)) { + ut_a(i > 0); + i--; + } + + return(i); +} + +/************************************************************************* Does a table creation operation for MySQL. */ int |