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
b79a4c01
Commit
b79a4c01
authored
Oct 11, 2002
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bug in subselect value storing
parent
de434ff8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
6 deletions
+24
-6
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+3
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+1
-0
sql/item_subselect.cc
sql/item_subselect.cc
+2
-0
sql/item_subselect.h
sql/item_subselect.h
+10
-3
sql/sql_class.cc
sql/sql_class.cc
+8
-3
No files found.
mysql-test/r/subselect.result
View file @
b79a4c01
...
...
@@ -159,6 +159,9 @@ UNIQUE KEY `email` (`email`)
INSERT INTO inscrit (pseudo,email) VALUES ('joce','test');
INSERT INTO inscrit (pseudo,email) VALUES ('joce1','test1');
INSERT INTO inscrit (pseudo,email) VALUES ('2joce1','2test1');
SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo='joce');
pseudo
joce
SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo LIKE '%joce%');
Subselect returns more than 1 record
drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
mysql-test/t/subselect.test
View file @
b79a4c01
...
...
@@ -82,6 +82,7 @@ CREATE TABLE `inscrit` (
INSERT
INTO
inscrit
(
pseudo
,
email
)
VALUES
(
'joce'
,
'test'
);
INSERT
INTO
inscrit
(
pseudo
,
email
)
VALUES
(
'joce1'
,
'test1'
);
INSERT
INTO
inscrit
(
pseudo
,
email
)
VALUES
(
'2joce1'
,
'2test1'
);
SELECT
pseudo
FROM
inscrit
WHERE
pseudo
=
(
SELECT
pseudo
FROM
inscrit
WHERE
pseudo
=
'joce'
);
--
error
1240
SELECT
pseudo
FROM
inscrit
WHERE
pseudo
=
(
SELECT
pseudo
FROM
inscrit
WHERE
pseudo
LIKE
'%joce%'
);
...
...
sql/item_subselect.cc
View file @
b79a4c01
...
...
@@ -150,6 +150,8 @@ String *Item_singleval_subselect::val_str (String *str)
assign_null
();
return
0
;
}
// Assign temporary buffer with stored value
str_value
.
set
(
string_value
,
0
,
string_value
.
length
());
return
&
str_value
;
}
...
...
sql/item_subselect.h
View file @
b79a4c01
...
...
@@ -80,10 +80,16 @@ public:
class
Item_singleval_subselect
:
public
Item_subselect
{
protected:
longlong
int_value
;
/* here stored integer value of this item */
double
real_value
;
/* here stored real value of this item */
longlong
int_value
;
/* Here stored integer value of this item */
double
real_value
;
/* Here stored real value of this item */
/*
Here stored string value of this item.
(str_value used only as temporary buffer, because it can be changed
by Item::save_field)
*/
String
string_value
;
enum
Item_result
res_type
;
/* type of results */
public:
Item_singleval_subselect
(
THD
*
thd
,
st_select_lex
*
select_lex
);
Item_singleval_subselect
(
Item_singleval_subselect
*
item
)
:
...
...
@@ -91,6 +97,7 @@ public:
{
int_value
=
item
->
int_value
;
real_value
=
item
->
real_value
;
string_value
.
set
(
item
->
string_value
,
0
,
item
->
string_value
.
length
());
max_length
=
item
->
max_length
;
decimals
=
item
->
decimals
;
res_type
=
item
->
res_type
;
...
...
sql/sql_class.cc
View file @
b79a4c01
...
...
@@ -884,9 +884,14 @@ bool select_singleval_subselect::send_data(List<Item> &items)
it
->
decimals
=
val_item
->
decimals
;
it
->
binary
=
val_item
->
binary
;
it
->
int_value
=
val_item
->
val_int
();
String
*
s
=
val_item
->
val_str
(
&
it
->
str_value
);
if
(
s
!=
&
it
->
str_value
)
it
->
str_value
.
set
(
*
s
,
0
,
s
->
length
());
String
*
s
=
val_item
->
val_str
(
&
it
->
string_value
);
if
(
s
!=
&
it
->
string_value
)
{
it
->
string_value
.
set
(
*
s
,
0
,
s
->
length
());
}
// TODO: remove when correct charset handling appeared for Item
it
->
str_value
.
set
(
*
s
,
0
,
s
->
length
());
// store charset
it
->
res_type
=
val_item
->
result_type
();
}
it
->
assigned
(
1
);
...
...
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