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
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
Hide 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 @@
#include <signal.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 */
#define MAX_COLUMN_LENGTH 1024
...
...
client/mysqltest.c
View file @
29510745
...
...
@@ -1934,7 +1934,7 @@ static void init_var_hash()
static
const
char
*
embedded_server_args
[]
=
{
""
,
/* XXX: argv[0] is program name - we should fix the API */
"--datadir=."
,
"--language=/
home/tim/my/4/sql/share
/english"
,
"--language=/
usr/local/mysql/share/mysql
/english"
,
"--skip-innodb"
,
NullS
};
...
...
include/mysql.h
View file @
29510745
...
...
@@ -224,7 +224,7 @@ typedef struct st_mysql_res {
/* Set up and bring down the server; to ensure that applications will
* work when linked against either the standard client library or the
* 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
();
/* 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,
const
char
*
from
,
ulong
length
);
void
mysql_server_init
(
int
argc
__attribute__
((
unused
)),
char
**
argv
__attribute__
((
unused
)),
const
char
**
groups
__attribute__
((
unused
)))
{}
const
char
**
argv
__attribute__
((
unused
)),
const
char
**
groups
__attribute__
((
unused
)))
{}
void
mysql_server_end
()
{}
void
mysql_server_end
()
{}
my_bool
mysql_thread_init
()
{
...
...
libmysqld/lib_sql.cc
View file @
29510745
...
...
@@ -203,17 +203,17 @@ check_connections1(THD *thd)
static
int
check_connections2
(
THD
*
thd
)
{
uint
connect_errors
=
0
;
uint
pkt_len
=
0
;
NET
*
net
=
&
thd
->
net
;
if
(
protocol_version
>
9
)
net
->
return_errno
=
1
;
uint
connect_errors
=
0
;
uint
pkt_len
=
0
;
NET
*
net
=
&
thd
->
net
;
if
(
protocol_version
>
9
)
net
->
return_errno
=
1
;
if
(
(
pkt_len
=
my_net_read
(
net
))
==
packet_error
||
pkt_len
<
MIN_HANDSHAKE_SIZE
)
{
inc_host_errors
(
&
thd
->
remote
.
sin_addr
);
return
(
ER_HANDSHAKE_ERROR
);
}
if
(
(
pkt_len
=
my_net_read
(
net
))
==
packet_error
||
pkt_len
<
MIN_HANDSHAKE_SIZE
)
{
inc_host_errors
(
&
thd
->
remote
.
sin_addr
);
return
(
ER_HANDSHAKE_ERROR
);
}
#ifdef _CUSTOMCONFIG_
#include "_cust_sql_parse.h"
...
...
@@ -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
,
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,
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
];
...
...
@@ -331,19 +322,19 @@ void mysql_server_init(int argc, char **argv, const char **groups)
if
(
argc
)
{
argcp
=
&
argc
;
argvp
=
&
argv
;
argvp
=
(
char
***
)
&
argv
;
}
else
{
argcp
=
&
fake_argc
;
argvp
=
(
char
***
)
&
fake_argv
;
argvp
=
(
char
***
)
&
fake_argv
;
}
if
(
!
groups
)
groups
=
fake_groups
;
my_umask
=
0660
;
// Default umask for new files
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
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
pseudo
dekad
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;
--
error
1216
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
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
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
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
;
...
...
@@ -54,4 +60,5 @@ CREATE TABLE t1 (
)
TYPE
=
MyISAM
;
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
*
FROM
t1
WHERE
pseudo1
=
'joce'
UNION
SELECT
*
FROM
t1
WHERE
pseudo
=
'joce'
;
drop
table
t1
;
sql/sql_union.cc
View file @
29510745
...
...
@@ -35,7 +35,6 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
TMP_TABLE_PARAM
tmp_table_param
;
select_union
*
union_result
;
int
res
;
uint
elements
;
DBUG_ENTER
(
"mysql_union"
);
/* 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)
}
/* 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
;
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
;
}
}
last_sl
=
last_sl
->
next
)
;
if
(
lex
->
select_lex
.
options
&
SELECT_DESCRIBE
)
{
...
...
@@ -78,7 +69,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
result
);
}
DBUG_RETURN
(
0
);
}
}
order
=
(
ORDER
*
)
last_sl
->
order_list
.
first
;
{
...
...
@@ -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
))
DBUG_RETURN
(
-
1
);
}
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
,
(
ORDER
*
)
0
,
!
lex
->
union_option
,
1
,
0
,
...
...
@@ -188,8 +180,15 @@ select_union::~select_union()
{
}
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
;
}
...
...
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