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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
36429430
Commit
36429430
authored
Dec 02, 2002
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge sinisa@work.mysql.com:/home/bk/mysql-4.1
into sinisa.nasamreza.org:/mnt/work/mysql-4.1
parents
61daab79
68b4940a
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
168 additions
and
98 deletions
+168
-98
heap/hp_create.c
heap/hp_create.c
+1
-0
heap/hp_update.c
heap/hp_update.c
+4
-2
heap/hp_write.c
heap/hp_write.c
+1
-1
mysql-test/mysql-test-run.sh
mysql-test/mysql-test-run.sh
+3
-3
mysql-test/r/row_test.result
mysql-test/r/row_test.result
+31
-31
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+20
-2
mysql-test/t/row_test.test
mysql-test/t/row_test.test
+19
-19
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+20
-2
sql/item_sum.cc
sql/item_sum.cc
+1
-1
sql/item_sum.h
sql/item_sum.h
+1
-1
sql/sql_class.cc
sql/sql_class.cc
+10
-9
sql/sql_delete.cc
sql/sql_delete.cc
+5
-3
sql/sql_insert.cc
sql/sql_insert.cc
+7
-6
sql/sql_lex.cc
sql/sql_lex.cc
+3
-2
sql/sql_parse.cc
sql/sql_parse.cc
+12
-0
sql/sql_select.cc
sql/sql_select.cc
+2
-0
sql/sql_union.cc
sql/sql_union.cc
+1
-1
sql/sql_update.cc
sql/sql_update.cc
+9
-6
sql/sql_yacc.yy
sql/sql_yacc.yy
+18
-9
No files found.
heap/hp_create.c
View file @
36429430
...
...
@@ -140,6 +140,7 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
share
->
auto_key
=
create_info
->
auto_key
;
share
->
auto_key_type
=
create_info
->
auto_key_type
;
share
->
auto_increment
=
create_info
->
auto_increment
;
/* Must be allocated separately for rename to work */
if
(
!
(
share
->
name
=
my_strdup
(
name
,
MYF
(
0
))))
{
my_free
((
gptr
)
share
,
MYF
(
0
));
...
...
heap/hp_update.c
View file @
36429430
...
...
@@ -62,7 +62,8 @@ int heap_update(HP_INFO *info, const byte *old, const byte *heap_new)
/* we don't need to delete non-inserted key from rb-tree */
if
((
*
keydef
->
write_key
)(
info
,
keydef
,
old
,
pos
))
{
if
(
++
(
share
->
records
)
==
share
->
blength
)
share
->
blength
+=
share
->
blength
;
if
(
++
(
share
->
records
)
==
share
->
blength
)
share
->
blength
+=
share
->
blength
;
DBUG_RETURN
(
my_errno
);
}
keydef
--
;
...
...
@@ -78,6 +79,7 @@ int heap_update(HP_INFO *info, const byte *old, const byte *heap_new)
keydef
--
;
}
}
if
(
++
(
share
->
records
)
==
share
->
blength
)
share
->
blength
+=
share
->
blength
;
if
(
++
(
share
->
records
)
==
share
->
blength
)
share
->
blength
+=
share
->
blength
;
DBUG_RETURN
(
my_errno
);
}
/* heap_update */
heap/hp_write.c
View file @
36429430
...
...
@@ -155,7 +155,7 @@ static byte *next_free_record_pos(HP_SHARE *info)
/* Write a hash-key to the hash-index */
int
hp_write_key
(
HP_INFO
*
info
,
HP_KEYDEF
*
keyinfo
,
const
byte
*
record
,
byte
*
recpos
)
const
byte
*
record
,
byte
*
recpos
)
{
HP_SHARE
*
share
=
info
->
s
;
int
flag
;
...
...
mysql-test/mysql-test-run.sh
View file @
36429430
...
...
@@ -19,7 +19,7 @@ TZ=GMT-3; export TZ # for UNIX_TIMESTAMP tests to work
# Program Definitions
#--
PATH
=
/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/openwin/bin:/usr/bin/X11
PATH
=
/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/openwin/bin:/usr/bin/X11
:
$PATH
MASTER_40_ARGS
=
"--rpl-recovery-rank=1 --init-rpl-role=master"
# Standard functions
...
...
@@ -319,8 +319,8 @@ while test $# -gt 0; do
VALGRIND
=
"valgrind --alignment=8 --leak-check=yes"
EXTRA_MASTER_MYSQLD_OPT
=
"
$EXTRA_MASTER_MYSQLD_OPT
--skip-safemalloc"
EXTRA_SLAVE_MYSQLD_OPT
=
"
$EXTRA_SLAVE_MYSQLD_OPT
--skip-safemalloc"
SLEEP_TIME_AFTER_RESTART
=
12
0
SLEEP_TIME_FOR_DELETE
=
12
0
SLEEP_TIME_AFTER_RESTART
=
6
0
SLEEP_TIME_FOR_DELETE
=
6
0
;;
--valgrind-options
=
*
)
TMP
=
`
$ECHO
"
$1
"
|
$SED
-e
"s;--valgrind-options=;;"
`
...
...
mysql-test/r/row_test.result
View file @
36429430
SELECT
(1,2,3)=
(1,2,3);
(1,2,3)=
(1,2,3)
SELECT
ROW(1,2,3)=ROW
(1,2,3);
ROW(1,2,3)=ROW
(1,2,3)
1
SELECT
(2,2,3)=
(1+1,2,3);
(2,2,3)=
(1+1,2,3)
SELECT
ROW(2,2,3)=ROW
(1+1,2,3);
ROW(2,2,3)=ROW
(1+1,2,3)
1
SELECT
(1,2,3)=
(1+1,2,3);
(1,2,3)=
(1+1,2,3)
SELECT
ROW(1,2,3)=ROW
(1+1,2,3);
ROW(1,2,3)=ROW
(1+1,2,3)
0
SELECT
(1,2,3)<
(1+1,2,3);
(1,2,3)<
(1+1,2,3)
SELECT
ROW(1,2,3)<ROW
(1+1,2,3);
ROW(1,2,3)<ROW
(1+1,2,3)
1
SELECT
(1,2,3)>
(1+1,2,3);
(1,2,3)>
(1+1,2,3)
SELECT
ROW(1,2,3)>ROW
(1+1,2,3);
ROW(1,2,3)>ROW
(1+1,2,3)
0
SELECT
(1,2,3)<=
(1+1,2,3);
(1,2,3)<=
(1+1,2,3)
SELECT
ROW(1,2,3)<=ROW
(1+1,2,3);
ROW(1,2,3)<=ROW
(1+1,2,3)
1
SELECT
(1,2,3)>=
(1+1,2,3);
(1,2,3)>=
(1+1,2,3)
SELECT
ROW(1,2,3)>=ROW
(1+1,2,3);
ROW(1,2,3)>=ROW
(1+1,2,3)
0
SELECT
(1,2,3)<>
(1+1,2,3);
(1,2,3)<>
(1+1,2,3)
SELECT
ROW(1,2,3)<>ROW
(1+1,2,3);
ROW(1,2,3)<>ROW
(1+1,2,3)
1
SELECT
(NULL,2,3)=
(NULL,2,3);
(NULL,2,3)=
(NULL,2,3)
SELECT
ROW(NULL,2,3)=ROW
(NULL,2,3);
ROW(NULL,2,3)=ROW
(NULL,2,3)
NULL
SELECT
(NULL,2,3)<=>
(NULL,2,3);
(NULL,2,3)<=>
(NULL,2,3)
SELECT
ROW(NULL,2,3)<=>ROW
(NULL,2,3);
ROW(NULL,2,3)<=>ROW
(NULL,2,3)
1
SELECT
(1,2,(3,4,5))=(1,2,
(3,4,5));
(1,2,(3,4,5))=(1,2,
(3,4,5))
SELECT
ROW(1,2,ROW(3,4,5))=ROW(1,2,ROW
(3,4,5));
ROW(1,2,ROW(3,4,5))=ROW(1,2,ROW
(3,4,5))
1
SELECT
('test',2,3.33)=
('test',2,3.33);
('test',2,3.33)=
('test',2,3.33)
SELECT
ROW('test',2,3.33)=ROW
('test',2,3.33);
ROW('test',2,3.33)=ROW
('test',2,3.33)
1
SELECT
('test',2,3.33)=
('test',2,3.33,4);
SELECT
ROW('test',2,3.33)=ROW
('test',2,3.33,4);
Cardinality error (more/less than 3 columns)
drop table if exists t1;
create table t1 ( a int, b int, c int);
insert into t1 values (1,2,3), (2,3,1), (3,2,1);
select * from t1 where
(1,2,3)=
(a,b,c);
select * from t1 where
ROW(1,2,3)=ROW
(a,b,c);
a b c
1 2 3
select * from t1 where
(0,2,3)=
(a,b,c);
select * from t1 where
ROW(0,2,3)=ROW
(a,b,c);
a b c
select * from t1 where
(1,2,3)<
(a,b,c);
select * from t1 where
ROW(1,2,3)<ROW
(a,b,c);
a b c
2 3 1
3 2 1
drop table t1;
select (1,1);
select
ROW
(1,1);
Cardinality error (more/less than 1 columns)
drop table if exists t1;
create table t1 (i int);
select 1 from t1 where (1,1);
select 1 from t1 where
ROW
(1,1);
Cardinality error (more/less than 1 columns)
select count(*) from t1 order by (1,1);
select count(*) from t1 order by
ROW
(1,1);
Cardinality error (more/less than 1 columns)
drop table t1;
mysql-test/r/subselect.result
View file @
36429430
...
...
@@ -413,6 +413,8 @@ a b
2 12
update t1 set b= (select b from t1);
INSERT TABLE 't1' isn't allowed in FROM table list
update t1 set b= (select b from t2);
Subselect returns more than 1 record
update t1 set b= (select b from t2 where t1.a = t2.a);
select * from t1;
a b
...
...
@@ -434,6 +436,8 @@ a b
2 12
delete from t1 where b = (select b from t1);
INSERT TABLE 't1' isn't allowed in FROM table list
delete from t1 where b = (select b from t2);
Subselect returns more than 1 record
delete from t1 where b = (select b from t2 where t1.a = t2.a);
select * from t1;
a b
...
...
@@ -459,6 +463,8 @@ a b
2 12
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
INSERT TABLE 't12' isn't allowed in FROM table list
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
Subselect returns more than 1 record
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
select * from t11;
a b
...
...
@@ -471,9 +477,13 @@ a b
drop table t11, t12, t2;
CREATE TABLE t1 (x int);
create table t2 (a int);
create table t3 (a int);
insert into t2 values (1);
insert into t3 values (1),(2);
INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
INSERT TABLE 't1' isn't allowed in FROM table list
INSERT INTO t1 (x) VALUES ((SELECT a FROM t3));
Subselect returns more than 1 record
INSERT INTO t1 (x) VALUES ((SELECT a FROM t2));
select * from t1;
x
...
...
@@ -501,14 +511,18 @@ x
3
3
0
drop table t1, t2;
drop table t1, t2
, t3
;
CREATE TABLE t1 (x int not null, y int, primary key (x));
create table t2 (a int);
create table t3 (a int);
insert into t2 values (1);
insert into t3 values (1),(2);
select * from t1;
x y
replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2));
INSERT TABLE 't1' isn't allowed in FROM table list
replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2));
Subselect returns more than 1 record
replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2));
select * from t1;
x y
...
...
@@ -533,7 +547,7 @@ x y
1 3
4 2
2 1
drop table t1, t2;
drop table t1, t2
, t3
;
SELECT * FROM (SELECT 1) b WHERE 1 IN (SELECT *);
No tables used
drop table if exists t;
...
...
@@ -575,4 +589,8 @@ SELECT * FROM t;
id
1
2
CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin1;
INSERT INTO t1 values (1),(1);
UPDATE t SET id=(SELECT * FROM t1);
Subselect returns more than 1 record
drop table t;
mysql-test/t/row_test.test
View file @
36429430
SELECT
(
1
,
2
,
3
)
=
(
1
,
2
,
3
);
SELECT
(
2
,
2
,
3
)
=
(
1
+
1
,
2
,
3
);
SELECT
(
1
,
2
,
3
)
=
(
1
+
1
,
2
,
3
);
SELECT
(
1
,
2
,
3
)
<
(
1
+
1
,
2
,
3
);
SELECT
(
1
,
2
,
3
)
>
(
1
+
1
,
2
,
3
);
SELECT
(
1
,
2
,
3
)
<=
(
1
+
1
,
2
,
3
);
SELECT
(
1
,
2
,
3
)
>=
(
1
+
1
,
2
,
3
);
SELECT
(
1
,
2
,
3
)
<>
(
1
+
1
,
2
,
3
);
SELECT
(
NULL
,
2
,
3
)
=
(
NULL
,
2
,
3
);
SELECT
(
NULL
,
2
,
3
)
<=>
(
NULL
,
2
,
3
);
SELECT
(
1
,
2
,(
3
,
4
,
5
))
=
(
1
,
2
,
(
3
,
4
,
5
));
SELECT
(
'test'
,
2
,
3.33
)
=
(
'test'
,
2
,
3.33
);
SELECT
ROW
(
1
,
2
,
3
)
=
ROW
(
1
,
2
,
3
);
SELECT
ROW
(
2
,
2
,
3
)
=
ROW
(
1
+
1
,
2
,
3
);
SELECT
ROW
(
1
,
2
,
3
)
=
ROW
(
1
+
1
,
2
,
3
);
SELECT
ROW
(
1
,
2
,
3
)
<
ROW
(
1
+
1
,
2
,
3
);
SELECT
ROW
(
1
,
2
,
3
)
>
ROW
(
1
+
1
,
2
,
3
);
SELECT
ROW
(
1
,
2
,
3
)
<=
ROW
(
1
+
1
,
2
,
3
);
SELECT
ROW
(
1
,
2
,
3
)
>=
ROW
(
1
+
1
,
2
,
3
);
SELECT
ROW
(
1
,
2
,
3
)
<>
ROW
(
1
+
1
,
2
,
3
);
SELECT
ROW
(
NULL
,
2
,
3
)
=
ROW
(
NULL
,
2
,
3
);
SELECT
ROW
(
NULL
,
2
,
3
)
<=>
ROW
(
NULL
,
2
,
3
);
SELECT
ROW
(
1
,
2
,
ROW
(
3
,
4
,
5
))
=
ROW
(
1
,
2
,
ROW
(
3
,
4
,
5
));
SELECT
ROW
(
'test'
,
2
,
3.33
)
=
ROW
(
'test'
,
2
,
3.33
);
--
error
1239
SELECT
(
'test'
,
2
,
3.33
)
=
(
'test'
,
2
,
3.33
,
4
);
SELECT
ROW
(
'test'
,
2
,
3.33
)
=
ROW
(
'test'
,
2
,
3.33
,
4
);
drop
table
if
exists
t1
;
create
table
t1
(
a
int
,
b
int
,
c
int
);
insert
into
t1
values
(
1
,
2
,
3
),
(
2
,
3
,
1
),
(
3
,
2
,
1
);
select
*
from
t1
where
(
1
,
2
,
3
)
=
(
a
,
b
,
c
);
select
*
from
t1
where
(
0
,
2
,
3
)
=
(
a
,
b
,
c
);
select
*
from
t1
where
(
1
,
2
,
3
)
<
(
a
,
b
,
c
);
select
*
from
t1
where
ROW
(
1
,
2
,
3
)
=
ROW
(
a
,
b
,
c
);
select
*
from
t1
where
ROW
(
0
,
2
,
3
)
=
ROW
(
a
,
b
,
c
);
select
*
from
t1
where
ROW
(
1
,
2
,
3
)
<
ROW
(
a
,
b
,
c
);
drop
table
t1
;
--
error
1239
select
(
1
,
1
);
select
ROW
(
1
,
1
);
drop
table
if
exists
t1
;
create
table
t1
(
i
int
);
--
error
1239
select
1
from
t1
where
(
1
,
1
);
select
1
from
t1
where
ROW
(
1
,
1
);
--
error
1239
select
count
(
*
)
from
t1
order
by
(
1
,
1
);
select
count
(
*
)
from
t1
order
by
ROW
(
1
,
1
);
#TODO remove comments after parser fixing
#-- error 1239
#select count(*) from t1 order by i having (1,1);
...
...
mysql-test/t/subselect.test
View file @
36429430
...
...
@@ -246,6 +246,8 @@ insert into t2 values (1, 21),(2, 22),(3, 23);
select
*
from
t1
;
--
error
1093
update
t1
set
b
=
(
select
b
from
t1
);
--
error
1240
update
t1
set
b
=
(
select
b
from
t2
);
update
t1
set
b
=
(
select
b
from
t2
where
t1
.
a
=
t2
.
a
);
select
*
from
t1
;
drop
table
t1
,
t2
;
...
...
@@ -259,6 +261,8 @@ select * from t1;
select
*
from
t1
where
b
=
(
select
b
from
t2
where
t1
.
a
=
t2
.
a
);
--
error
1093
delete
from
t1
where
b
=
(
select
b
from
t1
);
--
error
1240
delete
from
t1
where
b
=
(
select
b
from
t2
);
delete
from
t1
where
b
=
(
select
b
from
t2
where
t1
.
a
=
t2
.
a
);
select
*
from
t1
;
drop
table
t1
,
t2
;
...
...
@@ -275,6 +279,8 @@ select * from t11;
select
*
from
t12
;
--
error
1093
delete
t11
.*
,
t12
.*
from
t11
,
t12
where
t11
.
a
=
t12
.
a
and
t11
.
b
=
(
select
b
from
t12
where
t11
.
a
=
t12
.
a
);
--
error
1240
delete
t11
.*
,
t12
.*
from
t11
,
t12
where
t11
.
a
=
t12
.
a
and
t11
.
b
=
(
select
b
from
t2
);
delete
t11
.*
,
t12
.*
from
t11
,
t12
where
t11
.
a
=
t12
.
a
and
t11
.
b
=
(
select
b
from
t2
where
t11
.
a
=
t2
.
a
);
select
*
from
t11
;
select
*
from
t12
;
...
...
@@ -283,9 +289,13 @@ drop table t11, t12, t2;
#insert with subselects
CREATE
TABLE
t1
(
x
int
);
create
table
t2
(
a
int
);
create
table
t3
(
a
int
);
insert
into
t2
values
(
1
);
insert
into
t3
values
(
1
),(
2
);
--
error
1093
INSERT
INTO
t1
(
x
)
VALUES
((
SELECT
x
FROM
t1
));
--
error
1240
INSERT
INTO
t1
(
x
)
VALUES
((
SELECT
a
FROM
t3
));
INSERT
INTO
t1
(
x
)
VALUES
((
SELECT
a
FROM
t2
));
select
*
from
t1
;
insert
into
t2
values
(
1
);
...
...
@@ -299,15 +309,19 @@ INSERT INTO t1 (x) select (SELECT SUM(x)+2 FROM t1) FROM t2;
INSERT
DELAYED
INTO
t1
(
x
)
VALUES
((
SELECT
SUM
(
x
)
FROM
t2
));
--
sleep
1
select
*
from
t1
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
,
t3
;
#replace with subselects
CREATE
TABLE
t1
(
x
int
not
null
,
y
int
,
primary
key
(
x
));
create
table
t2
(
a
int
);
create
table
t3
(
a
int
);
insert
into
t2
values
(
1
);
insert
into
t3
values
(
1
),(
2
);
select
*
from
t1
;
--
error
1093
replace
into
t1
(
x
,
y
)
VALUES
((
SELECT
x
FROM
t1
),
(
SELECT
a
+
1
FROM
t2
));
--
error
1240
replace
into
t1
(
x
,
y
)
VALUES
((
SELECT
a
FROM
t3
),
(
SELECT
a
+
1
FROM
t2
));
replace
into
t1
(
x
,
y
)
VALUES
((
SELECT
a
FROM
t2
),
(
SELECT
a
+
1
FROM
t2
));
select
*
from
t1
;
replace
into
t1
(
x
,
y
)
VALUES
((
SELECT
a
FROM
t2
),
(
SELECT
a
+
2
FROM
t2
));
...
...
@@ -320,7 +334,7 @@ replace DELAYED into t1 (x, y) VALUES ((SELECT a+3 FROM t2), (SELECT a+1 FROM t2
select
*
from
t1
;
replace
LOW_PRIORITY
into
t1
(
x
,
y
)
VALUES
((
SELECT
a
+
1
FROM
t2
),
(
SELECT
a
FROM
t2
));
select
*
from
t1
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
,
t3
;
--
error
1096
SELECT
*
FROM
(
SELECT
1
)
b
WHERE
1
IN
(
SELECT
*
);
...
...
@@ -338,4 +352,8 @@ SELECT * FROM t WHERE id IN (SELECT 5 UNION SELECT 2);
--
error
1093
INSERT
INTO
t
VALUES
((
SELECT
*
FROM
t
));
SELECT
*
FROM
t
;
CREATE
TABLE
t1
(
id
int
(
11
)
default
NULL
,
KEY
id
(
id
))
TYPE
=
MyISAM
CHARSET
=
latin1
;
INSERT
INTO
t1
values
(
1
),(
1
);
--
error
1240
UPDATE
t
SET
id
=
(
SELECT
*
FROM
t1
);
drop
table
t
;
sql/item_sum.cc
View file @
36429430
...
...
@@ -41,7 +41,7 @@ Item_sum::Item_sum(List<Item> &list)
list
.
empty
();
// Fields are used
}
inline
void
Item_sum
::
mark_as_sum_func
()
void
Item_sum
::
mark_as_sum_func
()
{
current_thd
->
lex
.
current_select
->
with_sum_func
=
with_sum_func
=
1
;
}
...
...
sql/item_sum.h
View file @
36429430
...
...
@@ -34,7 +34,7 @@ class Item_sum :public Item_result_field
uint
arg_count
;
bool
quick_group
;
/* If incremental update of fields */
inline
void
mark_as_sum_func
();
void
mark_as_sum_func
();
Item_sum
()
:
arg_count
(
0
),
quick_group
(
1
)
{
mark_as_sum_func
();
...
...
sql/sql_class.cc
View file @
36429430
...
...
@@ -142,8 +142,6 @@ THD::THD():user_time(0), fatal_error(0),
bzero
((
char
*
)
&
con_root
,
sizeof
(
con_root
));
bzero
((
char
*
)
&
warn_root
,
sizeof
(
warn_root
));
init_alloc_root
(
&
warn_root
,
1024
,
0
);
bzero
((
char
*
)
warn_count
,
sizeof
(
warn_count
));
warn_list
.
empty
();
user_connect
=
(
USER_CONN
*
)
0
;
hash_init
(
&
user_vars
,
system_charset_info
,
USER_VARS_HASH_SIZE
,
0
,
0
,
(
hash_get_key
)
get_var_key
,
...
...
@@ -187,17 +185,20 @@ THD::THD():user_time(0), fatal_error(0),
void
THD
::
init
(
void
)
{
pthread_mutex_lock
(
&
LOCK_global_system_variables
);
variables
=
global_system_variables
;
pthread_mutex_unlock
(
&
LOCK_global_system_variables
);
server_status
=
SERVER_STATUS_AUTOCOMMIT
;
update_lock_default
=
(
variables
.
low_priority_updates
?
TL_WRITE_LOW_PRIORITY
:
TL_WRITE
);
options
=
thd_startup_options
;
sql_mode
=
(
uint
)
opt_sql_mode
;
open_options
=
ha_open_options
;
pthread_mutex_lock
(
&
LOCK_global_system_variables
);
variables
=
global_system_variables
;
pthread_mutex_unlock
(
&
LOCK_global_system_variables
);
update_lock_default
=
(
variables
.
low_priority_updates
?
TL_WRITE_LOW_PRIORITY
:
TL_WRITE
);
session_tx_isolation
=
(
enum_tx_isolation
)
variables
.
tx_isolation
;
warn_list
.
empty
();
bzero
((
char
*
)
warn_count
,
sizeof
(
warn_count
));
total_warn_count
=
0
;
}
/*
...
...
@@ -228,6 +229,7 @@ void THD::cleanup(void)
{
DBUG_ENTER
(
"THD::cleanup"
);
ha_rollback
(
this
);
delete_tree
(
&
prepared_statements
);
if
(
locked_tables
)
{
lock
=
locked_tables
;
locked_tables
=
0
;
...
...
@@ -289,7 +291,6 @@ THD::~THD()
free_root
(
&
con_root
,
MYF
(
0
));
free_root
(
&
warn_root
,
MYF
(
0
));
free_root
(
&
transaction
.
mem_root
,
MYF
(
0
));
delete_tree
(
&
prepared_statements
);
mysys_var
=
0
;
// Safety (shouldn't be needed)
pthread_mutex_destroy
(
&
LOCK_delete
);
#ifndef DBUG_OFF
...
...
sql/sql_delete.cc
View file @
36429430
...
...
@@ -140,9 +140,11 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
deleted
=
0L
;
init_ftfuncs
(
thd
,
&
thd
->
lex
.
select_lex
,
1
);
thd
->
proc_info
=
"updating"
;
while
(
!
(
error
=
info
.
read_record
(
&
info
))
&&
!
thd
->
killed
)
while
(
!
(
error
=
info
.
read_record
(
&
info
))
&&
!
thd
->
killed
&&
!
thd
->
net
.
report_error
)
{
if
(
!
(
select
&&
select
->
skipp_record
()))
// thd->net.report_error is tested to disallow delete row on error
if
(
!
(
select
&&
select
->
skipp_record
())
&&
!
thd
->
net
.
report_error
)
{
if
(
!
(
error
=
table
->
file
->
delete_row
(
table
->
record
[
0
])))
{
...
...
@@ -205,7 +207,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
thd
->
lock
=
0
;
}
delete
select
;
if
(
error
>=
0
)
// Fatal error
if
(
error
>=
0
||
thd
->
net
.
report_error
)
send_error
(
thd
,
thd
->
killed
?
ER_SERVER_SHUTDOWN
:
0
);
else
{
...
...
sql/sql_insert.cc
View file @
36429430
...
...
@@ -235,9 +235,10 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
if
(
fields
.
elements
||
!
value_count
)
{
restore_record
(
table
,
2
);
// Get empty record
if
(
fill_record
(
fields
,
*
values
)
||
check_null_fields
(
thd
,
table
))
if
(
fill_record
(
fields
,
*
values
)
||
thd
->
net
.
report_error
||
check_null_fields
(
thd
,
table
))
{
if
(
values_list
.
elements
!=
1
)
if
(
values_list
.
elements
!=
1
&&
!
thd
->
net
.
report_error
)
{
info
.
records
++
;
continue
;
...
...
@@ -252,9 +253,9 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
restore_record
(
table
,
2
);
// Get empty record
else
table
->
record
[
0
][
0
]
=
table
->
record
[
2
][
0
];
// Fix delete marker
if
(
fill_record
(
table
->
field
,
*
values
))
if
(
fill_record
(
table
->
field
,
*
values
)
||
thd
->
net
.
report_error
)
{
if
(
values_list
.
elements
!=
1
)
if
(
values_list
.
elements
!=
1
&&
!
thd
->
net
.
report_error
)
{
info
.
records
++
;
continue
;
...
...
@@ -1349,7 +1350,7 @@ bool select_insert::send_data(List<Item> &values)
fill_record
(
*
fields
,
values
);
else
fill_record
(
table
->
field
,
values
);
if
(
write_record
(
table
,
&
info
))
if
(
thd
->
net
.
report_error
||
write_record
(
table
,
&
info
))
return
1
;
if
(
table
->
next_number_field
)
// Clear for next record
{
...
...
@@ -1463,7 +1464,7 @@ bool select_create::send_data(List<Item> &values)
return
0
;
}
fill_record
(
field
,
values
);
if
(
write_record
(
table
,
&
info
))
if
(
thd
->
net
.
report_error
||
write_record
(
table
,
&
info
))
return
1
;
if
(
table
->
next_number_field
)
// Clear for next record
{
...
...
sql/sql_lex.cc
View file @
36429430
...
...
@@ -458,7 +458,7 @@ int yylex(void *arg, void *yythd)
LINT_INIT
(
c
);
for
(;;)
{
switch
(
state
)
{
switch
(
state
)
{
case
STATE_OPERATOR_OR_IDENT
:
// Next is operator or keyword
case
STATE_START
:
// Start of token
// Skip startspace
...
...
@@ -900,7 +900,8 @@ int yylex(void *arg, void *yythd)
return
((
int
)
'@'
);
case
STATE_HOSTNAME
:
// end '@' of user@hostname
for
(
c
=
yyGet
()
;
my_isalnum
(
system_charset_info
,
c
)
||
c
==
'.'
||
c
==
'_'
||
c
==
'$'
;
my_isalnum
(
system_charset_info
,
c
)
||
c
==
'.'
||
c
==
'_'
||
c
==
'$'
;
c
=
yyGet
())
;
yylval
->
lex_str
=
get_token
(
lex
,
yyLength
());
return
(
LEX_HOSTNAME
);
...
...
sql/sql_parse.cc
View file @
36429430
...
...
@@ -1900,6 +1900,8 @@ mysql_execute_command(THD *thd)
(
ORDER
*
)
select_lex
->
order_list
.
first
,
select_lex
->
select_limit
,
lex
->
duplicates
);
if
(
thd
->
net
.
report_error
)
res
=
-
1
;
break
;
case
SQLCOM_UPDATE_MULTI
:
if
(
check_access
(
thd
,
UPDATE_ACL
,
tables
->
db
,
&
tables
->
grant
.
privilege
))
...
...
@@ -1959,6 +1961,8 @@ mysql_execute_command(THD *thd)
SELECT_NO_JOIN_CACHE
,
result
,
unit
,
select_lex
,
0
);
delete
result
;
if
(
thd
->
net
.
report_error
)
res
=
-
1
;
}
else
res
=
-
1
;
// Error is not sent
...
...
@@ -1976,6 +1980,8 @@ mysql_execute_command(THD *thd)
goto
error
;
res
=
mysql_insert
(
thd
,
tables
,
lex
->
field_list
,
lex
->
many_values
,
lex
->
duplicates
);
if
(
thd
->
net
.
report_error
)
res
=
-
1
;
break
;
}
case
SQLCOM_REPLACE_SELECT
:
...
...
@@ -2020,6 +2026,8 @@ mysql_execute_command(THD *thd)
if
((
result
=
new
select_insert
(
tables
->
table
,
&
lex
->
field_list
,
lex
->
duplicates
)))
res
=
handle_select
(
thd
,
lex
,
result
);
if
(
thd
->
net
.
report_error
)
res
=
-
1
;
}
else
res
=
-
1
;
...
...
@@ -2050,6 +2058,8 @@ mysql_execute_command(THD *thd)
res
=
mysql_delete
(
thd
,
tables
,
select_lex
->
where
,
(
ORDER
*
)
select_lex
->
order_list
.
first
,
select_lex
->
select_limit
,
select_lex
->
options
);
if
(
thd
->
net
.
report_error
)
res
=
-
1
;
break
;
}
case
SQLCOM_DELETE_MULTI
:
...
...
@@ -2122,6 +2132,8 @@ mysql_execute_command(THD *thd)
select_lex
->
options
|
thd
->
options
|
SELECT_NO_JOIN_CACHE
,
result
,
unit
,
select_lex
,
0
);
if
(
thd
->
net
.
report_error
)
res
=
-
1
;
delete
result
;
}
else
...
...
sql/sql_select.cc
View file @
36429430
...
...
@@ -4115,6 +4115,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
keyinfo
->
usable_key_parts
=
keyinfo
->
key_parts
=
param
->
group_parts
;
keyinfo
->
key_length
=
0
;
keyinfo
->
rec_per_key
=
0
;
keyinfo
->
algorithm
=
HA_KEY_ALG_UNDEF
;
for
(;
group
;
group
=
group
->
next
,
key_part_info
++
)
{
Field
*
field
=
(
*
group
->
item
)
->
tmp_table_field
();
...
...
@@ -4191,6 +4192,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
keyinfo
->
flags
=
HA_NOSAME
|
HA_NULL_ARE_EQUAL
;
keyinfo
->
key_length
=
(
uint16
)
reclength
;
keyinfo
->
name
=
(
char
*
)
"tmp"
;
keyinfo
->
algorithm
=
HA_KEY_ALG_UNDEF
;
if
(
null_pack_length
)
{
key_part_info
->
null_bit
=
0
;
...
...
sql/sql_union.cc
View file @
36429430
...
...
@@ -76,7 +76,7 @@ bool select_union::send_data(List<Item> &values)
return
0
;
}
fill_record
(
table
->
field
,
values
);
if
(
(
write_record
(
table
,
&
info
)
))
if
(
thd
->
net
.
report_error
||
write_record
(
table
,
&
info
))
{
if
(
thd
->
net
.
last_errno
==
ER_RECORD_FILE_FULL
)
{
...
...
sql/sql_update.cc
View file @
36429430
...
...
@@ -281,7 +281,7 @@ int mysql_update(THD *thd,
if
(
!
(
select
&&
select
->
skipp_record
()))
{
store_record
(
table
,
1
);
if
(
fill_record
(
fields
,
values
))
if
(
fill_record
(
fields
,
values
)
||
thd
->
net
.
report_error
)
break
;
/* purecov: inspected */
found
++
;
if
(
compare_record
(
table
,
query_id
))
...
...
@@ -605,7 +605,7 @@ bool multi_update::send_data(List<Item> &values)
// Only one table being updated receives a completely different treatment
table
->
status
|=
STATUS_UPDATED
;
store_record
(
table
,
1
);
if
(
fill_record
(
fields
,
real_values
))
if
(
fill_record
(
fields
,
real_values
)
||
thd
->
net
.
report_error
)
return
1
;
found
++
;
if
(
/* compare_record(table, query_id) && */
...
...
@@ -644,7 +644,8 @@ bool multi_update::send_data(List<Item> &values)
{
table
->
status
|=
STATUS_UPDATED
;
store_record
(
table
,
1
);
if
(
fill_record
(
*
fields_by_tables
[
0
],
values_by_table
))
if
(
fill_record
(
*
fields_by_tables
[
0
],
values_by_table
)
||
thd
->
net
.
report_error
)
return
1
;
found
++
;
if
(
/*compare_record(table, query_id) && */
...
...
@@ -667,8 +668,8 @@ bool multi_update::send_data(List<Item> &values)
table
->
file
->
ref_length
,
system_charset_info
));
fill_record
(
tmp_tables
[
secure_counter
]
->
field
,
values_by_table
);
error
=
write_record
(
tmp_tables
[
secure_counter
],
&
(
infos
[
secure_counter
]));
error
=
thd
->
net
.
report_error
||
write_record
(
tmp_tables
[
secure_counter
],
&
(
infos
[
secure_counter
]));
if
(
error
)
{
error
=-
1
;
...
...
@@ -774,8 +775,10 @@ int multi_update::do_updates (bool from_send_error)
table
->
status
|=
STATUS_UPDATED
;
store_record
(
table
,
1
);
local_error
=
(
fill_record
(
*
fields_by_tables
[
counter
+
1
],
list
)
||
thd
->
net
.
report_error
||
/* compare_record(table, query_id) || */
table
->
file
->
update_row
(
table
->
record
[
1
],
table
->
record
[
0
]));
table
->
file
->
update_row
(
table
->
record
[
1
],
table
->
record
[
0
]));
if
(
local_error
)
{
table
->
file
->
print_error
(
local_error
,
MYF
(
0
));
...
...
sql/sql_yacc.yy
View file @
36429430
...
...
@@ -1979,10 +1979,12 @@ simple_expr:
| NOT expr %prec NEG { $$= new Item_func_not($2); }
| '!' expr %prec NEG { $$= new Item_func_not($2); }
| '(' expr ')' { $$= $2; }
| '(' expr ',' expr_list ')'
/* Note: In SQL-99 "ROW" is optional, but not having it mandatory
causes conflicts with the INTERVAL syntax. */
| ROW_SYM '(' expr ',' expr_list ')'
{
$
4->push_front($2
);
$$= new Item_row(*$
4
);
$
5->push_front($3
);
$$= new Item_row(*$
5
);
}
| EXISTS exists_subselect { $$= $2; }
| singleval_subselect { $$= $1; }
...
...
@@ -2680,7 +2682,11 @@ order_dir:
opt_limit_clause:
/* empty */ {}
| LIMIT
| limit_clause {}
;
limit_clause:
LIMIT
{
LEX *lex= Lex;
if (lex->current_select->linkage != GLOBAL_OPTIONS_TYPE &&
...
...
@@ -4378,10 +4384,7 @@ union_opt:
;
optional_order_or_limit:
/* empty
intentional reduce/reduce conflict here !!!
{ code } below should not be executed
when neither ORDER BY nor LIMIT are used */ {}
/* Empty */ {}
|
{
LEX *lex=Lex;
...
...
@@ -4397,7 +4400,13 @@ optional_order_or_limit:
lex->current_select->select_limit=
lex->thd->variables.select_limit;
}
opt_order_clause opt_limit_clause
order_or_limit
;
order_or_limit:
order_clause opt_limit_clause
|
limit_clause
;
union_option:
...
...
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