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
f4a3b1d9
Commit
f4a3b1d9
authored
Oct 23, 2002
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge sanja.is.com.ua:/home/bell/mysql/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/work-distinct-4.1
parents
020e3bd7
4aef2862
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
8 deletions
+18
-8
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+6
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+2
-0
sql/item.h
sql/item.h
+6
-4
sql/sql_class.cc
sql/sql_class.cc
+4
-4
No files found.
mysql-test/r/subselect.result
View file @
f4a3b1d9
...
@@ -198,4 +198,10 @@ EXPLAIN SELECT (SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002
...
@@ -198,4 +198,10 @@ EXPLAIN SELECT (SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002
id select_type table type possible_keys key key_len ref rows Extra
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY No tables used
1 PRIMARY No tables used
2 SUBSELECT searchconthardwarefr3 index NULL PRIMARY 41 NULL 2 where used; Using index
2 SUBSELECT searchconthardwarefr3 index NULL PRIMARY 41 NULL 2 where used; Using index
SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03';
date
2002-08-03
SELECT (SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03');
(SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03')
2002-08-03
drop table searchconthardwarefr3;
drop table searchconthardwarefr3;
mysql-test/t/subselect.test
View file @
f4a3b1d9
...
@@ -108,4 +108,6 @@ INSERT INTO searchconthardwarefr3 (topic,date,pseudo) VALUES
...
@@ -108,4 +108,6 @@ INSERT INTO searchconthardwarefr3 (topic,date,pseudo) VALUES
(
'43506'
,
'2002-10-02'
,
'joce'
),(
'40143'
,
'2002-08-03'
,
'joce'
);
(
'43506'
,
'2002-10-02'
,
'joce'
),(
'40143'
,
'2002-08-03'
,
'joce'
);
EXPLAIN
SELECT
DISTINCT
date
FROM
searchconthardwarefr3
WHERE
date
=
'2002-08-03'
;
EXPLAIN
SELECT
DISTINCT
date
FROM
searchconthardwarefr3
WHERE
date
=
'2002-08-03'
;
EXPLAIN
SELECT
(
SELECT
DISTINCT
date
FROM
searchconthardwarefr3
WHERE
date
=
'2002-08-03'
);
EXPLAIN
SELECT
(
SELECT
DISTINCT
date
FROM
searchconthardwarefr3
WHERE
date
=
'2002-08-03'
);
SELECT
DISTINCT
date
FROM
searchconthardwarefr3
WHERE
date
=
'2002-08-03'
;
SELECT
(
SELECT
DISTINCT
date
FROM
searchconthardwarefr3
WHERE
date
=
'2002-08-03'
);
drop
table
searchconthardwarefr3
;
drop
table
searchconthardwarefr3
;
\ No newline at end of file
sql/item.h
View file @
f4a3b1d9
...
@@ -71,6 +71,7 @@ class Item {
...
@@ -71,6 +71,7 @@ class Item {
virtual
double
val_result
()
{
return
val
();
}
virtual
double
val_result
()
{
return
val
();
}
virtual
longlong
val_int_result
()
{
return
val_int
();
}
virtual
longlong
val_int_result
()
{
return
val_int
();
}
virtual
String
*
str_result
(
String
*
tmp
)
{
return
val_str
(
tmp
);
}
virtual
String
*
str_result
(
String
*
tmp
)
{
return
val_str
(
tmp
);
}
virtual
bool
is_null_result
()
{
return
is_null
();
}
virtual
table_map
used_tables
()
const
{
return
(
table_map
)
0L
;
}
virtual
table_map
used_tables
()
const
{
return
(
table_map
)
0L
;
}
virtual
bool
basic_const_item
()
const
{
return
0
;
}
virtual
bool
basic_const_item
()
const
{
return
0
;
}
virtual
Item
*
new_item
()
{
return
0
;
}
/* Only for const items */
virtual
Item
*
new_item
()
{
return
0
;
}
/* Only for const items */
...
@@ -124,6 +125,7 @@ class Item_field :public Item_ident
...
@@ -124,6 +125,7 @@ class Item_field :public Item_ident
double
val_result
();
double
val_result
();
longlong
val_int_result
();
longlong
val_int_result
();
String
*
str_result
(
String
*
tmp
);
String
*
str_result
(
String
*
tmp
);
bool
is_null_result
()
{
return
result_field
->
is_null
();
}
bool
send
(
THD
*
thd
,
String
*
str_arg
)
bool
send
(
THD
*
thd
,
String
*
str_arg
)
{
{
return
result_field
->
send
(
thd
,
str_arg
);
return
result_field
->
send
(
thd
,
str_arg
);
...
@@ -398,25 +400,25 @@ class Item_ref :public Item_ident
...
@@ -398,25 +400,25 @@ class Item_ref :public Item_ident
double
val
()
double
val
()
{
{
double
tmp
=
(
*
ref
)
->
val_result
();
double
tmp
=
(
*
ref
)
->
val_result
();
null_value
=
(
*
ref
)
->
null_value
;
null_value
=
(
*
ref
)
->
is_null_result
()
;
return
tmp
;
return
tmp
;
}
}
longlong
val_int
()
longlong
val_int
()
{
{
longlong
tmp
=
(
*
ref
)
->
val_int_result
();
longlong
tmp
=
(
*
ref
)
->
val_int_result
();
null_value
=
(
*
ref
)
->
null_value
;
null_value
=
(
*
ref
)
->
is_null_result
()
;
return
tmp
;
return
tmp
;
}
}
String
*
val_str
(
String
*
tmp
)
String
*
val_str
(
String
*
tmp
)
{
{
tmp
=
(
*
ref
)
->
str_result
(
tmp
);
tmp
=
(
*
ref
)
->
str_result
(
tmp
);
null_value
=
(
*
ref
)
->
null_value
;
null_value
=
(
*
ref
)
->
is_null_result
()
;
return
tmp
;
return
tmp
;
}
}
bool
is_null
()
bool
is_null
()
{
{
(
void
)
(
*
ref
)
->
val_int_result
();
(
void
)
(
*
ref
)
->
val_int_result
();
return
(
*
ref
)
->
null_value
;
return
(
*
ref
)
->
is_null_result
()
;
}
}
bool
get_date
(
TIME
*
ltime
,
bool
fuzzydate
)
bool
get_date
(
TIME
*
ltime
,
bool
fuzzydate
)
{
{
...
...
sql/sql_class.cc
View file @
f4a3b1d9
...
@@ -873,8 +873,8 @@ bool select_singleval_subselect::send_data(List<Item> &items)
...
@@ -873,8 +873,8 @@ bool select_singleval_subselect::send_data(List<Item> &items)
Following val() call have to be first, because function AVG() & STD()
Following val() call have to be first, because function AVG() & STD()
calculate value on it & determinate "is it NULL?".
calculate value on it & determinate "is it NULL?".
*/
*/
it
->
real_value
=
val_item
->
val
();
it
->
real_value
=
val_item
->
val
_result
();
if
((
it
->
null_value
=
val_item
->
is_null
()))
if
((
it
->
null_value
=
val_item
->
is_null
_result
()))
{
{
it
->
assign_null
();
it
->
assign_null
();
}
}
...
@@ -883,8 +883,8 @@ bool select_singleval_subselect::send_data(List<Item> &items)
...
@@ -883,8 +883,8 @@ bool select_singleval_subselect::send_data(List<Item> &items)
it
->
max_length
=
val_item
->
max_length
;
it
->
max_length
=
val_item
->
max_length
;
it
->
decimals
=
val_item
->
decimals
;
it
->
decimals
=
val_item
->
decimals
;
it
->
binary
=
val_item
->
binary
;
it
->
binary
=
val_item
->
binary
;
it
->
int_value
=
val_item
->
val_int
();
it
->
int_value
=
val_item
->
val_int
_result
();
String
*
s
=
val_item
->
val_str
(
&
it
->
string_value
);
String
*
s
=
val_item
->
str_result
(
&
it
->
string_value
);
if
(
s
!=
&
it
->
string_value
)
if
(
s
!=
&
it
->
string_value
)
{
{
it
->
string_value
.
set
(
*
s
,
0
,
s
->
length
());
it
->
string_value
.
set
(
*
s
,
0
,
s
->
length
());
...
...
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