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
6dfd1d86
Commit
6dfd1d86
authored
Dec 04, 2002
by
serg@serg.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
merged
parents
8830eb4a
9e61e636
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
15 deletions
+47
-15
libmysql/libmysql.c
libmysql/libmysql.c
+10
-2
mysql-test/t/group_by.test
mysql-test/t/group_by.test
+3
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+15
-3
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+4
-1
sql/mysqld.cc
sql/mysqld.cc
+13
-7
sql/sql_parse.cc
sql/sql_parse.cc
+2
-2
No files found.
libmysql/libmysql.c
View file @
6dfd1d86
...
@@ -348,7 +348,7 @@ net_safe_read(MYSQL *mysql)
...
@@ -348,7 +348,7 @@ net_safe_read(MYSQL *mysql)
DBUG_PRINT
(
"error"
,(
"Wrong connection or packet. fd: %s len: %d"
,
DBUG_PRINT
(
"error"
,(
"Wrong connection or packet. fd: %s len: %d"
,
vio_description
(
net
->
vio
),
len
));
vio_description
(
net
->
vio
),
len
));
end_server
(
mysql
);
end_server
(
mysql
);
net
->
last_errno
=
(
net
->
last_errno
==
ER_NET_PACKET_TOO_LARGE
?
net
->
last_errno
=
(
net
->
last_errno
==
ER_NET_PACKET_TOO_LARGE
?
CR_NET_PACKET_TOO_LARGE:
CR_NET_PACKET_TOO_LARGE:
CR_SERVER_LOST
);
CR_SERVER_LOST
);
strmov
(
net
->
last_error
,
ER
(
net
->
last_errno
));
strmov
(
net
->
last_error
,
ER
(
net
->
last_errno
));
...
@@ -934,7 +934,7 @@ static MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
...
@@ -934,7 +934,7 @@ static MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
ulong
pkt_len
;
ulong
pkt_len
;
ulong
len
;
ulong
len
;
uchar
*
cp
;
uchar
*
cp
;
char
*
to
;
char
*
to
,
*
end_to
;
MYSQL_DATA
*
result
;
MYSQL_DATA
*
result
;
MYSQL_ROWS
**
prev_ptr
,
*
cur
;
MYSQL_ROWS
**
prev_ptr
,
*
cur
;
NET
*
net
=
&
mysql
->
net
;
NET
*
net
=
&
mysql
->
net
;
...
@@ -972,6 +972,7 @@ static MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
...
@@ -972,6 +972,7 @@ static MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
*
prev_ptr
=
cur
;
*
prev_ptr
=
cur
;
prev_ptr
=
&
cur
->
next
;
prev_ptr
=
&
cur
->
next
;
to
=
(
char
*
)
(
cur
->
data
+
fields
+
1
);
to
=
(
char
*
)
(
cur
->
data
+
fields
+
1
);
end_to
=
to
+
pkt_len
-
1
;
for
(
field
=
0
;
field
<
fields
;
field
++
)
for
(
field
=
0
;
field
<
fields
;
field
++
)
{
{
if
((
len
=
(
ulong
)
net_field_length
(
&
cp
))
==
NULL_LENGTH
)
if
((
len
=
(
ulong
)
net_field_length
(
&
cp
))
==
NULL_LENGTH
)
...
@@ -981,6 +982,13 @@ static MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
...
@@ -981,6 +982,13 @@ static MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
else
else
{
{
cur
->
data
[
field
]
=
to
;
cur
->
data
[
field
]
=
to
;
if
(
to
+
len
>
end_to
)
{
free_rows
(
result
);
net
->
last_errno
=
CR_UNKNOWN_ERROR
;
strmov
(
net
->
last_error
,
ER
(
net
->
last_errno
));
DBUG_RETURN
(
0
);
}
memcpy
(
to
,(
char
*
)
cp
,
len
);
to
[
len
]
=
0
;
memcpy
(
to
,(
char
*
)
cp
,
len
);
to
[
len
]
=
0
;
to
+=
len
+
1
;
to
+=
len
+
1
;
cp
+=
len
;
cp
+=
len
;
...
...
mysql-test/t/group_by.test
View file @
6dfd1d86
...
@@ -206,6 +206,7 @@ INSERT INTO t2 VALUES ('Web Interface','AAAAAAAA-AAA','id0001','','');
...
@@ -206,6 +206,7 @@ INSERT INTO t2 VALUES ('Web Interface','AAAAAAAA-AAA','id0001','','');
INSERT
INTO
t2
VALUES
(
'Host communication'
,
'AAAAA'
,
'id0001'
,
''
,
''
);
INSERT
INTO
t2
VALUES
(
'Host communication'
,
'AAAAA'
,
'id0001'
,
''
,
''
);
select
value
,
description
,
bug_id
from
t2
left
join
t1
on
t2
.
program
=
t1
.
product
and
t2
.
value
=
t1
.
component
where
program
=
"AAAAA"
;
select
value
,
description
,
bug_id
from
t2
left
join
t1
on
t2
.
program
=
t1
.
product
and
t2
.
value
=
t1
.
component
where
program
=
"AAAAA"
;
select
value
,
description
,
COUNT
(
bug_id
)
from
t2
left
join
t1
on
t2
.
program
=
t1
.
product
and
t2
.
value
=
t1
.
component
where
program
=
"AAAAA"
group
by
value
;
select
value
,
description
,
COUNT
(
bug_id
)
from
t2
left
join
t1
on
t2
.
program
=
t1
.
product
and
t2
.
value
=
t1
.
component
where
program
=
"AAAAA"
group
by
value
;
select
value
,
description
,
COUNT
(
bug_id
)
from
t2
left
join
t1
on
t2
.
program
=
t1
.
product
and
t2
.
value
=
t1
.
component
where
program
=
"AAAAA"
group
by
value
having
COUNT
(
bug_id
)
IN
(
0
,
2
);
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
...
@@ -234,6 +235,8 @@ CREATE TABLE t1 (
...
@@ -234,6 +235,8 @@ CREATE TABLE t1 (
INSERT
INTO
t1
VALUES
(
1
,
1
,
1
),(
2
,
2
,
2
),(
2
,
1
,
1
),(
3
,
3
,
3
),(
4
,
3
,
3
),(
5
,
3
,
3
);
INSERT
INTO
t1
VALUES
(
1
,
1
,
1
),(
2
,
2
,
2
),(
2
,
1
,
1
),(
3
,
3
,
3
),(
4
,
3
,
3
),(
5
,
3
,
3
);
explain
select
userid
,
count
(
*
)
from
t1
group
by
userid
desc
;
explain
select
userid
,
count
(
*
)
from
t1
group
by
userid
desc
;
select
userid
,
count
(
*
)
from
t1
group
by
userid
desc
;
select
userid
,
count
(
*
)
from
t1
group
by
userid
desc
;
select
userid
,
count
(
*
)
from
t1
group
by
userid
desc
having
(
count
(
*
)
+
1
)
IN
(
4
,
3
);
select
userid
,
count
(
*
)
from
t1
group
by
userid
desc
having
3
IN
(
1
,
COUNT
(
*
));
explain
select
spid
,
count
(
*
)
from
t1
where
spid
between
1
and
2
group
by
spid
desc
;
explain
select
spid
,
count
(
*
)
from
t1
where
spid
between
1
and
2
group
by
spid
desc
;
explain
select
spid
,
count
(
*
)
from
t1
where
spid
between
1
and
2
group
by
spid
;
explain
select
spid
,
count
(
*
)
from
t1
where
spid
between
1
and
2
group
by
spid
;
select
spid
,
count
(
*
)
from
t1
where
spid
between
1
and
2
group
by
spid
;
select
spid
,
count
(
*
)
from
t1
where
spid
between
1
and
2
group
by
spid
;
...
...
sql/item_cmpfunc.cc
View file @
6dfd1d86
...
@@ -1073,6 +1073,18 @@ void Item_func_in::update_used_tables()
...
@@ -1073,6 +1073,18 @@ void Item_func_in::update_used_tables()
const_item_cache
&=
item
->
const_item
();
const_item_cache
&=
item
->
const_item
();
}
}
void
Item_func_in
::
split_sum_func
(
List
<
Item
>
&
fields
)
{
if
(
item
->
with_sum_func
&&
item
->
type
()
!=
SUM_FUNC_ITEM
)
item
->
split_sum_func
(
fields
);
else
if
(
item
->
used_tables
()
||
item
->
type
()
==
SUM_FUNC_ITEM
)
{
fields
.
push_front
(
item
);
item
=
new
Item_ref
((
Item
**
)
fields
.
head_ref
(),
0
,
item
->
name
);
}
Item_func
::
split_sum_func
(
fields
);
}
longlong
Item_func_bit_or
::
val_int
()
longlong
Item_func_bit_or
::
val_int
()
{
{
...
@@ -1289,15 +1301,15 @@ longlong Item_cond_or::val_int()
...
@@ -1289,15 +1301,15 @@ longlong Item_cond_or::val_int()
Item
*
and_expressions
(
Item
*
a
,
Item
*
b
,
Item
**
org_item
)
Item
*
and_expressions
(
Item
*
a
,
Item
*
b
,
Item
**
org_item
)
{
{
if
(
!
a
)
if
(
!
a
)
return
(
*
org_item
=
b
);
return
(
*
org_item
=
(
Item
*
)
b
);
if
(
a
==
*
org_item
)
if
(
a
==
*
org_item
)
{
{
Item_cond
*
res
;
Item_cond
*
res
;
if
((
res
=
new
Item_cond_and
(
a
,
b
)))
if
((
res
=
new
Item_cond_and
(
a
,
(
Item
*
)
b
)))
res
->
used_tables_cache
=
a
->
used_tables
()
|
b
->
used_tables
();
res
->
used_tables_cache
=
a
->
used_tables
()
|
b
->
used_tables
();
return
res
;
return
res
;
}
}
if
(((
Item_cond_and
*
)
a
)
->
add
(
b
))
if
(((
Item_cond_and
*
)
a
)
->
add
(
(
Item
*
)
b
))
return
0
;
return
0
;
((
Item_cond_and
*
)
a
)
->
used_tables_cache
|=
b
->
used_tables
();
((
Item_cond_and
*
)
a
)
->
used_tables_cache
|=
b
->
used_tables
();
return
a
;
return
a
;
...
...
sql/item_cmpfunc.h
View file @
6dfd1d86
...
@@ -425,7 +425,9 @@ class Item_func_in :public Item_int_func
...
@@ -425,7 +425,9 @@ class Item_func_in :public Item_int_func
longlong
val_int
();
longlong
val_int
();
bool
fix_fields
(
THD
*
thd
,
struct
st_table_list
*
tlist
)
bool
fix_fields
(
THD
*
thd
,
struct
st_table_list
*
tlist
)
{
{
return
(
item
->
fix_fields
(
thd
,
tlist
)
||
Item_func
::
fix_fields
(
thd
,
tlist
));
bool
res
=
(
item
->
fix_fields
(
thd
,
tlist
)
||
Item_func
::
fix_fields
(
thd
,
tlist
));
with_sum_func
=
with_sum_func
||
item
->
with_sum_func
;
return
res
;
}
}
void
fix_length_and_dec
();
void
fix_length_and_dec
();
~
Item_func_in
()
{
delete
item
;
delete
array
;
delete
in_item
;
}
~
Item_func_in
()
{
delete
item
;
delete
array
;
delete
in_item
;
}
...
@@ -436,6 +438,7 @@ class Item_func_in :public Item_int_func
...
@@ -436,6 +438,7 @@ class Item_func_in :public Item_int_func
enum
Functype
functype
()
const
{
return
IN_FUNC
;
}
enum
Functype
functype
()
const
{
return
IN_FUNC
;
}
const
char
*
func_name
()
const
{
return
" IN "
;
}
const
char
*
func_name
()
const
{
return
" IN "
;
}
void
update_used_tables
();
void
update_used_tables
();
void
split_sum_func
(
List
<
Item
>
&
fields
);
unsigned
int
size_of
()
{
return
sizeof
(
*
this
);}
unsigned
int
size_of
()
{
return
sizeof
(
*
this
);}
};
};
...
...
sql/mysqld.cc
View file @
6dfd1d86
...
@@ -433,7 +433,7 @@ pthread_attr_t connection_attrib;
...
@@ -433,7 +433,7 @@ pthread_attr_t connection_attrib;
#include <process.h>
#include <process.h>
#if !defined(EMBEDDED_LIBRARY)
#if !defined(EMBEDDED_LIBRARY)
HANDLE
hEventShutdown
;
HANDLE
hEventShutdown
;
static
char
*
event_name
;
static
char
shutdown_event_name
[
40
]
;
#include "nt_servc.h"
#include "nt_servc.h"
static
NTService
Service
;
// Service object for WinNT
static
NTService
Service
;
// Service object for WinNT
#endif
#endif
...
@@ -998,6 +998,7 @@ static void set_root(const char *path)
...
@@ -998,6 +998,7 @@ static void set_root(const char *path)
sql_perror
(
"chroot"
);
sql_perror
(
"chroot"
);
unireg_abort
(
1
);
unireg_abort
(
1
);
}
}
my_setwd
(
"/"
,
MYF
(
0
));
#endif
#endif
}
}
...
@@ -2316,6 +2317,14 @@ bool default_service_handling(char **argv,
...
@@ -2316,6 +2317,14 @@ bool default_service_handling(char **argv,
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
/* When several instances are running on the same machine, we
need to have an unique named hEventShudown through the
application PID e.g.: MySQLShutdown1890; MySQLShutdown2342
*/
int2str
((
int
)
GetCurrentProcessId
(),
strmov
(
shutdown_event_name
,
"MySQLShutdown"
),
10
);
if
(
Service
.
GetOS
())
/* true NT family */
if
(
Service
.
GetOS
())
/* true NT family */
{
{
char
file_path
[
FN_REFLEN
];
char
file_path
[
FN_REFLEN
];
...
@@ -2330,10 +2339,9 @@ int main(int argc, char **argv)
...
@@ -2330,10 +2339,9 @@ int main(int argc, char **argv)
if
(
Service
.
IsService
(
argv
[
1
]))
if
(
Service
.
IsService
(
argv
[
1
]))
{
{
/* start an optional service */
/* start an optional service */
event_name
=
argv
[
1
];
load_default_groups
[
0
]
=
argv
[
1
];
load_default_groups
[
0
]
=
argv
[
1
];
start_mode
=
1
;
start_mode
=
1
;
Service
.
Init
(
event_name
,
mysql_service
);
Service
.
Init
(
argv
[
1
]
,
mysql_service
);
return
0
;
return
0
;
}
}
}
}
...
@@ -2352,9 +2360,8 @@ int main(int argc, char **argv)
...
@@ -2352,9 +2360,8 @@ int main(int argc, char **argv)
use_opt_args
=
1
;
use_opt_args
=
1
;
opt_argc
=
argc
;
opt_argc
=
argc
;
opt_argv
=
argv
;
opt_argv
=
argv
;
event_name
=
argv
[
2
];
start_mode
=
1
;
start_mode
=
1
;
Service
.
Init
(
event_name
,
mysql_service
);
Service
.
Init
(
argv
[
2
]
,
mysql_service
);
return
0
;
return
0
;
}
}
}
}
...
@@ -2374,7 +2381,6 @@ int main(int argc, char **argv)
...
@@ -2374,7 +2381,6 @@ int main(int argc, char **argv)
{
{
/* start the default service */
/* start the default service */
start_mode
=
1
;
start_mode
=
1
;
event_name
=
"MySqlShutdown"
;
Service
.
Init
(
MYSQL_SERVICENAME
,
mysql_service
);
Service
.
Init
(
MYSQL_SERVICENAME
,
mysql_service
);
return
0
;
return
0
;
}
}
...
...
sql/sql_parse.cc
View file @
6dfd1d86
...
@@ -196,6 +196,8 @@ static bool check_user(THD *thd,enum_server_command command, const char *user,
...
@@ -196,6 +196,8 @@ static bool check_user(THD *thd,enum_server_command command, const char *user,
thd
->
db_length
=
0
;
thd
->
db_length
=
0
;
USER_RESOURCES
ur
;
USER_RESOURCES
ur
;
if
(
passwd
[
0
]
&&
strlen
(
passwd
)
!=
SCRAMBLE_LENGTH
)
return
1
;
if
(
!
(
thd
->
user
=
my_strdup
(
user
,
MYF
(
0
))))
if
(
!
(
thd
->
user
=
my_strdup
(
user
,
MYF
(
0
))))
{
{
send_error
(
net
,
ER_OUT_OF_RESOURCES
);
send_error
(
net
,
ER_OUT_OF_RESOURCES
);
...
@@ -596,8 +598,6 @@ check_connections(THD *thd)
...
@@ -596,8 +598,6 @@ check_connections(THD *thd)
char
*
user
=
(
char
*
)
net
->
read_pos
+
5
;
char
*
user
=
(
char
*
)
net
->
read_pos
+
5
;
char
*
passwd
=
strend
(
user
)
+
1
;
char
*
passwd
=
strend
(
user
)
+
1
;
char
*
db
=
0
;
char
*
db
=
0
;
if
(
passwd
[
0
]
&&
strlen
(
passwd
)
!=
SCRAMBLE_LENGTH
)
return
ER_HANDSHAKE_ERROR
;
if
(
thd
->
client_capabilities
&
CLIENT_CONNECT_WITH_DB
)
if
(
thd
->
client_capabilities
&
CLIENT_CONNECT_WITH_DB
)
db
=
strend
(
passwd
)
+
1
;
db
=
strend
(
passwd
)
+
1
;
if
(
thd
->
client_capabilities
&
CLIENT_INTERACTIVE
)
if
(
thd
->
client_capabilities
&
CLIENT_INTERACTIVE
)
...
...
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