Fix for found rows in multi-table updates
This commit is contained in:
parent
172d5acb6d
commit
53239a714a
@ -236,3 +236,13 @@ n d
|
||||
1 30
|
||||
1 30
|
||||
drop table t1,t2;
|
||||
drop table if exists t1,t2,t3;
|
||||
CREATE TABLE t1 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM;
|
||||
INSERT INTO t1 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a'),(10,''),(11,''),(12,''),(13,'');
|
||||
CREATE TABLE t2 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM;
|
||||
INSERT INTO t2 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a');
|
||||
CREATE TABLE t3 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM;
|
||||
INSERT INTO t3 VALUES (1,'jedan'),(2,'dva');
|
||||
update t1,t2 set t1.naziv="aaaa" where t1.broj=t2.broj;
|
||||
update t1,t2,t3 set t1.naziv="bbbb", t2.naziv="aaaa" where t1.broj=t2.broj and t2.broj=t3.broj;
|
||||
drop table if exists t1,t2,t3;
|
||||
|
@ -214,3 +214,13 @@ UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
drop table t1,t2;
|
||||
drop table if exists t1,t2,t3;
|
||||
CREATE TABLE t1 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM;
|
||||
INSERT INTO t1 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a'),(10,''),(11,''),(12,''),(13,'');
|
||||
CREATE TABLE t2 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM;
|
||||
INSERT INTO t2 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a');
|
||||
CREATE TABLE t3 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM;
|
||||
INSERT INTO t3 VALUES (1,'jedan'),(2,'dva');
|
||||
update t1,t2 set t1.naziv="aaaa" where t1.broj=t2.broj;
|
||||
update t1,t2,t3 set t1.naziv="bbbb", t2.naziv="aaaa" where t1.broj=t2.broj and t2.broj=t3.broj;
|
||||
drop table if exists t1,t2,t3;
|
||||
|
@ -614,7 +614,6 @@ bool multi_update::send_data(List<Item> ¬_used_values)
|
||||
TABLE_LIST *cur_table;
|
||||
DBUG_ENTER("multi_update::send_data");
|
||||
|
||||
found++;
|
||||
for (cur_table= update_tables; cur_table ; cur_table= cur_table->next)
|
||||
{
|
||||
TABLE *table= cur_table->table;
|
||||
@ -630,6 +629,7 @@ bool multi_update::send_data(List<Item> ¬_used_values)
|
||||
store_record(table,1);
|
||||
if (fill_record(*fields_for_table[offset], *values_for_table[offset]))
|
||||
DBUG_RETURN(1);
|
||||
found++;
|
||||
if (compare_record(table, thd->query_id))
|
||||
{
|
||||
int error;
|
||||
@ -656,7 +656,7 @@ bool multi_update::send_data(List<Item> ¬_used_values)
|
||||
int error;
|
||||
TABLE *tmp_table= tmp_tables[offset];
|
||||
fill_record(tmp_table->field+1, *values_for_table[offset]);
|
||||
|
||||
found++;
|
||||
/* Store pointer to row */
|
||||
memcpy((char*) tmp_table->field[0]->ptr,
|
||||
(char*) table->file->ref, table->file->ref_length);
|
||||
@ -754,7 +754,6 @@ int multi_update::do_updates(bool from_send_error)
|
||||
continue; // May happen on dup key
|
||||
goto err;
|
||||
}
|
||||
found++;
|
||||
if ((local_error= table->file->rnd_pos(table->record[0], ref_pos)))
|
||||
goto err;
|
||||
table->status|= STATUS_UPDATED;
|
||||
|
Loading…
x
Reference in New Issue
Block a user