Merge damien-katzs-computer.local:/Users/dkatz/mysql51
into damien-katzs-computer.local:/Users/dkatz/51
This commit is contained in:
commit
154908d84d
@ -65,11 +65,23 @@ typedef struct st_user_var_events
|
||||
#define RP_LOCK_LOG_IS_ALREADY_LOCKED 1
|
||||
#define RP_FORCE_ROTATE 2
|
||||
|
||||
/*
|
||||
The COPY_INFO structure is used by INSERT/REPLACE code.
|
||||
The schema of the row counting by the INSERT/INSERT ... ON DUPLICATE KEY
|
||||
UPDATE code:
|
||||
If a row is inserted then the copied variable is incremented.
|
||||
If a row is updated by the INSERT ... ON DUPLICATE KEY UPDATE and the
|
||||
new data differs from the old one then the copied and the updated
|
||||
variables are incremented.
|
||||
The touched variable is incremented if a row was touched by the update part
|
||||
of the INSERT ... ON DUPLICATE KEY UPDATE no matter whether the row
|
||||
was actually changed or not.
|
||||
*/
|
||||
typedef struct st_copy_info {
|
||||
ha_rows records;
|
||||
ha_rows deleted;
|
||||
ha_rows updated;
|
||||
ha_rows copied;
|
||||
ha_rows records; /* Number of processed records */
|
||||
ha_rows deleted; /* Number of deleted records */
|
||||
ha_rows updated; /* Number of updated records */
|
||||
ha_rows copied; /* Number of copied records */
|
||||
ha_rows error_count;
|
||||
ha_rows touched; /* Number of touched records */
|
||||
enum enum_duplicates handle_duplicates;
|
||||
|
@ -661,7 +661,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
|
||||
/*
|
||||
Fill in the given fields and dump it to the table file
|
||||
*/
|
||||
info.records= info.deleted= info.copied= info.updated= 0;
|
||||
bzero((char*) &info,sizeof(info));
|
||||
info.ignore= ignore;
|
||||
info.handle_duplicates=duplic;
|
||||
info.update_fields= &update_fields;
|
||||
@ -1421,6 +1421,10 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
|
||||
goto before_trg_err;
|
||||
|
||||
table->file->restore_auto_increment(prev_insert_id);
|
||||
if (table->next_number_field)
|
||||
table->file->adjust_next_insert_id_after_explicit_value(
|
||||
table->next_number_field->val_int());
|
||||
info->touched++;
|
||||
if ((table->file->ha_table_flags() & HA_PARTIAL_COLUMN_READ) ||
|
||||
compare_record(table))
|
||||
{
|
||||
@ -1448,9 +1452,6 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
|
||||
handled separately by THD::arg_of_last_insert_id_function.
|
||||
*/
|
||||
insert_id_for_cur_row= table->file->insert_id_for_cur_row= 0;
|
||||
if (table->next_number_field)
|
||||
table->file->adjust_next_insert_id_after_explicit_value(
|
||||
table->next_number_field->val_int());
|
||||
trg_error= (table->triggers &&
|
||||
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
|
||||
TRG_ACTION_AFTER, TRUE));
|
||||
|
@ -16271,6 +16271,38 @@ static void test_bug27592()
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Bug #29692 Single row inserts can incorrectly report a huge number of
|
||||
row insertions
|
||||
*/
|
||||
|
||||
static void test_bug29692()
|
||||
{
|
||||
MYSQL* conn;
|
||||
|
||||
if (!(conn= mysql_init(NULL)))
|
||||
{
|
||||
myerror("test_bug29692 init failed");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!(mysql_real_connect(conn, opt_host, opt_user,
|
||||
opt_password, opt_db ? opt_db:"test", opt_port,
|
||||
opt_unix_socket, CLIENT_FOUND_ROWS)))
|
||||
{
|
||||
myerror("test_bug29692 connection failed");
|
||||
mysql_close(mysql);
|
||||
exit(1);
|
||||
}
|
||||
myquery(mysql_query(conn, "drop table if exists t1"));
|
||||
myquery(mysql_query(conn, "create table t1(f1 int)"));
|
||||
myquery(mysql_query(conn, "insert into t1 values(1)"));
|
||||
DIE_UNLESS(1 == mysql_affected_rows(conn));
|
||||
myquery(mysql_query(conn, "drop table t1"));
|
||||
mysql_close(conn);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Read and parse arguments and MySQL options from my.cnf
|
||||
*/
|
||||
@ -16560,6 +16592,7 @@ static struct my_tests_st my_tests[]= {
|
||||
{ "test_bug28505", test_bug28505 },
|
||||
{ "test_bug28934", test_bug28934 },
|
||||
{ "test_bug27592", test_bug27592 },
|
||||
{ "test_bug29692", test_bug29692 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user