Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
5961bff5
Commit
5961bff5
authored
Dec 18, 2002
by
Sinisa@sinisa.nasamreza.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for found rows in multi-table updates
parent
e2e5d598
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
3 deletions
+22
-3
mysql-test/r/multi_update.result
mysql-test/r/multi_update.result
+10
-0
mysql-test/t/multi_update.test
mysql-test/t/multi_update.test
+10
-0
sql/sql_update.cc
sql/sql_update.cc
+2
-3
No files found.
mysql-test/r/multi_update.result
View file @
5961bff5
...
...
@@ -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;
mysql-test/t/multi_update.test
View file @
5961bff5
...
...
@@ -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
;
sql/sql_update.cc
View file @
5961bff5
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment