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
41d2103e
Commit
41d2103e
authored
May 13, 2003
by
monty@narttu.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed 'Unknown error' when using 'UPDATE ... LIMIT'. Bug 373
parent
2693203a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
0 deletions
+33
-0
mysql-test/r/update.result
mysql-test/r/update.result
+12
-0
mysql-test/t/update.test
mysql-test/t/update.test
+17
-0
sql/sql_update.cc
sql/sql_update.cc
+4
-0
No files found.
mysql-test/r/update.result
View file @
41d2103e
...
@@ -138,3 +138,15 @@ a b
...
@@ -138,3 +138,15 @@ a b
111 100
111 100
111 100
111 100
drop table t1;
drop table t1;
CREATE TABLE t1 (
`id_param` smallint(3) unsigned NOT NULL default '0',
`nom_option` char(40) NOT NULL default '',
`valid` tinyint(1) NOT NULL default '0',
KEY `id_param` (`id_param`,`nom_option`)
) TYPE=MyISAM;
INSERT INTO t1 (id_param,nom_option,valid) VALUES (185,'600x1200',1);
UPDATE t1 SET nom_option='test' WHERE id_param=185 AND nom_option='600x1200' AND valid=1 LIMIT 1;
select * from t1;
id_param nom_option valid
185 test 1
drop table t1;
mysql-test/t/update.test
View file @
41d2103e
...
@@ -91,3 +91,20 @@ update t1 set b=100 where a=1 order by b desc limit 2;
...
@@ -91,3 +91,20 @@ update t1 set b=100 where a=1 order by b desc limit 2;
update
t1
set
a
=
a
+
10
+
b
where
a
=
1
order
by
b
;
update
t1
set
a
=
a
+
10
+
b
where
a
=
1
order
by
b
;
select
*
from
t1
order
by
a
,
b
;
select
*
from
t1
order
by
a
,
b
;
drop
table
t1
;
drop
table
t1
;
#
# Test with limit (Bug #393)
#
CREATE
TABLE
t1
(
`id_param`
smallint
(
3
)
unsigned
NOT
NULL
default
'0'
,
`nom_option`
char
(
40
)
NOT
NULL
default
''
,
`valid`
tinyint
(
1
)
NOT
NULL
default
'0'
,
KEY
`id_param`
(
`id_param`
,
`nom_option`
)
)
TYPE
=
MyISAM
;
INSERT
INTO
t1
(
id_param
,
nom_option
,
valid
)
VALUES
(
185
,
'600x1200'
,
1
);
UPDATE
t1
SET
nom_option
=
'test'
WHERE
id_param
=
185
AND
nom_option
=
'600x1200'
AND
valid
=
1
LIMIT
1
;
select
*
from
t1
;
drop
table
t1
;
sql/sql_update.cc
View file @
41d2103e
...
@@ -231,9 +231,13 @@ int mysql_update(THD *thd,
...
@@ -231,9 +231,13 @@ int mysql_update(THD *thd,
break
;
/* purecov: inspected */
break
;
/* purecov: inspected */
}
}
if
(
!--
limit
&&
using_limit
)
if
(
!--
limit
&&
using_limit
)
{
error
=
-
1
;
break
;
break
;
}
}
}
}
}
limit
=
tmp_limit
;
end_read_record
(
&
info
);
end_read_record
(
&
info
);
/* Change select to use tempfile */
/* Change select to use tempfile */
if
(
select
)
if
(
select
)
...
...
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