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
05d4ed14
Commit
05d4ed14
authored
Mar 31, 2005
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Plain Diff
merge 4.1->5.0
parents
8098ef79
7647ac83
Changes
24
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
2021 additions
and
547 deletions
+2021
-547
Build-tools/Bootstrap
Build-tools/Bootstrap
+28
-14
mysql-test/r/func_group.result
mysql-test/r/func_group.result
+1
-1
mysql-test/r/group_by.result
mysql-test/r/group_by.result
+25
-0
mysql-test/r/metadata.result
mysql-test/r/metadata.result
+26
-1
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+432
-2
mysql-test/r/union.result
mysql-test/r/union.result
+38
-3
mysql-test/t/group_by.test
mysql-test/t/group_by.test
+25
-0
mysql-test/t/metadata.test
mysql-test/t/metadata.test
+13
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+188
-2
mysql-test/t/union.test
mysql-test/t/union.test
+25
-0
sql/field.cc
sql/field.cc
+794
-194
sql/field.h
sql/field.h
+13
-36
sql/item.cc
sql/item.cc
+216
-167
sql/item.h
sql/item.h
+16
-16
sql/item_func.h
sql/item_func.h
+2
-1
sql/item_subselect.cc
sql/item_subselect.cc
+143
-82
sql/item_subselect.h
sql/item_subselect.h
+4
-3
sql/sql_derived.cc
sql/sql_derived.cc
+1
-1
sql/sql_lex.h
sql/sql_lex.h
+2
-1
sql/sql_parse.cc
sql/sql_parse.cc
+2
-4
sql/sql_prepare.cc
sql/sql_prepare.cc
+2
-2
sql/sql_select.cc
sql/sql_select.cc
+16
-10
sql/sql_union.cc
sql/sql_union.cc
+6
-6
support-files/mysql.server.sh
support-files/mysql.server.sh
+3
-1
No files found.
Build-tools/Bootstrap
View file @
05d4ed14
...
@@ -240,40 +240,52 @@ if (defined $opt_changelog)
...
@@ -240,40 +240,52 @@ if (defined $opt_changelog)
# the last tagged ChangeSet (this relies heavily on our current tagging
# the last tagged ChangeSet (this relies heavily on our current tagging
# practice!)
# practice!)
#
#
my
$revision
=
"";
$opt_changelog
=~
s/^=//
;
# Sometimes, a leading '=' was not stripped.
my
$log_base
=
$opt_changelog
;
my
$changelogfile
;
if
(
$target_dir
=~
m:^/:
)
# we need an absolute path, as we change directory
{
$changelogfile
=
$target_dir
.
"
/ChangeLog
";
}
else
{
$changelogfile
=
cwd
()
.
"
/
"
.
$target_dir
.
"
/ChangeLog
";
}
if
(
$opt_changelog
eq
"
last
")
if
(
$opt_changelog
eq
"
last
")
{
{
if
(
!
$opt_revision
)
if
(
!
$opt_revision
)
{
{
$
revision
=
`
bk changes -t -d':REV:::TAG:' -n
$REPO
| grep mysql-
$major
.
$minor
| head -1 | cut -f1 -d ":"
`;
$
log_base
=
`
bk changes -t -d':REV:::TAG:' -n
$REPO
| grep mysql-
$major
.
$minor
| head -1 | cut -f1 -d ":"
`;
}
}
else
else
{
{
$
revision
=
`
bk changes -r..
$opt_revision
-t -d':REV:' -n
$REPO
| head -2 | tail -1
`;
$
log_base
=
`
bk changes -r..
$opt_revision
-t -d':REV:' -n
$REPO
| head -2 | tail -1
`;
}
}
chomp
(
$revision
);
chomp
(
$log_base
);
$opt_changelog
=
$revision
;
}
}
$msg
=
"
Adding
$
target_dir
/ChangeLog
";
$msg
=
"
Adding
$
changelogfile
";
$msg
.=
"
(down to revision
$
opt_changelog
)
"
if
$opt_changelog
ne
"";
$msg
.=
"
(down to revision
$
log_base
)
"
if
$log_base
ne
"";
&
logger
(
$msg
);
&
logger
(
$msg
);
$command
=
"
bk changes -v
";
# Due to a BK error, "bk changes" must be run in $REPO !
$command
.=
"
-r
"
if
(
$opt_changelog
ne
""
||
$opt_revision
);
$command
=
"
cd
$REPO
;
";
$command
.=
$opt_changelog
if
$opt_changelog
ne
"";
$command
.=
"
bk changes -v
";
$command
.=
"
..
"
if
(
$opt_changelog
ne
""
&&
!
$opt_revision
);
$command
.=
"
-r
"
if
(
$log_base
ne
""
||
$opt_revision
);
$command
.=
$log_base
if
$log_base
ne
"";
$command
.=
"
..
"
if
(
$log_base
ne
""
&&
!
$opt_revision
);
$command
.=
"
..
"
.
$opt_revision
if
$opt_revision
;
$command
.=
"
..
"
.
$opt_revision
if
$opt_revision
;
$command
.=
"
"
.
$REPO
.
"
>
$target_dir
/ChangeLog
";
$command
.=
"
>
$changelogfile
";
&
logger
(
$command
);
&
logger
(
$command
);
# We cannot use run_command here because of output redirection
# We cannot use run_command here because of output redirection
unless
(
$opt_dry_run
)
unless
(
$opt_dry_run
)
{
{
system
(
$command
)
==
0
or
&
abort
("
Could not create
$
target_dir
/ChangeLog
!
");
system
(
$command
)
==
0
or
&
abort
("
Could not create
$
changelogfile
!
");
}
}
}
}
#
#
# Add the latest manual from the mysqldoc tree
# Add the latest manual
and tool
from the mysqldoc tree
#
#
unless
(
$opt_skip_manual
)
unless
(
$opt_skip_manual
)
{
{
...
@@ -283,6 +295,8 @@ unless ($opt_skip_manual)
...
@@ -283,6 +295,8 @@ unless ($opt_skip_manual)
system
("
bk cat
$opt_docdir
/Docs/
$file
.texi >
$target_dir
/Docs/
$file
.texi
")
==
0
system
("
bk cat
$opt_docdir
/Docs/
$file
.texi >
$target_dir
/Docs/
$file
.texi
")
==
0
or
&
abort
("
Could not update
$file
.texi in
$target_dir
/Docs/!
");
or
&
abort
("
Could not update
$file
.texi in
$target_dir
/Docs/!
");
}
}
&
run_command
("
cp
$opt_docdir
/Docs/Support/texi2html
$target_dir
/Docs/Support
",
"
Could not copy
$opt_docdir
/Docs/Support/texi2html!
");
&
run_command
("
rm -f
$target_dir
/Docs/Images/Makefile*
",
&
run_command
("
rm -f
$target_dir
/Docs/Images/Makefile*
",
"
Could not remove Makefiles in
$target_dir
/Docs/Images/!
");
"
Could not remove Makefiles in
$target_dir
/Docs/Images/!
");
...
...
mysql-test/r/func_group.result
View file @
05d4ed14
...
@@ -783,7 +783,7 @@ insert into t1 values (now());
...
@@ -783,7 +783,7 @@ insert into t1 values (now());
create table t2 select f2 from (select max(now()) f2 from t1) a;
create table t2 select f2 from (select max(now()) f2 from t1) a;
show columns from t2;
show columns from t2;
Field Type Null Key Default Extra
Field Type Null Key Default Extra
f2 datetime
NO 0000-00-00 00:00:00
f2 datetime
YES NULL
drop table t2;
drop table t2;
create table t2 select f2 from (select now() f2 from t1) a;
create table t2 select f2 from (select now() f2 from t1) a;
show columns from t2;
show columns from t2;
...
...
mysql-test/r/group_by.result
View file @
05d4ed14
...
@@ -677,3 +677,28 @@ select sum(a)*sum(b) as d from t1 where a=1 group by c having d > 0;
...
@@ -677,3 +677,28 @@ select sum(a)*sum(b) as d from t1 where a=1 group by c having d > 0;
d
d
10
10
drop table t1;
drop table t1;
create table t1(a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(8),(9);
create table t2 (
a int,
b varchar(200) NOT NULL,
c varchar(50) NOT NULL,
d varchar(100) NOT NULL,
primary key (a,b(132),c,d),
key a (a,b)
) charset=utf8;
insert into t2 select
x3.a, -- 3
concat('val-', x3.a + 3*x4.a), -- 12
concat('val-', @a:=x3.a + 3*x4.a + 12*C.a), -- 120
concat('val-', @a + 120*D.a)
from t1 x3, t1 x4, t1 C, t1 D where x3.a < 3 and x4.a < 4 and D.a < 4;
delete from t2 where a = 2 and b = 'val-2' limit 30;
explain select c from t2 where a = 2 and b = 'val-2' group by c;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref PRIMARY,a PRIMARY 400 const,const 6 Using where
select c from t2 where a = 2 and b = 'val-2' group by c;
c
val-74
val-98
drop table t1,t2;
mysql-test/r/metadata.result
View file @
05d4ed14
...
@@ -55,8 +55,33 @@ id data data
...
@@ -55,8 +55,33 @@ id data data
2 female no
2 female no
select t1.id from t1 union select t2.id from t2;
select t1.id from t1 union select t2.id from t2;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def
test t1 t1 id id 1 3
1 Y 32768 0 63
def
id id 1 4
1 Y 32768 0 63
id
id
1
1
2
2
drop table t1,t2;
drop table t1,t2;
create table t1 ( a int, b varchar(30), primary key(a));
insert into t1 values (1,'one');
insert into t1 values (2,'two');
set @arg00=1 ;
select @arg00 FROM t1 where a=1 union distinct select 1 FROM t1 where a=1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def @arg00 @arg00 8 20 1 Y 32768 0 63
@arg00
1
select * from (select @arg00) aaa;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def aaa @arg00 @arg00 8 20 1 Y 32768 0 63
@arg00
1
select 1 union select 1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def 1 1 8 20 1 N 32769 0 63
1
1
select * from (select 1 union select 1) aaa;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def aaa 1 1 8 20 1 N 32769 0 63
1
1
drop table t1;
mysql-test/r/subselect.result
View file @
05d4ed14
This diff is collapsed.
Click to expand it.
mysql-test/r/union.result
View file @
05d4ed14
...
@@ -732,7 +732,7 @@ tetetetetest
...
@@ -732,7 +732,7 @@ tetetetetest
show create table t1;
show create table t1;
Table Create Table
Table Create Table
t1 CREATE TABLE `t1` (
t1 CREATE TABLE `t1` (
`dt` blob
`dt`
long
blob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
drop table t1;
create table t1 SELECT sv from t2 UNION select b from t2;
create table t1 SELECT sv from t2 UNION select b from t2;
...
@@ -755,7 +755,7 @@ tetetetetest
...
@@ -755,7 +755,7 @@ tetetetetest
show create table t1;
show create table t1;
Table Create Table
Table Create Table
t1 CREATE TABLE `t1` (
t1 CREATE TABLE `t1` (
`i` blob
`i`
long
blob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
drop table t1;
create table t1 SELECT sv from t2 UNION select tx from t2;
create table t1 SELECT sv from t2 UNION select tx from t2;
...
@@ -766,7 +766,7 @@ teeeeeeeeeeeest
...
@@ -766,7 +766,7 @@ teeeeeeeeeeeest
show create table t1;
show create table t1;
Table Create Table
Table Create Table
t1 CREATE TABLE `t1` (
t1 CREATE TABLE `t1` (
`sv` text
`sv`
long
text
) ENGINE=MyISAM DEFAULT CHARSET=latin1
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
drop table t1;
create table t1 SELECT b from t2 UNION select tx from t2;
create table t1 SELECT b from t2 UNION select tx from t2;
...
@@ -1200,3 +1200,38 @@ select concat('value is: ', @val) union select 'some text';
...
@@ -1200,3 +1200,38 @@ select concat('value is: ', @val) union select 'some text';
concat('value is: ', @val)
concat('value is: ', @val)
value is: 6
value is: 6
some text
some text
CREATE TABLE t1 (
a ENUM('','','') character set utf8 not null default '',
b ENUM("one", "two") character set utf8,
c ENUM("one", "two")
);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` enum('','','') character set utf8 NOT NULL default '',
`b` enum('one','two') character set utf8 default NULL,
`c` enum('one','two') default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ('', 'one', 'one'), ('', 'two', 'one'), ('', NULL, NULL);
create table t2 select NULL union select a from t1;
show columns from t2;
Field Type Null Key Default Extra
NULL enum('','','') YES NULL
drop table t2;
create table t2 select a from t1 union select NULL;
show columns from t2;
Field Type Null Key Default Extra
a enum('','','') YES NULL
drop table t2;
create table t2 select a from t1 union select a from t1;
show columns from t2;
Field Type Null Key Default Extra
a char(1)
drop table t2;
create table t2 select a from t1 union select c from t1;
ERROR HY000: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation 'UNION'
create table t2 select a from t1 union select b from t1;
show columns from t2;
Field Type Null Key Default Extra
a varchar(3) YES NULL
drop table t2, t1;
mysql-test/t/group_by.test
View file @
05d4ed14
...
@@ -489,3 +489,28 @@ select a,sum(b) from t1 where a=1 group by c having a=1;
...
@@ -489,3 +489,28 @@ select a,sum(b) from t1 where a=1 group by c having a=1;
select
a
as
d
,
sum
(
b
)
from
t1
where
a
=
1
group
by
c
having
d
=
1
;
select
a
as
d
,
sum
(
b
)
from
t1
where
a
=
1
group
by
c
having
d
=
1
;
select
sum
(
a
)
*
sum
(
b
)
as
d
from
t1
where
a
=
1
group
by
c
having
d
>
0
;
select
sum
(
a
)
*
sum
(
b
)
as
d
from
t1
where
a
=
1
group
by
c
having
d
>
0
;
drop
table
t1
;
drop
table
t1
;
# Test for BUG#9213 GROUP BY query on utf-8 key returns wrong results
create
table
t1
(
a
int
);
insert
into
t1
values
(
0
),(
1
),(
2
),(
3
),(
4
),(
5
),(
6
),(
8
),(
9
);
create
table
t2
(
a
int
,
b
varchar
(
200
)
NOT
NULL
,
c
varchar
(
50
)
NOT
NULL
,
d
varchar
(
100
)
NOT
NULL
,
primary
key
(
a
,
b
(
132
),
c
,
d
),
key
a
(
a
,
b
)
)
charset
=
utf8
;
insert
into
t2
select
x3
.
a
,
--
3
concat
(
'val-'
,
x3
.
a
+
3
*
x4
.
a
),
--
12
concat
(
'val-'
,
@
a
:=
x3
.
a
+
3
*
x4
.
a
+
12
*
C
.
a
),
--
120
concat
(
'val-'
,
@
a
+
120
*
D
.
a
)
from
t1
x3
,
t1
x4
,
t1
C
,
t1
D
where
x3
.
a
<
3
and
x4
.
a
<
4
and
D
.
a
<
4
;
delete
from
t2
where
a
=
2
and
b
=
'val-2'
limit
30
;
explain
select
c
from
t2
where
a
=
2
and
b
=
'val-2'
group
by
c
;
select
c
from
t2
where
a
=
2
and
b
=
'val-2'
group
by
c
;
drop
table
t1
,
t2
;
mysql-test/t/metadata.test
View file @
05d4ed14
...
@@ -34,4 +34,17 @@ select t1.id, t1.data, t2.data from t1, t2 where t1.id = t2.id order by t1.id;
...
@@ -34,4 +34,17 @@ select t1.id, t1.data, t2.data from t1, t2 where t1.id = t2.id order by t1.id;
select
t1
.
id
from
t1
union
select
t2
.
id
from
t2
;
select
t1
.
id
from
t1
union
select
t2
.
id
from
t2
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
#
# variables union and derived tables metadata test
#
create
table
t1
(
a
int
,
b
varchar
(
30
),
primary
key
(
a
));
insert
into
t1
values
(
1
,
'one'
);
insert
into
t1
values
(
2
,
'two'
);
set
@
arg00
=
1
;
select
@
arg00
FROM
t1
where
a
=
1
union
distinct
select
1
FROM
t1
where
a
=
1
;
select
*
from
(
select
@
arg00
)
aaa
;
select
1
union
select
1
;
select
*
from
(
select
1
union
select
1
)
aaa
;
drop
table
t1
;
--
disable_metadata
--
disable_metadata
mysql-test/t/subselect.test
View file @
05d4ed14
This diff is collapsed.
Click to expand it.
mysql-test/t/union.test
View file @
05d4ed14
...
@@ -735,3 +735,28 @@ drop table t1;
...
@@ -735,3 +735,28 @@ drop table t1;
#
#
set
@
val
:=
6
;
set
@
val
:=
6
;
select
concat
(
'value is: '
,
@
val
)
union
select
'some text'
;
select
concat
(
'value is: '
,
@
val
)
union
select
'some text'
;
#
# Enum merging test
#
CREATE
TABLE
t1
(
a
ENUM
(
''
,
''
,
''
)
character
set
utf8
not
null
default
''
,
b
ENUM
(
"one"
,
"two"
)
character
set
utf8
,
c
ENUM
(
"one"
,
"two"
)
);
show
create
table
t1
;
insert
into
t1
values
(
''
,
'one'
,
'one'
),
(
''
,
'two'
,
'one'
),
(
''
,
NULL
,
NULL
);
create
table
t2
select
NULL
union
select
a
from
t1
;
show
columns
from
t2
;
drop
table
t2
;
create
table
t2
select
a
from
t1
union
select
NULL
;
show
columns
from
t2
;
drop
table
t2
;
create
table
t2
select
a
from
t1
union
select
a
from
t1
;
show
columns
from
t2
;
drop
table
t2
;
--
error
1267
create
table
t2
select
a
from
t1
union
select
c
from
t1
;
create
table
t2
select
a
from
t1
union
select
b
from
t1
;
show
columns
from
t2
;
drop
table
t2
,
t1
;
sql/field.cc
View file @
05d4ed14
This diff is collapsed.
Click to expand it.
sql/field.h
View file @
05d4ed14
...
@@ -31,6 +31,17 @@ class Protocol;
...
@@ -31,6 +31,17 @@ class Protocol;
struct
st_cache_field
;
struct
st_cache_field
;
void
field_conv
(
Field
*
to
,
Field
*
from
);
void
field_conv
(
Field
*
to
,
Field
*
from
);
inline
uint
get_enum_pack_length
(
int
elements
)
{
return
elements
<
256
?
1
:
2
;
}
inline
uint
get_set_pack_length
(
int
elements
)
{
uint
len
=
(
elements
+
7
)
/
8
;
return
len
>
4
?
8
:
len
;
}
class
Field
class
Field
{
{
Field
(
const
Item
&
);
/* Prevent use of these */
Field
(
const
Item
&
);
/* Prevent use of these */
...
@@ -71,18 +82,6 @@ public:
...
@@ -71,18 +82,6 @@ public:
GEOM_GEOMETRYCOLLECTION
=
7
GEOM_GEOMETRYCOLLECTION
=
7
};
};
enum
imagetype
{
itRAW
,
itMBR
};
enum
imagetype
{
itRAW
,
itMBR
};
enum
field_cast_enum
{
FIELD_CAST_STOP
,
FIELD_CAST_DECIMAL
,
FIELD_CAST_TINY
,
FIELD_CAST_SHORT
,
FIELD_CAST_MEDIUM
,
FIELD_CAST_LONG
,
FIELD_CAST_LONGLONG
,
FIELD_CAST_FLOAT
,
FIELD_CAST_DOUBLE
,
FIELD_CAST_NULL
,
FIELD_CAST_TIMESTAMP
,
FIELD_CAST_YEAR
,
FIELD_CAST_DATE
,
FIELD_CAST_NEWDATE
,
FIELD_CAST_TIME
,
FIELD_CAST_DATETIME
,
FIELD_CAST_STRING
,
FIELD_CAST_VARSTRING
,
FIELD_CAST_BLOB
,
FIELD_CAST_GEOM
,
FIELD_CAST_ENUM
,
FIELD_CAST_SET
,
FIELD_CAST_BIT
,
FIELD_CAST_NEWDECIMAL
};
utype
unireg_check
;
utype
unireg_check
;
uint32
field_length
;
// Length of field
uint32
field_length
;
// Length of field
...
@@ -119,6 +118,8 @@ public:
...
@@ -119,6 +118,8 @@ public:
String
*
val_int_as_str
(
String
*
val_buffer
,
my_bool
unsigned_flag
);
String
*
val_int_as_str
(
String
*
val_buffer
,
my_bool
unsigned_flag
);
virtual
Item_result
result_type
()
const
=
0
;
virtual
Item_result
result_type
()
const
=
0
;
virtual
Item_result
cmp_type
()
const
{
return
result_type
();
}
virtual
Item_result
cmp_type
()
const
{
return
result_type
();
}
static
enum_field_types
field_type_merge
(
enum_field_types
,
enum_field_types
);
static
Item_result
result_merge_type
(
enum_field_types
);
bool
eq
(
Field
*
field
)
bool
eq
(
Field
*
field
)
{
{
return
(
ptr
==
field
->
ptr
&&
null_ptr
==
field
->
null_ptr
&&
return
(
ptr
==
field
->
ptr
&&
null_ptr
==
field
->
null_ptr
&&
...
@@ -296,8 +297,6 @@ public:
...
@@ -296,8 +297,6 @@ public:
return
(
op_result
==
E_DEC_OVERFLOW
);
return
(
op_result
==
E_DEC_OVERFLOW
);
}
}
int
warn_if_overflow
(
int
op_result
);
int
warn_if_overflow
(
int
op_result
);
virtual
field_cast_enum
field_cast_type
()
=
0
;
bool
field_cast_compatible
(
field_cast_enum
type
);
/* maximum possible display length */
/* maximum possible display length */
virtual
uint32
max_length
()
=
0
;
virtual
uint32
max_length
()
=
0
;
/* length of field value symbolic representation (in bytes) */
/* length of field value symbolic representation (in bytes) */
...
@@ -432,7 +431,6 @@ public:
...
@@ -432,7 +431,6 @@ public:
bool
zero_pack
()
const
{
return
0
;
}
bool
zero_pack
()
const
{
return
0
;
}
void
sql_type
(
String
&
str
)
const
;
void
sql_type
(
String
&
str
)
const
;
uint32
max_length
()
{
return
field_length
;
}
uint32
max_length
()
{
return
field_length
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_DECIMAL
;
}
};
};
...
@@ -504,7 +502,6 @@ public:
...
@@ -504,7 +502,6 @@ public:
uint32
pack_length
()
const
{
return
1
;
}
uint32
pack_length
()
const
{
return
1
;
}
void
sql_type
(
String
&
str
)
const
;
void
sql_type
(
String
&
str
)
const
;
uint32
max_length
()
{
return
4
;
}
uint32
max_length
()
{
return
4
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_TINY
;
}
};
};
...
@@ -541,7 +538,6 @@ public:
...
@@ -541,7 +538,6 @@ public:
uint32
pack_length
()
const
{
return
2
;
}
uint32
pack_length
()
const
{
return
2
;
}
void
sql_type
(
String
&
str
)
const
;
void
sql_type
(
String
&
str
)
const
;
uint32
max_length
()
{
return
6
;
}
uint32
max_length
()
{
return
6
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_SHORT
;
}
};
};
...
@@ -573,7 +569,6 @@ public:
...
@@ -573,7 +569,6 @@ public:
uint32
pack_length
()
const
{
return
3
;
}
uint32
pack_length
()
const
{
return
3
;
}
void
sql_type
(
String
&
str
)
const
;
void
sql_type
(
String
&
str
)
const
;
uint32
max_length
()
{
return
8
;
}
uint32
max_length
()
{
return
8
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_MEDIUM
;
}
};
};
...
@@ -610,7 +605,6 @@ public:
...
@@ -610,7 +605,6 @@ public:
uint32
pack_length
()
const
{
return
4
;
}
uint32
pack_length
()
const
{
return
4
;
}
void
sql_type
(
String
&
str
)
const
;
void
sql_type
(
String
&
str
)
const
;
uint32
max_length
()
{
return
11
;
}
uint32
max_length
()
{
return
11
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_LONG
;
}
};
};
...
@@ -650,7 +644,6 @@ public:
...
@@ -650,7 +644,6 @@ public:
void
sql_type
(
String
&
str
)
const
;
void
sql_type
(
String
&
str
)
const
;
bool
can_be_compared_as_longlong
()
const
{
return
TRUE
;
}
bool
can_be_compared_as_longlong
()
const
{
return
TRUE
;
}
uint32
max_length
()
{
return
20
;
}
uint32
max_length
()
{
return
20
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_LONGLONG
;
}
};
};
#endif
#endif
...
@@ -686,7 +679,6 @@ public:
...
@@ -686,7 +679,6 @@ public:
uint32
pack_length
()
const
{
return
sizeof
(
float
);
}
uint32
pack_length
()
const
{
return
sizeof
(
float
);
}
void
sql_type
(
String
&
str
)
const
;
void
sql_type
(
String
&
str
)
const
;
uint32
max_length
()
{
return
24
;
}
uint32
max_length
()
{
return
24
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_FLOAT
;
}
};
};
...
@@ -721,7 +713,6 @@ public:
...
@@ -721,7 +713,6 @@ public:
uint32
pack_length
()
const
{
return
sizeof
(
double
);
}
uint32
pack_length
()
const
{
return
sizeof
(
double
);
}
void
sql_type
(
String
&
str
)
const
;
void
sql_type
(
String
&
str
)
const
;
uint32
max_length
()
{
return
53
;
}
uint32
max_length
()
{
return
53
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_DOUBLE
;
}
};
};
...
@@ -754,7 +745,6 @@ public:
...
@@ -754,7 +745,6 @@ public:
void
sql_type
(
String
&
str
)
const
;
void
sql_type
(
String
&
str
)
const
;
uint
size_of
()
const
{
return
sizeof
(
*
this
);
}
uint
size_of
()
const
{
return
sizeof
(
*
this
);
}
uint32
max_length
()
{
return
4
;
}
uint32
max_length
()
{
return
4
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_NULL
;
}
};
};
...
@@ -806,7 +796,6 @@ public:
...
@@ -806,7 +796,6 @@ public:
}
}
bool
get_date
(
TIME
*
ltime
,
uint
fuzzydate
);
bool
get_date
(
TIME
*
ltime
,
uint
fuzzydate
);
bool
get_time
(
TIME
*
ltime
);
bool
get_time
(
TIME
*
ltime
);
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_TIMESTAMP
;
}
timestamp_auto_set_type
get_auto_set_type
()
const
;
timestamp_auto_set_type
get_auto_set_type
()
const
;
};
};
...
@@ -830,7 +819,6 @@ public:
...
@@ -830,7 +819,6 @@ public:
bool
send_binary
(
Protocol
*
protocol
);
bool
send_binary
(
Protocol
*
protocol
);
void
sql_type
(
String
&
str
)
const
;
void
sql_type
(
String
&
str
)
const
;
bool
can_be_compared_as_longlong
()
const
{
return
TRUE
;
}
bool
can_be_compared_as_longlong
()
const
{
return
TRUE
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_YEAR
;
}
};
};
...
@@ -863,7 +851,6 @@ public:
...
@@ -863,7 +851,6 @@ public:
void
sql_type
(
String
&
str
)
const
;
void
sql_type
(
String
&
str
)
const
;
bool
can_be_compared_as_longlong
()
const
{
return
TRUE
;
}
bool
can_be_compared_as_longlong
()
const
{
return
TRUE
;
}
bool
zero_pack
()
const
{
return
1
;
}
bool
zero_pack
()
const
{
return
1
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_DATE
;
}
};
};
class
Field_newdate
:
public
Field_str
{
class
Field_newdate
:
public
Field_str
{
...
@@ -895,7 +882,6 @@ public:
...
@@ -895,7 +882,6 @@ public:
bool
zero_pack
()
const
{
return
1
;
}
bool
zero_pack
()
const
{
return
1
;
}
bool
get_date
(
TIME
*
ltime
,
uint
fuzzydate
);
bool
get_date
(
TIME
*
ltime
,
uint
fuzzydate
);
bool
get_time
(
TIME
*
ltime
);
bool
get_time
(
TIME
*
ltime
);
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_NEWDATE
;
}
};
};
...
@@ -931,7 +917,6 @@ public:
...
@@ -931,7 +917,6 @@ public:
void
sql_type
(
String
&
str
)
const
;
void
sql_type
(
String
&
str
)
const
;
bool
can_be_compared_as_longlong
()
const
{
return
TRUE
;
}
bool
can_be_compared_as_longlong
()
const
{
return
TRUE
;
}
bool
zero_pack
()
const
{
return
1
;
}
bool
zero_pack
()
const
{
return
1
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_TIME
;
}
};
};
...
@@ -969,7 +954,6 @@ public:
...
@@ -969,7 +954,6 @@ public:
bool
zero_pack
()
const
{
return
1
;
}
bool
zero_pack
()
const
{
return
1
;
}
bool
get_date
(
TIME
*
ltime
,
uint
fuzzydate
);
bool
get_date
(
TIME
*
ltime
,
uint
fuzzydate
);
bool
get_time
(
TIME
*
ltime
);
bool
get_time
(
TIME
*
ltime
);
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_DATETIME
;
}
};
};
...
@@ -1019,7 +1003,6 @@ public:
...
@@ -1019,7 +1003,6 @@ public:
bool
has_charset
(
void
)
const
bool
has_charset
(
void
)
const
{
return
charset
()
==
&
my_charset_bin
?
FALSE
:
TRUE
;
}
{
return
charset
()
==
&
my_charset_bin
?
FALSE
:
TRUE
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_STRING
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_STRING
;
}
Field
*
new_field
(
MEM_ROOT
*
root
,
struct
st_table
*
new_table
);
};
};
...
@@ -1085,7 +1068,6 @@ public:
...
@@ -1085,7 +1068,6 @@ public:
enum_field_types
real_type
()
const
{
return
MYSQL_TYPE_VARCHAR
;
}
enum_field_types
real_type
()
const
{
return
MYSQL_TYPE_VARCHAR
;
}
bool
has_charset
(
void
)
const
bool
has_charset
(
void
)
const
{
return
charset
()
==
&
my_charset_bin
?
FALSE
:
TRUE
;
}
{
return
charset
()
==
&
my_charset_bin
?
FALSE
:
TRUE
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_VARSTRING
;
}
Field
*
new_field
(
MEM_ROOT
*
root
,
struct
st_table
*
new_table
);
Field
*
new_field
(
MEM_ROOT
*
root
,
struct
st_table
*
new_table
);
Field
*
new_key_field
(
MEM_ROOT
*
root
,
struct
st_table
*
new_table
,
Field
*
new_key_field
(
MEM_ROOT
*
root
,
struct
st_table
*
new_table
,
char
*
new_ptr
,
uchar
*
new_null_ptr
,
char
*
new_ptr
,
uchar
*
new_null_ptr
,
...
@@ -1183,7 +1165,6 @@ public:
...
@@ -1183,7 +1165,6 @@ public:
uint
size_of
()
const
{
return
sizeof
(
*
this
);
}
uint
size_of
()
const
{
return
sizeof
(
*
this
);
}
bool
has_charset
(
void
)
const
bool
has_charset
(
void
)
const
{
return
charset
()
==
&
my_charset_bin
?
FALSE
:
TRUE
;
}
{
return
charset
()
==
&
my_charset_bin
?
FALSE
:
TRUE
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_BLOB
;
}
uint32
max_length
();
uint32
max_length
();
};
};
...
@@ -1213,7 +1194,6 @@ public:
...
@@ -1213,7 +1194,6 @@ public:
int
store
(
longlong
nr
)
{
return
1
;
}
int
store
(
longlong
nr
)
{
return
1
;
}
int
store_decimal
(
const
my_decimal
*
)
{
return
1
;
}
int
store_decimal
(
const
my_decimal
*
)
{
return
1
;
}
void
get_key_image
(
char
*
buff
,
uint
length
,
imagetype
type
);
void
get_key_image
(
char
*
buff
,
uint
length
,
imagetype
type
);
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_GEOM
;
}
};
};
#endif
/*HAVE_SPATIAL*/
#endif
/*HAVE_SPATIAL*/
...
@@ -1258,7 +1238,6 @@ public:
...
@@ -1258,7 +1238,6 @@ public:
bool
has_charset
(
void
)
const
{
return
TRUE
;
}
bool
has_charset
(
void
)
const
{
return
TRUE
;
}
/* enum and set are sorted as integers */
/* enum and set are sorted as integers */
CHARSET_INFO
*
sort_charset
(
void
)
const
{
return
&
my_charset_bin
;
}
CHARSET_INFO
*
sort_charset
(
void
)
const
{
return
&
my_charset_bin
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_ENUM
;
}
};
};
...
@@ -1284,7 +1263,6 @@ public:
...
@@ -1284,7 +1263,6 @@ public:
void
sql_type
(
String
&
str
)
const
;
void
sql_type
(
String
&
str
)
const
;
enum_field_types
real_type
()
const
{
return
FIELD_TYPE_SET
;
}
enum_field_types
real_type
()
const
{
return
FIELD_TYPE_SET
;
}
bool
has_charset
(
void
)
const
{
return
TRUE
;
}
bool
has_charset
(
void
)
const
{
return
TRUE
;
}
field_cast_enum
field_cast_type
()
{
return
FIELD_CAST_SET
;
}
};
};
...
@@ -1424,7 +1402,6 @@ enum_field_types get_blob_type_from_length(ulong length);
...
@@ -1424,7 +1402,6 @@ enum_field_types get_blob_type_from_length(ulong length);
uint32
calc_pack_length
(
enum_field_types
type
,
uint32
length
);
uint32
calc_pack_length
(
enum_field_types
type
,
uint32
length
);
int
set_field_to_null
(
Field
*
field
);
int
set_field_to_null
(
Field
*
field
);
int
set_field_to_null_with_conversions
(
Field
*
field
,
bool
no_conversions
);
int
set_field_to_null_with_conversions
(
Field
*
field
,
bool
no_conversions
);
bool
field_types_to_be_kept
(
enum_field_types
field_type
);
/*
/*
The following are for the interface with the .frm file
The following are for the interface with the .frm file
...
...
sql/item.cc
View file @
05d4ed14
This diff is collapsed.
Click to expand it.
sql/item.h
View file @
05d4ed14
...
@@ -1782,33 +1782,33 @@ public:
...
@@ -1782,33 +1782,33 @@ public:
/*
/*
Used to store type. name, length of Item for UNIONS & derived table
Item_type_holder used to store type. name, length of Item for UNIONS &
derived tables.
Item_type_holder do not need cleanup() because its time of live limited by
single SP/PS execution.
*/
*/
class
Item_type_holder
:
public
Item
class
Item_type_holder
:
public
Item
{
{
protected:
protected:
Item_result
item_type
;
TYPELIB
*
enum_set_typelib
;
Item_result
orig_type
;
enum_field_types
fld_type
;
Field
*
field_example
;
void
get_full_info
(
Item
*
item
);
public:
public:
Item_type_holder
(
THD
*
,
Item
*
,
TABLE
*
);
Item_type_holder
(
THD
*
,
Item
*
);
Item_result
result_type
()
const
{
return
item_type
;
}
Item_result
result_type
()
const
;
virtual
enum_field_types
field_type
()
const
{
return
fld_type
;
};
enum
Type
type
()
const
{
return
TYPE_HOLDER
;
}
enum
Type
type
()
const
{
return
TYPE_HOLDER
;
}
double
val_real
();
double
val_real
();
longlong
val_int
();
longlong
val_int
();
my_decimal
*
val_decimal
(
my_decimal
*
);
my_decimal
*
val_decimal
(
my_decimal
*
);
String
*
val_str
(
String
*
);
String
*
val_str
(
String
*
);
bool
join_types
(
THD
*
thd
,
Item
*
,
TABLE
*
);
bool
join_types
(
THD
*
thd
,
Item
*
);
Field
*
example
()
{
return
field_example
;
}
Field
*
make_field_by_type
(
TABLE
*
table
);
static
uint32
real_length
(
Item
*
item
);
static
uint32
display_length
(
Item
*
item
);
void
cleanup
()
static
enum_field_types
get_real_type
(
Item
*
);
{
DBUG_ENTER
(
"Item_type_holder::cleanup"
);
Item
::
cleanup
();
item_type
=
orig_type
;
DBUG_VOID_RETURN
;
}
};
};
...
...
sql/item_func.h
View file @
05d4ed14
...
@@ -54,7 +54,7 @@ public:
...
@@ -54,7 +54,7 @@ public:
SP_POINTN
,
SP_GEOMETRYN
,
SP_INTERIORRINGN
,
SP_POINTN
,
SP_GEOMETRYN
,
SP_INTERIORRINGN
,
NOT_FUNC
,
NOT_ALL_FUNC
,
NOT_FUNC
,
NOT_ALL_FUNC
,
NOW_FUNC
,
TRIG_COND_FUNC
,
NOW_FUNC
,
TRIG_COND_FUNC
,
GUSERVAR_FUNC
};
GUSERVAR_FUNC
,
VAR_VALUE_FUNC
};
enum
optimize_type
{
OPTIMIZE_NONE
,
OPTIMIZE_KEY
,
OPTIMIZE_OP
,
OPTIMIZE_NULL
,
enum
optimize_type
{
OPTIMIZE_NONE
,
OPTIMIZE_KEY
,
OPTIMIZE_OP
,
OPTIMIZE_NULL
,
OPTIMIZE_EQUAL
};
OPTIMIZE_EQUAL
};
enum
Type
type
()
const
{
return
FUNC_ITEM
;
}
enum
Type
type
()
const
{
return
FUNC_ITEM
;
}
...
@@ -1124,6 +1124,7 @@ public:
...
@@ -1124,6 +1124,7 @@ public:
select @t1:=1,@t1,@t:="hello",@t from foo where (@t1:= t2.b)
select @t1:=1,@t1,@t:="hello",@t from foo where (@t1:= t2.b)
*/
*/
enum_field_types
field_type
()
const
{
return
MYSQL_TYPE_VARCHAR
;
}
enum_field_types
field_type
()
const
{
return
MYSQL_TYPE_VARCHAR
;
}
enum
Functype
functype
()
const
{
return
VAR_VALUE_FUNC
;
}
const
char
*
func_name
()
const
{
return
"get_user_var"
;
}
const
char
*
func_name
()
const
{
return
"get_user_var"
;
}
bool
const_item
()
const
;
bool
const_item
()
const
;
table_map
used_tables
()
const
table_map
used_tables
()
const
...
...
sql/item_subselect.cc
View file @
05d4ed14
This diff is collapsed.
Click to expand it.
sql/item_subselect.h
View file @
05d4ed14
...
@@ -225,7 +225,8 @@ public:
...
@@ -225,7 +225,8 @@ public:
Item_in_subselect
(
Item
*
left_expr
,
st_select_lex
*
select_lex
);
Item_in_subselect
(
Item
*
left_expr
,
st_select_lex
*
select_lex
);
Item_in_subselect
()
Item_in_subselect
()
:
Item_exists_subselect
(),
abort_on_null
(
0
),
transformed
(
0
),
upper_item
(
0
)
:
Item_exists_subselect
(),
optimizer
(
0
),
abort_on_null
(
0
),
transformed
(
0
),
upper_item
(
0
)
{}
{}
subs_type
substype
()
{
return
IN_SUBS
;
}
subs_type
substype
()
{
return
IN_SUBS
;
}
...
@@ -236,8 +237,8 @@ public:
...
@@ -236,8 +237,8 @@ public:
was_null
=
0
;
was_null
=
0
;
}
}
trans_res
select_transformer
(
JOIN
*
join
);
trans_res
select_transformer
(
JOIN
*
join
);
trans_res
s
ingle_value_transformer
(
JOIN
*
join
,
trans_res
s
elect_in_like_transformer
(
JOIN
*
join
,
Comp_creator
*
func
);
Comp_creator
*
func
);
trans_res
single_value_transformer
(
JOIN
*
join
,
Comp_creator
*
func
);
trans_res
row_value_transformer
(
JOIN
*
join
);
trans_res
row_value_transformer
(
JOIN
*
join
);
longlong
val_int
();
longlong
val_int
();
double
val_real
();
double
val_real
();
...
...
sql/sql_derived.cc
View file @
05d4ed14
...
@@ -115,7 +115,7 @@ int mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *orig_table_list)
...
@@ -115,7 +115,7 @@ int mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *orig_table_list)
DBUG_RETURN
(
1
);
// out of memory
DBUG_RETURN
(
1
);
// out of memory
// st_select_lex_unit::prepare correctly work for single select
// st_select_lex_unit::prepare correctly work for single select
if
((
res
=
unit
->
prepare
(
thd
,
derived_result
,
0
)))
if
((
res
=
unit
->
prepare
(
thd
,
derived_result
,
0
,
org_table_list
->
alias
)))
goto
exit
;
goto
exit
;
...
...
sql/sql_lex.h
View file @
05d4ed14
...
@@ -436,7 +436,8 @@ public:
...
@@ -436,7 +436,8 @@ public:
void
exclude_tree
();
void
exclude_tree
();
/* UNION methods */
/* UNION methods */
bool
prepare
(
THD
*
thd
,
select_result
*
result
,
ulong
additional_options
);
bool
prepare
(
THD
*
thd
,
select_result
*
result
,
ulong
additional_options
,
const
char
*
tmp_table_alias
);
bool
exec
();
bool
exec
();
bool
cleanup
();
bool
cleanup
();
inline
void
unclean
()
{
cleaned
=
0
;
}
inline
void
unclean
()
{
cleaned
=
0
;
}
...
...
sql/sql_parse.cc
View file @
05d4ed14
...
@@ -5529,9 +5529,7 @@ new_create_field(THD *thd, char *field_name, enum_field_types type,
...
@@ -5529,9 +5529,7 @@ new_create_field(THD *thd, char *field_name, enum_field_types type,
my_error
(
ER_TOO_BIG_SET
,
MYF
(
0
),
field_name
);
/* purecov: inspected */
my_error
(
ER_TOO_BIG_SET
,
MYF
(
0
),
field_name
);
/* purecov: inspected */
DBUG_RETURN
(
NULL
);
DBUG_RETURN
(
NULL
);
}
}
new_field
->
pack_length
=
(
interval_list
->
elements
+
7
)
/
8
;
new_field
->
pack_length
=
get_set_pack_length
(
interval_list
->
elements
);
if
(
new_field
->
pack_length
>
4
)
new_field
->
pack_length
=
8
;
List_iterator
<
String
>
it
(
*
interval_list
);
List_iterator
<
String
>
it
(
*
interval_list
);
String
*
tmp
;
String
*
tmp
;
...
@@ -5548,7 +5546,7 @@ new_create_field(THD *thd, char *field_name, enum_field_types type,
...
@@ -5548,7 +5546,7 @@ new_create_field(THD *thd, char *field_name, enum_field_types type,
case
FIELD_TYPE_ENUM
:
case
FIELD_TYPE_ENUM
:
{
{
// Should be safe
// Should be safe
new_field
->
pack_length
=
interval_list
->
elements
<
256
?
1
:
2
;
new_field
->
pack_length
=
get_enum_pack_length
(
interval_list
->
elements
);
List_iterator
<
String
>
it
(
*
interval_list
);
List_iterator
<
String
>
it
(
*
interval_list
);
String
*
tmp
;
String
*
tmp
;
...
...
sql/sql_prepare.cc
View file @
05d4ed14
...
@@ -1166,7 +1166,7 @@ static int mysql_test_select(Prepared_statement *stmt,
...
@@ -1166,7 +1166,7 @@ static int mysql_test_select(Prepared_statement *stmt,
It is not SELECT COMMAND for sure, so setup_tables will be called as
It is not SELECT COMMAND for sure, so setup_tables will be called as
usual, and we pass 0 as setup_tables_done_option
usual, and we pass 0 as setup_tables_done_option
*/
*/
if
(
unit
->
prepare
(
thd
,
0
,
0
))
if
(
unit
->
prepare
(
thd
,
0
,
0
,
""
))
{
{
goto
err_prep
;
goto
err_prep
;
}
}
...
@@ -1318,7 +1318,7 @@ static bool select_like_stmt_test(Prepared_statement *stmt,
...
@@ -1318,7 +1318,7 @@ static bool select_like_stmt_test(Prepared_statement *stmt,
thd
->
used_tables
=
0
;
// Updated by setup_fields
thd
->
used_tables
=
0
;
// Updated by setup_fields
// JOIN::prepare calls
// JOIN::prepare calls
if
(
lex
->
unit
.
prepare
(
thd
,
0
,
setup_tables_done_option
))
if
(
lex
->
unit
.
prepare
(
thd
,
0
,
setup_tables_done_option
,
""
))
{
{
res
=
TRUE
;
res
=
TRUE
;
}
}
...
...
sql/sql_select.cc
View file @
05d4ed14
...
@@ -7802,14 +7802,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
...
@@ -7802,14 +7802,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
return
create_tmp_field_from_item
(
thd
,
item
,
table
,
copy_func
,
modify_item
,
return
create_tmp_field_from_item
(
thd
,
item
,
table
,
copy_func
,
modify_item
,
convert_blob_length
);
convert_blob_length
);
case
Item
:
:
TYPE_HOLDER
:
case
Item
:
:
TYPE_HOLDER
:
{
return
((
Item_type_holder
*
)
item
)
->
make_field_by_type
(
table
);
Field
*
example
=
((
Item_type_holder
*
)
item
)
->
example
();
if
(
example
)
return
create_tmp_field_from_field
(
thd
,
example
,
item
->
name
,
table
,
NULL
,
convert_blob_length
);
return
create_tmp_field_from_item
(
thd
,
item
,
table
,
copy_func
,
0
,
convert_blob_length
);
}
default:
// Dosen't have to be stored
default:
// Dosen't have to be stored
return
0
;
return
0
;
}
}
...
@@ -10584,7 +10577,19 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
...
@@ -10584,7 +10577,19 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
/* Found key that can be used to retrieve data in sorted order */
/* Found key that can be used to retrieve data in sorted order */
if
(
tab
->
ref
.
key
>=
0
)
if
(
tab
->
ref
.
key
>=
0
)
{
{
tab
->
ref
.
key
=
new_ref_key
;
/*
We'll use ref access method on key new_ref_key. In general case
the index search tuple for new_ref_key will be different (e.g.
when one of the indexes only covers prefix of the field, see
BUG#9213 in group_by.test).
So we build tab->ref from scratch here.
*/
KEYUSE
*
keyuse
=
tab
->
keyuse
;
while
(
keyuse
->
key
!=
new_ref_key
&&
keyuse
->
table
==
tab
->
table
)
keyuse
++
;
if
(
create_ref_for_key
(
tab
->
join
,
tab
,
keyuse
,
tab
->
join
->
const_table_map
))
DBUG_RETURN
(
0
);
}
}
else
else
{
{
...
@@ -13188,7 +13193,8 @@ bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
...
@@ -13188,7 +13193,8 @@ bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
unit
->
fake_select_lex
->
select_number
=
UINT_MAX
;
// jost for initialization
unit
->
fake_select_lex
->
select_number
=
UINT_MAX
;
// jost for initialization
unit
->
fake_select_lex
->
type
=
"UNION RESULT"
;
unit
->
fake_select_lex
->
type
=
"UNION RESULT"
;
unit
->
fake_select_lex
->
options
|=
SELECT_DESCRIBE
;
unit
->
fake_select_lex
->
options
|=
SELECT_DESCRIBE
;
if
(
!
(
res
=
unit
->
prepare
(
thd
,
result
,
SELECT_NO_UNLOCK
|
SELECT_DESCRIBE
)))
if
(
!
(
res
=
unit
->
prepare
(
thd
,
result
,
SELECT_NO_UNLOCK
|
SELECT_DESCRIBE
,
""
)))
res
=
unit
->
exec
();
res
=
unit
->
exec
();
res
|=
unit
->
cleanup
();
res
|=
unit
->
cleanup
();
}
}
...
...
sql/sql_union.cc
View file @
05d4ed14
...
@@ -30,7 +30,7 @@ bool mysql_union(THD *thd, LEX *lex, select_result *result,
...
@@ -30,7 +30,7 @@ bool mysql_union(THD *thd, LEX *lex, select_result *result,
DBUG_ENTER
(
"mysql_union"
);
DBUG_ENTER
(
"mysql_union"
);
bool
res
;
bool
res
;
if
(
!
(
res
=
unit
->
prepare
(
thd
,
result
,
SELECT_NO_UNLOCK
|
if
(
!
(
res
=
unit
->
prepare
(
thd
,
result
,
SELECT_NO_UNLOCK
|
setup_tables_done_option
)))
setup_tables_done_option
,
""
)))
res
=
unit
->
exec
();
res
=
unit
->
exec
();
if
(
!
res
&&
thd
->
cursor
&&
thd
->
cursor
->
is_open
())
if
(
!
res
&&
thd
->
cursor
&&
thd
->
cursor
->
is_open
())
{
{
...
@@ -140,7 +140,8 @@ st_select_lex_unit::init_prepare_fake_select_lex(THD *thd)
...
@@ -140,7 +140,8 @@ st_select_lex_unit::init_prepare_fake_select_lex(THD *thd)
bool
st_select_lex_unit
::
prepare
(
THD
*
thd_arg
,
select_result
*
sel_result
,
bool
st_select_lex_unit
::
prepare
(
THD
*
thd_arg
,
select_result
*
sel_result
,
ulong
additional_options
)
ulong
additional_options
,
const
char
*
tmp_table_alias
)
{
{
SELECT_LEX
*
lex_select_save
=
thd_arg
->
lex
->
current_select
;
SELECT_LEX
*
lex_select_save
=
thd_arg
->
lex
->
current_select
;
SELECT_LEX
*
sl
,
*
first_select
;
SELECT_LEX
*
sl
,
*
first_select
;
...
@@ -255,7 +256,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
...
@@ -255,7 +256,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
while
((
item_tmp
=
it
++
))
while
((
item_tmp
=
it
++
))
{
{
/* Error's in 'new' will be detected after loop */
/* Error's in 'new' will be detected after loop */
types
.
push_back
(
new
Item_type_holder
(
thd_arg
,
item_tmp
,
empty_table
));
types
.
push_back
(
new
Item_type_holder
(
thd_arg
,
item_tmp
));
}
}
if
(
thd_arg
->
is_fatal_error
)
if
(
thd_arg
->
is_fatal_error
)
...
@@ -274,8 +275,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
...
@@ -274,8 +275,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
Item
*
type
,
*
item_tmp
;
Item
*
type
,
*
item_tmp
;
while
((
type
=
tp
++
,
item_tmp
=
it
++
))
while
((
type
=
tp
++
,
item_tmp
=
it
++
))
{
{
if
(((
Item_type_holder
*
)
type
)
->
join_types
(
thd_arg
,
item_tmp
,
if
(((
Item_type_holder
*
)
type
)
->
join_types
(
thd_arg
,
item_tmp
))
empty_table
))
DBUG_RETURN
(
TRUE
);
DBUG_RETURN
(
TRUE
);
}
}
}
}
...
@@ -308,7 +308,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
...
@@ -308,7 +308,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
(
first_select_in_union
()
->
options
|
(
first_select_in_union
()
->
options
|
thd_arg
->
options
|
thd_arg
->
options
|
TMP_TABLE_ALL_COLUMNS
),
TMP_TABLE_ALL_COLUMNS
),
HA_POS_ERROR
,
(
char
*
)
""
)))
HA_POS_ERROR
,
(
char
*
)
tmp_table_alias
)))
goto
err
;
goto
err
;
table
->
file
->
extra
(
HA_EXTRA_WRITE_CACHE
);
table
->
file
->
extra
(
HA_EXTRA_WRITE_CACHE
);
table
->
file
->
extra
(
HA_EXTRA_IGNORE_DUP_KEY
);
table
->
file
->
extra
(
HA_EXTRA_IGNORE_DUP_KEY
);
...
...
support-files/mysql.server.sh
View file @
05d4ed14
...
@@ -99,10 +99,12 @@ parse_manager_arguments() {
...
@@ -99,10 +99,12 @@ parse_manager_arguments() {
}
}
wait_for_pid
()
{
wait_for_pid
()
{
for
((
i
=
0
;
i<35
;
i++
))
;
do
i
=
0
while
test
$i
-lt
35
;
do
sleep
1
sleep
1
test
-s
$pid_file
&&
i
=
''
&&
break
test
-s
$pid_file
&&
i
=
''
&&
break
echo
$echo_n
".
$echo_c
"
echo
$echo_n
".
$echo_c
"
i
=
`
expr
$i
+ 1
`
done
done
if
test
-z
"
$i
"
;
then
if
test
-z
"
$i
"
;
then
...
...
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