mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge sanja.is.com.ua:/home/bell/mysql/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/work-4.1
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
select (select 2);
|
select (select 2);
|
||||||
(select 2)
|
(select 2)
|
||||||
2
|
2
|
||||||
drop table if exists t1,t2,t3,t4,t5,attend,clinic;
|
drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
|
||||||
create table t1 (a int);
|
create table t1 (a int);
|
||||||
create table t2 (a int, b int);
|
create table t2 (a int, b int);
|
||||||
create table t3 (a int);
|
create table t3 (a int);
|
||||||
@ -147,4 +147,16 @@ W 1
|
|||||||
SELECT * FROM t3 WHERE b = (SELECT MIN(b) FROM t3);
|
SELECT * FROM t3 WHERE b = (SELECT MIN(b) FROM t3);
|
||||||
a b
|
a b
|
||||||
W a
|
W a
|
||||||
drop table t1,t2,t3,t4,t5,attend,clinic;
|
drop table if exists inscrit;
|
||||||
|
CREATE TABLE `inscrit` (
|
||||||
|
`pseudo` varchar(35) character set latin1 NOT NULL default '',
|
||||||
|
`email` varchar(60) character set latin1 NOT NULL default '',
|
||||||
|
PRIMARY KEY (`pseudo`),
|
||||||
|
UNIQUE KEY `email` (`email`)
|
||||||
|
) TYPE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC;
|
||||||
|
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 LIKE '%joce%');
|
||||||
|
Subselect returns more than 1 record
|
||||||
|
drop table if exists inscrit;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
select (select 2);
|
select (select 2);
|
||||||
drop table if exists t1,t2,t3,t4,t5,attend,clinic;
|
drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
|
||||||
create table t1 (a int);
|
create table t1 (a int);
|
||||||
create table t2 (a int, b int);
|
create table t2 (a int, b int);
|
||||||
create table t3 (a int);
|
create table t3 (a int);
|
||||||
@ -66,4 +66,19 @@ SELECT * FROM t1 WHERE b = (SELECT MIN(b) FROM t1);
|
|||||||
SELECT * FROM t2 WHERE b = (SELECT MIN(b) FROM t2);
|
SELECT * FROM t2 WHERE b = (SELECT MIN(b) FROM t2);
|
||||||
SELECT * FROM t3 WHERE b = (SELECT MIN(b) FROM t3);
|
SELECT * FROM t3 WHERE b = (SELECT MIN(b) FROM t3);
|
||||||
|
|
||||||
drop table t1,t2,t3,t4,t5,attend,clinic;
|
drop table if exists inscrit;
|
||||||
|
|
||||||
|
CREATE TABLE `inscrit` (
|
||||||
|
`pseudo` varchar(35) character set latin1 NOT NULL default '',
|
||||||
|
`email` varchar(60) character set latin1 NOT NULL default '',
|
||||||
|
PRIMARY KEY (`pseudo`),
|
||||||
|
UNIQUE KEY `email` (`email`)
|
||||||
|
) TYPE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC;
|
||||||
|
|
||||||
|
INSERT INTO inscrit (pseudo,email) VALUES ('joce','test');
|
||||||
|
INSERT INTO inscrit (pseudo,email) VALUES ('joce1','test1');
|
||||||
|
INSERT INTO inscrit (pseudo,email) VALUES ('2joce1','2test1');
|
||||||
|
-- error 1240
|
||||||
|
SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo LIKE '%joce%');
|
||||||
|
|
||||||
|
drop table if exists inscrit;
|
@ -119,21 +119,30 @@ Item::Type Item_subselect::type() const
|
|||||||
double Item_singleval_subselect::val ()
|
double Item_singleval_subselect::val ()
|
||||||
{
|
{
|
||||||
if (engine->exec())
|
if (engine->exec())
|
||||||
|
{
|
||||||
|
assign_null();
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
return real_value;
|
return real_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
longlong Item_singleval_subselect::val_int ()
|
longlong Item_singleval_subselect::val_int ()
|
||||||
{
|
{
|
||||||
if (engine->exec())
|
if (engine->exec())
|
||||||
|
{
|
||||||
|
assign_null();
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
return int_value;
|
return int_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
String *Item_singleval_subselect::val_str (String *str)
|
String *Item_singleval_subselect::val_str (String *str)
|
||||||
{
|
{
|
||||||
if (engine->exec() || null_value)
|
if (engine->exec() || null_value)
|
||||||
|
{
|
||||||
|
assign_null();
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
return &str_value;
|
return &str_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,21 +166,30 @@ void Item_exists_subselect::fix_length_and_dec()
|
|||||||
double Item_exists_subselect::val ()
|
double Item_exists_subselect::val ()
|
||||||
{
|
{
|
||||||
if (engine->exec())
|
if (engine->exec())
|
||||||
|
{
|
||||||
|
assign_null();
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
return (double) value;
|
return (double) value;
|
||||||
}
|
}
|
||||||
|
|
||||||
longlong Item_exists_subselect::val_int ()
|
longlong Item_exists_subselect::val_int ()
|
||||||
{
|
{
|
||||||
if (engine->exec())
|
if (engine->exec())
|
||||||
|
{
|
||||||
|
assign_null();
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
String *Item_exists_subselect::val_str(String *str)
|
String *Item_exists_subselect::val_str(String *str)
|
||||||
{
|
{
|
||||||
if (engine->exec())
|
if (engine->exec())
|
||||||
|
{
|
||||||
|
assign_null();
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
str->set(value);
|
str->set(value);
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user