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
29510745
Commit
29510745
authored
Sep 17, 2001
by
monty@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug with SELECT * ... UNION
parent
2e63f787
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
47 additions
and
44 deletions
+47
-44
client/mysql.cc
client/mysql.cc
+1
-1
client/mysqltest.c
client/mysqltest.c
+1
-1
include/mysql.h
include/mysql.h
+1
-1
libmysql/libmysql.c
libmysql/libmysql.c
+5
-3
libmysqld/lib_sql.cc
libmysqld/lib_sql.cc
+14
-23
mysql-test/r/union.result
mysql-test/r/union.result
+4
-0
mysql-test/t/union.test
mysql-test/t/union.test
+10
-3
sql/sql_union.cc
sql/sql_union.cc
+11
-12
No files found.
client/mysql.cc
View file @
29510745
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
#include <signal.h>
#include <signal.h>
#include <violite.h>
#include <violite.h>
const
char
*
VER
=
"11.1
5
"
;
const
char
*
VER
=
"11.1
6
"
;
/* Don't try to make a nice table if the data is too big */
/* Don't try to make a nice table if the data is too big */
#define MAX_COLUMN_LENGTH 1024
#define MAX_COLUMN_LENGTH 1024
...
...
client/mysqltest.c
View file @
29510745
...
@@ -1934,7 +1934,7 @@ static void init_var_hash()
...
@@ -1934,7 +1934,7 @@ static void init_var_hash()
static
const
char
*
embedded_server_args
[]
=
{
static
const
char
*
embedded_server_args
[]
=
{
""
,
/* XXX: argv[0] is program name - we should fix the API */
""
,
/* XXX: argv[0] is program name - we should fix the API */
"--datadir=."
,
"--datadir=."
,
"--language=/
home/tim/my/4/sql/share
/english"
,
"--language=/
usr/local/mysql/share/mysql
/english"
,
"--skip-innodb"
,
"--skip-innodb"
,
NullS
NullS
};
};
...
...
include/mysql.h
View file @
29510745
...
@@ -224,7 +224,7 @@ typedef struct st_mysql_res {
...
@@ -224,7 +224,7 @@ typedef struct st_mysql_res {
/* Set up and bring down the server; to ensure that applications will
/* Set up and bring down the server; to ensure that applications will
* work when linked against either the standard client library or the
* work when linked against either the standard client library or the
* embedded server library, these functions should be called. */
* embedded server library, these functions should be called. */
void
mysql_server_init
(
int
argc
,
char
**
argv
,
const
char
**
groups
);
void
mysql_server_init
(
int
argc
,
c
onst
c
har
**
argv
,
const
char
**
groups
);
void
mysql_server_end
();
void
mysql_server_end
();
/* Set up and bring down a thread; these function should be called
/* Set up and bring down a thread; these function should be called
...
...
libmysql/libmysql.c
View file @
29510745
...
@@ -92,10 +92,12 @@ static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to,
...
@@ -92,10 +92,12 @@ static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to,
const
char
*
from
,
ulong
length
);
const
char
*
from
,
ulong
length
);
void
mysql_server_init
(
int
argc
__attribute__
((
unused
)),
void
mysql_server_init
(
int
argc
__attribute__
((
unused
)),
char
**
argv
__attribute__
((
unused
)),
const
char
**
argv
__attribute__
((
unused
)),
const
char
**
groups
__attribute__
((
unused
)))
{}
const
char
**
groups
__attribute__
((
unused
)))
{}
void
mysql_server_end
()
{}
void
mysql_server_end
()
{}
my_bool
mysql_thread_init
()
my_bool
mysql_thread_init
()
{
{
...
...
libmysqld/lib_sql.cc
View file @
29510745
...
@@ -203,10 +203,10 @@ check_connections1(THD *thd)
...
@@ -203,10 +203,10 @@ check_connections1(THD *thd)
static
int
static
int
check_connections2
(
THD
*
thd
)
check_connections2
(
THD
*
thd
)
{
{
uint
connect_errors
=
0
;
uint
connect_errors
=
0
;
uint
pkt_len
=
0
;
uint
pkt_len
=
0
;
NET
*
net
=
&
thd
->
net
;
NET
*
net
=
&
thd
->
net
;
if
(
protocol_version
>
9
)
net
->
return_errno
=
1
;
if
(
protocol_version
>
9
)
net
->
return_errno
=
1
;
if
(
(
pkt_len
=
my_net_read
(
net
))
==
packet_error
||
if
(
(
pkt_len
=
my_net_read
(
net
))
==
packet_error
||
pkt_len
<
MIN_HANDSHAKE_SIZE
)
pkt_len
<
MIN_HANDSHAKE_SIZE
)
...
@@ -245,15 +245,6 @@ if (protocol_version>9) net -> return_errno=1;
...
@@ -245,15 +245,6 @@ if (protocol_version>9) net -> return_errno=1;
}
}
static
bool
check_user
(
THD
*
thd
,
enum_server_command
command
,
const
char
*
user
,
static
bool
check_user
(
THD
*
thd
,
enum_server_command
command
,
const
char
*
user
,
const
char
*
passwd
,
const
char
*
db
,
bool
check_count
)
const
char
*
passwd
,
const
char
*
db
,
bool
check_count
)
{
{
...
@@ -317,7 +308,7 @@ static bool check_user(THD *thd,enum_server_command command, const char *user,
...
@@ -317,7 +308,7 @@ static bool check_user(THD *thd,enum_server_command command, const char *user,
extern
"C"
{
extern
"C"
{
void
mysql_server_init
(
int
argc
,
char
**
argv
,
const
char
**
groups
)
void
mysql_server_init
(
int
argc
,
c
onst
c
har
**
argv
,
const
char
**
groups
)
{
{
char
hostname
[
FN_REFLEN
];
char
hostname
[
FN_REFLEN
];
...
@@ -331,19 +322,19 @@ void mysql_server_init(int argc, char **argv, const char **groups)
...
@@ -331,19 +322,19 @@ void mysql_server_init(int argc, char **argv, const char **groups)
if
(
argc
)
if
(
argc
)
{
{
argcp
=
&
argc
;
argcp
=
&
argc
;
argvp
=
&
argv
;
argvp
=
(
char
***
)
&
argv
;
}
}
else
else
{
{
argcp
=
&
fake_argc
;
argcp
=
&
fake_argc
;
argvp
=
(
char
***
)
&
fake_argv
;
argvp
=
(
char
***
)
&
fake_argv
;
}
}
if
(
!
groups
)
if
(
!
groups
)
groups
=
fake_groups
;
groups
=
fake_groups
;
my_umask
=
0660
;
// Default umask for new files
my_umask
=
0660
;
// Default umask for new files
my_umask_dir
=
0700
;
// Default umask for new directories
my_umask_dir
=
0700
;
// Default umask for new directories
MY_INIT
((
char
*
)
"mysqld
"
);
// init my_sys library & pthreads
MY_INIT
((
char
*
)
"mysqld
_server"
);
// init my_sys library & pthreads
tzset
();
// Set tzname
tzset
();
// Set tzname
start_time
=
time
((
time_t
*
)
0
);
start_time
=
time
((
time_t
*
)
0
);
...
...
mysql-test/r/union.result
View file @
29510745
...
@@ -62,3 +62,7 @@ t2 ALL NULL NULL NULL NULL 4
...
@@ -62,3 +62,7 @@ t2 ALL NULL NULL NULL NULL 4
pseudo
pseudo
dekad
dekad
joce
joce
pseudo pseudo1 same
dekad joce 1
joce testtt 1
joce tsestset 1
mysql-test/t/union.test
View file @
29510745
...
@@ -25,15 +25,21 @@ select a,b from t1 into outfile 'skr' union select a,b from t2;
...
@@ -25,15 +25,21 @@ select a,b from t1 into outfile 'skr' union select a,b from t2;
--
error
1216
--
error
1216
select
a
,
b
from
t1
order
by
a
union
select
a
,
b
from
t2
;
select
a
,
b
from
t1
order
by
a
union
select
a
,
b
from
t2
;
--
error
1217
create
table
t3
select
a
,
b
from
t1
union
select
a
from
t2
;
--
error
1216
--
error
1216
insert
into
t3
select
a
from
t1
order
by
a
union
select
a
from
t2
;
insert
into
t3
select
a
from
t1
order
by
a
union
select
a
from
t2
;
--
error
1217
create
table
t3
select
a
,
b
from
t1
union
select
a
from
t2
;
--
error
1217
--
error
1217
select
a
,
b
from
t1
union
select
a
from
t2
;
select
a
,
b
from
t1
union
select
a
from
t2
;
--
error
1217
select
*
from
t1
union
select
a
from
t2
;
--
error
1217
select
a
from
t1
union
select
*
from
t2
;
# Test CREATE, INSERT and REPLACE
# Test CREATE, INSERT and REPLACE
create
table
t3
select
a
,
b
from
t1
union
all
select
a
,
b
from
t2
;
create
table
t3
select
a
,
b
from
t1
union
all
select
a
,
b
from
t2
;
insert
into
t3
select
a
,
b
from
t1
union
all
select
a
,
b
from
t2
;
insert
into
t3
select
a
,
b
from
t1
union
all
select
a
,
b
from
t2
;
...
@@ -54,4 +60,5 @@ CREATE TABLE t1 (
...
@@ -54,4 +60,5 @@ CREATE TABLE t1 (
)
TYPE
=
MyISAM
;
)
TYPE
=
MyISAM
;
INSERT
INTO
t1
(
pseudo
,
pseudo1
,
same
)
VALUES
(
'joce'
,
'testtt'
,
1
),(
'joce'
,
'tsestset'
,
1
),(
'dekad'
,
'joce'
,
1
);
INSERT
INTO
t1
(
pseudo
,
pseudo1
,
same
)
VALUES
(
'joce'
,
'testtt'
,
1
),(
'joce'
,
'tsestset'
,
1
),(
'dekad'
,
'joce'
,
1
);
SELECT
pseudo
FROM
t1
WHERE
pseudo1
=
'joce'
UNION
SELECT
pseudo
FROM
t1
WHERE
pseudo
=
'joce'
;
SELECT
pseudo
FROM
t1
WHERE
pseudo1
=
'joce'
UNION
SELECT
pseudo
FROM
t1
WHERE
pseudo
=
'joce'
;
SELECT
*
FROM
t1
WHERE
pseudo1
=
'joce'
UNION
SELECT
*
FROM
t1
WHERE
pseudo
=
'joce'
;
drop
table
t1
;
drop
table
t1
;
sql/sql_union.cc
View file @
29510745
...
@@ -35,7 +35,6 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
...
@@ -35,7 +35,6 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
TMP_TABLE_PARAM
tmp_table_param
;
TMP_TABLE_PARAM
tmp_table_param
;
select_union
*
union_result
;
select_union
*
union_result
;
int
res
;
int
res
;
uint
elements
;
DBUG_ENTER
(
"mysql_union"
);
DBUG_ENTER
(
"mysql_union"
);
/* Fix tables--to-be-unioned-from list to point at opened tables */
/* Fix tables--to-be-unioned-from list to point at opened tables */
...
@@ -48,17 +47,9 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
...
@@ -48,17 +47,9 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
}
}
/* Find last select part as it's here ORDER BY and GROUP BY is stored */
/* Find last select part as it's here ORDER BY and GROUP BY is stored */
elements
=
lex
->
select_lex
.
item_list
.
elements
;
for
(
last_sl
=
&
lex
->
select_lex
;
for
(
last_sl
=
&
lex
->
select_lex
;
last_sl
->
next
;
last_sl
->
next
;
last_sl
=
last_sl
->
next
)
last_sl
=
last_sl
->
next
)
;
{
if
(
elements
!=
last_sl
->
next
->
item_list
.
elements
)
{
my_error
(
ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT
,
MYF
(
0
));
return
-
1
;
}
}
if
(
lex
->
select_lex
.
options
&
SELECT_DESCRIBE
)
if
(
lex
->
select_lex
.
options
&
SELECT_DESCRIBE
)
{
{
...
@@ -93,8 +84,9 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
...
@@ -93,8 +84,9 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
if
(
setup_fields
(
thd
,
first_table
,
item_list
,
0
,
0
,
1
))
if
(
setup_fields
(
thd
,
first_table
,
item_list
,
0
,
0
,
1
))
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
-
1
);
}
}
bzero
((
char
*
)
&
tmp_table_param
,
sizeof
(
tmp_table_param
));
bzero
((
char
*
)
&
tmp_table_param
,
sizeof
(
tmp_table_param
));
tmp_table_param
.
field_count
=
elements
;
tmp_table_param
.
field_count
=
item_list
.
elements
;
if
(
!
(
table
=
create_tmp_table
(
thd
,
&
tmp_table_param
,
item_list
,
if
(
!
(
table
=
create_tmp_table
(
thd
,
&
tmp_table_param
,
item_list
,
(
ORDER
*
)
0
,
!
lex
->
union_option
,
(
ORDER
*
)
0
,
!
lex
->
union_option
,
1
,
0
,
1
,
0
,
...
@@ -188,8 +180,15 @@ select_union::~select_union()
...
@@ -188,8 +180,15 @@ select_union::~select_union()
{
{
}
}
int
select_union
::
prepare
(
List
<
Item
>
&
list
)
int
select_union
::
prepare
(
List
<
Item
>
&
list
)
{
{
if
(
list
.
elements
!=
table
->
fields
)
{
my_message
(
ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT
,
ER
(
ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT
),
MYF
(
0
));
return
-
1
;
}
return
0
;
return
0
;
}
}
...
...
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