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
3b073a08
Commit
3b073a08
authored
Feb 27, 2003
by
monty@narttu.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Portability fixes
Don't define crc32 if we are not linking with gzip
parent
9a46698e
Changes
30
Show whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
192 additions
and
55 deletions
+192
-55
.bzrignore
.bzrignore
+1
-0
client/connect_test.c
client/connect_test.c
+0
-1
client/insert_test.c
client/insert_test.c
+0
-1
client/select_test.c
client/select_test.c
+0
-1
cmd-line-utils/libedit/Makefile.am
cmd-line-utils/libedit/Makefile.am
+1
-1
cmd-line-utils/libedit/el.h
cmd-line-utils/libedit/el.h
+1
-1
cmd-line-utils/libedit/key.h
cmd-line-utils/libedit/key.h
+4
-0
cmd-line-utils/libedit/libedit_term.h
cmd-line-utils/libedit/libedit_term.h
+0
-0
cmd-line-utils/libedit/makelist
cmd-line-utils/libedit/makelist
+2
-0
cmd-line-utils/libedit/read.c
cmd-line-utils/libedit/read.c
+4
-0
cmd-line-utils/libedit/readline.c
cmd-line-utils/libedit/readline.c
+7
-4
cmd-line-utils/libedit/readline/readline.h
cmd-line-utils/libedit/readline/readline.h
+1
-2
cmd-line-utils/libedit/sig.c
cmd-line-utils/libedit/sig.c
+3
-3
cmd-line-utils/libedit/sig.h
cmd-line-utils/libedit/sig.h
+3
-1
cmd-line-utils/libedit/term.c
cmd-line-utils/libedit/term.c
+11
-3
heap/_check.c
heap/_check.c
+2
-2
heap/hp_hash.c
heap/hp_hash.c
+8
-5
heap/hp_rkey.c
heap/hp_rkey.c
+2
-1
include/my_global.h
include/my_global.h
+20
-0
libmysql/libmysql.c
libmysql/libmysql.c
+1
-1
mysql-test/r/union.result
mysql-test/r/union.result
+33
-0
mysql-test/t/union.test
mysql-test/t/union.test
+17
-0
sql/gen_lex_hash.cc
sql/gen_lex_hash.cc
+55
-25
sql/gstream.h
sql/gstream.h
+1
-1
sql/item_create.cc
sql/item_create.cc
+3
-0
sql/item_create.h
sql/item_create.h
+2
-0
sql/item_func.cc
sql/item_func.cc
+5
-0
sql/item_func.h
sql/item_func.h
+3
-1
sql/lex.h
sql/lex.h
+2
-0
sql/sql_show.cc
sql/sql_show.cc
+0
-1
No files found.
.bzrignore
View file @
3b073a08
...
...
@@ -601,3 +601,4 @@ vio/test-ssl
vio/test-sslclient
vio/test-sslserver
vio/viotest-ssl
scripts/make_win_src_distribution
client/connect_test.c
View file @
3b073a08
...
...
@@ -16,7 +16,6 @@
#include <stdio.h>
#include <stdlib.h>
#include "my_global.h"
#include "mysql.h"
static
void
change_user
(
MYSQL
*
sock
,
const
char
*
user
,
const
char
*
password
,
...
...
client/insert_test.c
View file @
3b073a08
...
...
@@ -16,7 +16,6 @@
#include <stdio.h>
#include <stdlib.h>
#include "my_global.h"
#include "mysql.h"
#define INSERT_QUERY "insert into test (name,num) values ('item %d', %d)"
...
...
client/select_test.c
View file @
3b073a08
...
...
@@ -19,7 +19,6 @@
#endif
#include <stdio.h>
#include <stdlib.h>
#include "my_global.h"
#include "mysql.h"
#define SELECT_QUERY "select name from test where num = %d"
...
...
cmd-line-utils/libedit/Makefile.am
View file @
3b073a08
...
...
@@ -22,7 +22,7 @@ noinst_HEADERS = chared.h el.h histedit.h key.h \
parse.h refresh.h sig.h sys.h
\
tokenizer.h compat.h compat_conf.h fgetln.h
\
hist.h map.h prompt.h search.h
\
strlcpy.h term.h tty.h
strlcpy.h
libedit_
term.h tty.h
EXTRA_DIST
=
makelist
...
...
cmd-line-utils/libedit/el.h
View file @
3b073a08
...
...
@@ -96,7 +96,7 @@ typedef struct el_state_t {
#include "tty.h"
#include "prompt.h"
#include "key.h"
#include "term.h"
#include "
libedit_
term.h"
#include "refresh.h"
#include "chared.h"
#include "common.h"
...
...
cmd-line-utils/libedit/key.h
View file @
3b073a08
...
...
@@ -62,6 +62,10 @@ typedef struct el_key_t {
#define XK_NOD 2
#define XK_EXE 3
#undef key_end
#undef key_clear
#undef key_print
protected
int
key_init
(
EditLine
*
);
protected
void
key_end
(
EditLine
*
);
protected
key_value_t
*
key_map_cmd
(
EditLine
*
,
int
);
...
...
cmd-line-utils/libedit/term.h
→
cmd-line-utils/libedit/
libedit_
term.h
View file @
3b073a08
File moved
cmd-line-utils/libedit/makelist
View file @
3b073a08
...
...
@@ -87,6 +87,7 @@ case $FLAG in
cat
$FILES
|
$AWK
'
BEGIN {
printf("/* Automatically generated file, do not edit */\n");
printf("#include \"compat.h\"\n");
printf("#include \"sys.h\"\n#include \"el.h\"\n");
printf("private const struct el_bindings_t el_func_help[] = {\n");
low = "abcdefghijklmnopqrstuvwxyz_";
...
...
@@ -169,6 +170,7 @@ case $FLAG in
cat
$FILES
|
$AWK
'/el_action_t/ { print $3 }'
|
sort
|
$AWK
'
BEGIN {
printf("/* Automatically generated file, do not edit */\n");
printf("#include \"compat.h\"\n");
printf("#include \"sys.h\"\n#include \"el.h\"\n");
printf("private const el_func_t el_func[] = {");
maxlen = 80;
...
...
cmd-line-utils/libedit/read.c
View file @
3b073a08
...
...
@@ -55,6 +55,10 @@ private int read_preread(EditLine *);
private
int
read_getcmd
(
EditLine
*
,
el_action_t
*
,
char
*
);
private
int
read_char
(
EditLine
*
,
char
*
);
#ifndef MIN
#define MIN(A,B) ((A) < (B) ? (A) : (B))
#endif
#ifdef DEBUG_EDIT
private
void
read_debug
(
EditLine
*
el
)
...
...
cmd-line-utils/libedit/readline.c
View file @
3b073a08
...
...
@@ -52,6 +52,9 @@
#include "sys.h"
#include "el.h"
#include "fcns.h"
/* for EL_NUM_FCNS */
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
/* for rl_complete() */
#define TAB '\r'
...
...
@@ -389,7 +392,7 @@ _history_expand_command(const char *command, size_t cmdlen, char **result)
*
result
=
NULL
;
cmd
=
alloca
(
cmdlen
+
1
);
cmd
=
(
char
*
)
alloca
(
cmdlen
+
1
);
(
void
)
strncpy
(
cmd
,
command
,
cmdlen
);
cmd
[
cmdlen
]
=
0
;
...
...
@@ -422,7 +425,7 @@ _history_expand_command(const char *command, size_t cmdlen, char **result)
return
(
-
1
);
prefix
=
0
;
}
search
=
alloca
(
len
+
1
);
search
=
(
char
*
)
alloca
(
len
+
1
);
(
void
)
strncpy
(
search
,
&
cmd
[
idx
],
len
);
search
[
len
]
=
'\0'
;
...
...
@@ -662,7 +665,7 @@ history_expand(char *str, char **output)
if
(
str
[
0
]
==
history_subst_char
)
{
/* ^foo^foo2^ is equivalent to !!:s^foo^foo2^ */
temp
=
alloca
(
4
+
strlen
(
str
)
+
1
);
temp
=
(
char
*
)
alloca
(
4
+
strlen
(
str
)
+
1
);
temp
[
0
]
=
temp
[
1
]
=
history_expansion_char
;
temp
[
2
]
=
':'
;
temp
[
3
]
=
's'
;
...
...
@@ -1456,7 +1459,7 @@ rl_complete_internal(int what_to_do)
ctemp
--
;
len
=
li
->
cursor
-
ctemp
;
temp
=
alloca
(
len
+
1
);
temp
=
(
char
*
)
alloca
(
len
+
1
);
(
void
)
strncpy
(
temp
,
ctemp
,
len
);
temp
[
len
]
=
'\0'
;
...
...
cmd-line-utils/libedit/readline/readline.h
View file @
3b073a08
...
...
@@ -41,7 +41,7 @@
#include <sys/types.h>
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#e
lse
#e
ndif
#ifndef __BEGIN_DECLS
#if defined(__cplusplus)
#define __BEGIN_DECLS extern "C" {
...
...
@@ -51,7 +51,6 @@
#define __END_DECLS
#endif
#endif
#endif
/* list of readline stuff supported by editline library's readline wrapper */
...
...
cmd-line-utils/libedit/sig.c
View file @
3b073a08
...
...
@@ -115,9 +115,9 @@ sig_init(EditLine *el)
#undef _DO
(
void
)
sigprocmask
(
SIG_BLOCK
,
&
nset
,
&
oset
);
#define SIGSIZE (sizeof(sighdl) / sizeof(sighdl[0]) * sizeof(sig_t))
#define SIGSIZE (sizeof(sighdl) / sizeof(sighdl[0]) * sizeof(
libedit_
sig_t))
el
->
el_signal
=
(
sig_t
*
)
el_malloc
(
SIGSIZE
);
el
->
el_signal
=
(
el_signal_t
)
el_malloc
(
SIGSIZE
);
if
(
el
->
el_signal
==
NULL
)
return
(
-
1
);
for
(
i
=
0
;
sighdl
[
i
]
!=
-
1
;
i
++
)
...
...
@@ -157,7 +157,7 @@ sig_set(EditLine *el)
(
void
)
sigprocmask
(
SIG_BLOCK
,
&
nset
,
&
oset
);
for
(
i
=
0
;
sighdl
[
i
]
!=
-
1
;
i
++
)
{
sig_t
s
;
libedit_
sig_t
s
;
/* This could happen if we get interrupted */
if
((
s
=
signal
(
sighdl
[
i
],
sig_handler
))
!=
sig_handler
)
el
->
el_signal
[
i
]
=
s
;
...
...
cmd-line-utils/libedit/sig.h
View file @
3b073a08
...
...
@@ -62,7 +62,9 @@
_DO(SIGCONT) \
_DO(SIGWINCH)
typedef
sig_t
*
el_signal_t
;
typedef
RETSIGTYPE
(
*
libedit_sig_t
)();
typedef
libedit_sig_t
*
el_signal_t
;
protected
void
sig_end
(
EditLine
*
);
protected
int
sig_init
(
EditLine
*
);
...
...
cmd-line-utils/libedit/term.c
View file @
3b073a08
...
...
@@ -43,13 +43,19 @@
* We have to declare a static variable here, since the
* termcap putchar routine does not take an argument!
*/
#include "sys.h"
#include <stdio.h>
#include <signal.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#if defined(HAVE_TERMCAP_H)
#include <termcap.h>
#elif defined(HAVE_CURSES_H) && defined(HAVE_TERM_H)
/* For HPUX11 */
#include <curses.h>
#include <term.h>
#endif
#include <sys/types.h>
#include <sys/ioctl.h>
...
...
@@ -891,7 +897,7 @@ term_set(EditLine *el, const char *term)
memset
(
el
->
el_term
.
t_cap
,
0
,
TC_BUFSIZE
);
i
=
tgetent
(
el
->
el_term
.
t_cap
,
term
);
i
=
tgetent
(
el
->
el_term
.
t_cap
,
(
char
*
)
term
);
if
(
i
<=
0
)
{
if
(
i
==
-
1
)
...
...
@@ -921,7 +927,7 @@ term_set(EditLine *el, const char *term)
Val
(
T_co
)
=
tgetnum
(
"co"
);
Val
(
T_li
)
=
tgetnum
(
"li"
);
for
(
t
=
tstr
;
t
->
name
!=
NULL
;
t
++
)
term_alloc
(
el
,
t
,
tgetstr
(
t
->
name
,
&
area
));
term_alloc
(
el
,
t
,
tgetstr
(
(
char
*
)
t
->
name
,
&
area
));
}
if
(
Val
(
T_co
)
<
2
)
...
...
@@ -1061,6 +1067,8 @@ term_reset_arrow(EditLine *el)
static
const
char
stOH
[]
=
{
033
,
'O'
,
'H'
,
'\0'
};
static
const
char
stOF
[]
=
{
033
,
'O'
,
'F'
,
'\0'
};
term_init_arrow
(
el
);
/* Init arrow struct */
key_add
(
el
,
strA
,
&
arrow
[
A_K_UP
].
fun
,
arrow
[
A_K_UP
].
type
);
key_add
(
el
,
strB
,
&
arrow
[
A_K_DN
].
fun
,
arrow
[
A_K_DN
].
type
);
key_add
(
el
,
strC
,
&
arrow
[
A_K_RT
].
fun
,
arrow
[
A_K_RT
].
type
);
...
...
@@ -1421,7 +1429,7 @@ term_echotc(EditLine *el, int argc __attribute__((unused)), const char **argv)
break
;
}
if
(
t
->
name
==
NULL
)
scap
=
tgetstr
(
*
argv
,
&
area
);
scap
=
tgetstr
(
(
char
*
)
*
argv
,
&
area
);
if
(
!
scap
||
scap
[
0
]
==
'\0'
)
{
if
(
!
silent
)
(
void
)
fprintf
(
el
->
el_errfile
,
...
...
heap/_check.c
View file @
3b073a08
...
...
@@ -163,8 +163,8 @@ static int check_one_rb_key(HP_INFO *info, uint keynr, ulong records,
{
memcpy
(
&
recpos
,
key
+
(
*
keydef
->
get_key_length
)(
keydef
,
key
),
sizeof
(
byte
*
));
key_length
=
hp_rb_make_key
(
keydef
,
info
->
recbuf
,
recpos
,
0
);
if
(
ha_key_cmp
(
keydef
->
seg
,
info
->
recbuf
,
key
,
key_length
,
SEARCH_FIND
|
SEARCH_SAME
,
&
not_used
))
if
(
ha_key_cmp
(
keydef
->
seg
,
(
uchar
*
)
info
->
recbuf
,
(
uchar
*
)
key
,
key_length
,
SEARCH_FIND
|
SEARCH_SAME
,
&
not_used
))
{
error
=
1
;
DBUG_PRINT
(
"error"
,(
"Record in wrong link: key: %d Record: %lx
\n
"
,
...
...
heap/hp_hash.c
View file @
3b073a08
...
...
@@ -35,7 +35,8 @@ ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, const byte *start_key,
custom_arg
.
search_flag
=
SEARCH_FIND
|
SEARCH_SAME
;
if
(
start_key
)
{
custom_arg
.
key_length
=
hp_rb_pack_key
(
keyinfo
,
info
->
recbuf
,
start_key
,
custom_arg
.
key_length
=
hp_rb_pack_key
(
keyinfo
,
(
uchar
*
)
info
->
recbuf
,
(
uchar
*
)
start_key
,
start_key_len
);
start_pos
=
tree_record_pos
(
rb_tree
,
info
->
recbuf
,
start_search_flag
,
&
custom_arg
);
...
...
@@ -47,8 +48,8 @@ ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, const byte *start_key,
if
(
end_key
)
{
custom_arg
.
key_length
=
hp_rb_pack_key
(
keyinfo
,
info
->
recbuf
,
end_key
,
end_key_len
);
custom_arg
.
key_length
=
hp_rb_pack_key
(
keyinfo
,
(
uchar
*
)
info
->
recbuf
,
(
uchar
*
)
end_key
,
end_key_len
);
end_pos
=
tree_record_pos
(
rb_tree
,
info
->
recbuf
,
end_search_flag
,
&
custom_arg
);
}
...
...
@@ -370,7 +371,8 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2)
}
if
(
seg
->
type
==
HA_KEYTYPE_TEXT
)
{
if
(
my_strnncoll
(
seg
->
charset
,
rec1
+
seg
->
start
,
seg
->
length
,
rec2
+
seg
->
start
,
seg
->
length
))
if
(
my_strnncoll
(
seg
->
charset
,(
uchar
*
)
rec1
+
seg
->
start
,
seg
->
length
,
(
uchar
*
)
rec2
+
seg
->
start
,
seg
->
length
))
return
1
;
}
else
...
...
@@ -402,7 +404,8 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key)
}
if
(
seg
->
type
==
HA_KEYTYPE_TEXT
)
{
if
(
my_strnncoll
(
seg
->
charset
,
rec
+
seg
->
start
,
seg
->
length
,
key
,
seg
->
length
))
if
(
my_strnncoll
(
seg
->
charset
,(
uchar
*
)
rec
+
seg
->
start
,
seg
->
length
,
(
uchar
*
)
key
,
seg
->
length
))
return
1
;
}
else
...
...
heap/hp_rkey.c
View file @
3b073a08
...
...
@@ -38,7 +38,8 @@ int heap_rkey(HP_INFO *info, byte *record, int inx, const byte *key,
custom_arg
.
keyseg
=
info
->
s
->
keydef
[
inx
].
seg
;
custom_arg
.
key_length
=
info
->
lastkey_len
=
hp_rb_pack_key
(
keyinfo
,
info
->
recbuf
,
key
,
key_len
);
hp_rb_pack_key
(
keyinfo
,
(
uchar
*
)
info
->
recbuf
,
(
uchar
*
)
key
,
key_len
);
custom_arg
.
search_flag
=
SEARCH_FIND
|
SEARCH_SAME
;
/* for next rkey() after deletion */
if
(
find_flag
==
HA_READ_AFTER_KEY
)
...
...
include/my_global.h
View file @
3b073a08
...
...
@@ -110,6 +110,26 @@
#define __STDC_EXT__ 1
/* To get large file support on hpux */
#endif
/*
Fix warnings on HPUX11
There is something really strange with HPUX11 include files as you get
error about wrongly declared symbols or missing defines if you don't
do the following:
*/
#if !defined(_XOPEN_SOURCE_EXTENDED) && ! defined(__cplusplus)
#define _XOPEN_SOURCE_EXTENDED
#endif
/* Fix type of socklen as this is depending on the above define */
#ifdef HPUX11
#undef SOCKET_SIZE_TYPE
#ifdef _XOPEN_SOURCE_EXTENDED
#define SOCKET_SIZE_TYPE socklen_t
#else
#define SOCKET_SIZE_TYPE int
#endif
/* _XOPEN_SOURCE_EXTENDED */
#endif
/* HPUX11 */
#if defined(THREAD) && !defined(__WIN__) && !defined(OS2)
#ifndef _POSIX_PTHREAD_SEMANTICS
#define _POSIX_PTHREAD_SEMANTICS
/* We want posix threads */
...
...
libmysql/libmysql.c
View file @
3b073a08
...
...
@@ -4293,7 +4293,7 @@ static void store_param_str(NET *net, MYSQL_BIND *param)
static
void
store_param_null
(
NET
*
net
,
MYSQL_BIND
*
param
)
{
uint
pos
=
param
->
param_number
;
(
uchar
)
net
->
buff
[
pos
/
8
]
|=
(
1
<<
pos
&
7
);
net
->
buff
[
pos
/
8
]
|=
(
uchar
)
(
1
<<
(
pos
&
7
)
);
}
...
...
mysql-test/r/union.result
View file @
3b073a08
...
...
@@ -230,3 +230,36 @@ id_master id text1 text2
1 3 NULL bar3
1 4 foo4 bar4
drop table if exists t1,t2;
create table t1 (a int not null primary key auto_increment, b int, key(b));
create table t2 (a int not null primary key auto_increment, b int);
insert into t1 (b) values (1),(2),(2),(3);
insert into t2 (b) values (10),(11),(12),(13);
explain (select * from t1 where a=1) union (select * from t2 where a=1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1
2 UNION t2 const PRIMARY PRIMARY 4 const 1
(select * from t1 where a=5) union (select * from t2 where a=1);
a b
1 10
(select * from t1 where a=5 and a=6) union (select * from t2 where a=1);
a b
1 10
(select t1.a,t1.b from t1,t2 where t1.a=5) union (select * from t2 where a=1);
a b
1 10
(select * from t1 where a=1) union (select t1.a,t2.a from t1,t2 where t1.a=t2.a);
a b
1 1
2 2
3 3
4 4
explain (select * from t1 where a=1 and b=10) union (select t1.a,t2.a from t1,t2 where t1.a=t2.a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 UNION t1 index PRIMARY PRIMARY 4 NULL 4 Using index
2 UNION t2 index PRIMARY PRIMARY 4 NULL 4 Using where; Using index
explain (select * from t1 where a=1) union (select * from t1 where b=1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1
2 UNION t1 ref b b 5 const 1 Using where
drop table t1,t2;
mysql-test/t/union.test
View file @
3b073a08
...
...
@@ -124,3 +124,20 @@ INSERT INTO t2 (id, id_master, text1, text2) VALUES("4", "1",
SELECT
1
AS
id_master
,
1
AS
id
,
NULL
AS
text1
,
'ABCDE'
AS
text2
UNION
SELECT
id_master
,
t2
.
id
,
text1
,
text2
FROM
t1
LEFT
JOIN
t2
ON
t1
.
id
=
t2
.
id_master
;
SELECT
1
AS
id_master
,
1
AS
id
,
'ABCDE'
AS
text1
,
'ABCDE'
AS
text2
UNION
SELECT
id_master
,
t2
.
id
,
text1
,
text2
FROM
t1
LEFT
JOIN
t2
ON
t1
.
id
=
t2
.
id_master
;
drop
table
if
exists
t1
,
t2
;
#
# Test of bug when using the same table multiple times
#
create
table
t1
(
a
int
not
null
primary
key
auto_increment
,
b
int
,
key
(
b
));
create
table
t2
(
a
int
not
null
primary
key
auto_increment
,
b
int
);
insert
into
t1
(
b
)
values
(
1
),(
2
),(
2
),(
3
);
insert
into
t2
(
b
)
values
(
10
),(
11
),(
12
),(
13
);
explain
(
select
*
from
t1
where
a
=
1
)
union
(
select
*
from
t2
where
a
=
1
);
(
select
*
from
t1
where
a
=
5
)
union
(
select
*
from
t2
where
a
=
1
);
(
select
*
from
t1
where
a
=
5
and
a
=
6
)
union
(
select
*
from
t2
where
a
=
1
);
(
select
t1
.
a
,
t1
.
b
from
t1
,
t2
where
t1
.
a
=
5
)
union
(
select
*
from
t2
where
a
=
1
);
(
select
*
from
t1
where
a
=
1
)
union
(
select
t1
.
a
,
t2
.
a
from
t1
,
t2
where
t1
.
a
=
t2
.
a
);
explain
(
select
*
from
t1
where
a
=
1
and
b
=
10
)
union
(
select
t1
.
a
,
t2
.
a
from
t1
,
t2
where
t1
.
a
=
t2
.
a
);
explain
(
select
*
from
t1
where
a
=
1
)
union
(
select
*
from
t1
where
b
=
1
);
drop
table
t1
,
t2
;
sql/gen_lex_hash.cc
View file @
3b073a08
...
...
@@ -93,7 +93,7 @@ static struct my_option my_long_options[] =
struct
hash_lex_struct
{
char
first_char
;
int
first_char
;
char
last_char
;
union
{
hash_lex_struct
*
char_tails
;
...
...
@@ -121,18 +121,20 @@ void insert_into_hash(hash_lex_struct *root, const char *name,
{
hash_lex_struct
*
end
,
*
cur
,
*
tails
;
if
(
!
root
->
first_char
){
if
(
!
root
->
first_char
)
{
root
->
first_char
=
-
1
;
root
->
iresult
=
index
;
return
;
}
if
(
root
->
first_char
==-
1
){
if
(
root
->
first_char
==
-
1
)
{
int
index2
=
root
->
iresult
;
const
char
*
name2
=
(
index2
<
0
?
sql_functions
[
-
index2
-
1
]
:
symbols
[
index2
]).
name
+
len_from_begin
;
root
->
first_char
=
name2
[
0
];
root
->
last_char
=
root
->
first_char
;
const
char
*
name2
=
(
index2
<
0
?
sql_functions
[
-
index2
-
1
]
:
symbols
[
index2
]).
name
+
len_from_begin
;
root
->
first_char
=
(
int
)
(
uchar
)
name2
[
0
];
root
->
last_char
=
(
char
)
root
->
first_char
;
tails
=
(
hash_lex_struct
*
)
malloc
(
sizeof
(
hash_lex_struct
));
root
->
char_tails
=
tails
;
tails
->
first_char
=
-
1
;
...
...
@@ -141,7 +143,8 @@ void insert_into_hash(hash_lex_struct *root, const char *name,
size_t
real_size
=
(
root
->
last_char
-
root
->
first_char
+
1
);
if
(
root
->
first_char
>
(
*
name
)){
if
(
root
->
first_char
>
(
*
name
))
{
size_t
new_size
=
root
->
last_char
-
(
*
name
)
+
1
;
if
(
new_size
<
real_size
)
printf
(
"error!!!!
\n
"
);
tails
=
root
->
char_tails
;
...
...
@@ -152,10 +155,11 @@ void insert_into_hash(hash_lex_struct *root, const char *name,
end
=
tails
+
new_size
-
real_size
;
for
(
cur
=
tails
;
cur
<
end
;
cur
++
)
cur
->
first_char
=
0
;
root
->
first_char
=
(
*
name
)
;
root
->
first_char
=
(
int
)
(
uchar
)
*
name
;
}
if
(
root
->
last_char
<
(
*
name
)){
if
(
root
->
last_char
<
(
*
name
))
{
size_t
new_size
=
(
*
name
)
-
root
->
first_char
+
1
;
if
(
new_size
<
real_size
)
printf
(
"error!!!!
\n
"
);
tails
=
root
->
char_tails
;
...
...
@@ -168,10 +172,11 @@ void insert_into_hash(hash_lex_struct *root, const char *name,
root
->
last_char
=
(
*
name
);
}
insert_into_hash
(
root
->
char_tails
+
(
*
name
)
-
root
->
first_char
,
insert_into_hash
(
root
->
char_tails
+
(
*
name
)
-
root
->
first_char
,
name
+
1
,
len_from_begin
+
1
,
index
,
function
);
}
hash_lex_struct
*
root_by_len
=
0
;
int
max_len
=
0
;
...
...
@@ -235,20 +240,22 @@ void add_struct_to_map(hash_lex_struct *st)
st
->
ithis
=
size_hash_map
/
4
;
size_hash_map
+=
4
;
hash_map
=
(
char
*
)
realloc
((
char
*
)
hash_map
,
size_hash_map
);
hash_map
[
size_hash_map
-
4
]
=
st
->
first_char
==-
1
?
0
:
st
->
first_char
;
hash_map
[
size_hash_map
-
3
]
=
st
->
first_char
==-
1
||
st
->
first_char
==
0
?
0
:
st
->
last_char
;
if
(
st
->
first_char
==-
1
)
hash_map
[
size_hash_map
-
4
]
=
(
char
)
(
st
->
first_char
==
-
1
?
0
:
st
->
first_char
);
hash_map
[
size_hash_map
-
3
]
=
(
char
)
(
st
->
first_char
==
-
1
||
st
->
first_char
==
0
?
0
:
st
->
last_char
);
if
(
st
->
first_char
==
-
1
)
{
hash_map
[
size_hash_map
-
2
]
=
((
unsigned
int
)(
int16
)
st
->
iresult
)
&
255
;
hash_map
[
size_hash_map
-
1
]
=
((
unsigned
int
)(
int16
)
st
->
iresult
)
>>
8
;
}
else
if
(
st
->
first_char
==
0
)
else
if
(
st
->
first_char
==
0
)
{
hash_map
[
size_hash_map
-
2
]
=
((
unsigned
int
)(
int16
)
array_elements
(
symbols
))
&
255
;
hash_map
[
size_hash_map
-
1
]
=
((
unsigned
int
)(
int16
)
array_elements
(
symbols
))
>>
8
;
}
};
}
void
add_structs_to_map
(
hash_lex_struct
*
st
,
int
len
)
{
...
...
@@ -256,28 +263,36 @@ void add_structs_to_map(hash_lex_struct *st, int len)
for
(
cur
=
st
;
cur
<
end
;
cur
++
)
add_struct_to_map
(
cur
);
for
(
cur
=
st
;
cur
<
end
;
cur
++
)
if
(
cur
->
first_char
&&
cur
->
first_char
!=-
1
)
{
if
(
cur
->
first_char
&&
cur
->
first_char
!=
-
1
)
add_structs_to_map
(
cur
->
char_tails
,
cur
->
last_char
-
cur
->
first_char
+
1
);
}
}
void
set_links
(
hash_lex_struct
*
st
,
int
len
)
{
hash_lex_struct
*
cur
,
*
end
=
st
+
len
;
for
(
cur
=
st
;
cur
<
end
;
cur
++
)
if
(
cur
->
first_char
!=
0
&&
cur
->
first_char
!=-
1
){
{
if
(
cur
->
first_char
!=
0
&&
cur
->
first_char
!=
-
1
)
{
int
ilink
=
cur
->
char_tails
->
ithis
;
hash_map
[
cur
->
ithis
*
4
+
2
]
=
ilink
%
256
;
hash_map
[
cur
->
ithis
*
4
+
3
]
=
ilink
/
256
;
set_links
(
cur
->
char_tails
,
cur
->
last_char
-
cur
->
first_char
+
1
);
}
}
}
void
print_hash_map
(
const
char
*
name
)
{
printf
(
"uchar %s[%d]= {
\n
"
,
name
,
size_hash_map
);
char
*
cur
;
int
i
;
for
(
i
=
0
,
cur
=
hash_map
;
i
<
size_hash_map
;
i
++
,
cur
++
){
printf
(
"uchar %s[%d]= {
\n
"
,
name
,
size_hash_map
);
for
(
i
=
0
,
cur
=
hash_map
;
i
<
size_hash_map
;
i
++
,
cur
++
)
{
switch
(
i
%
4
){
case
0
:
case
1
:
if
(
!*
cur
)
...
...
@@ -292,6 +307,7 @@ void print_hash_map(const char *name)
printf
(
"};
\n
"
);
}
void
print_find_structs
()
{
add_structs_to_map
(
root_by_len
,
max_len
);
...
...
@@ -308,9 +324,10 @@ void print_find_structs()
print_hash_map
(
"symbols_map"
);
}
static
void
usage
(
int
version
)
{
printf
(
"%s Ver 3.
5
Distrib %s, for %s (%s)
\n
"
,
printf
(
"%s Ver 3.
6
Distrib %s, for %s (%s)
\n
"
,
my_progname
,
MYSQL_SERVER_VERSION
,
SYSTEM_TYPE
,
MACHINE_TYPE
);
if
(
version
)
return
;
...
...
@@ -322,6 +339,7 @@ and you are welcome to modify and redistribute it under the GPL license\n");
my_print_help
(
my_long_options
);
}
extern
"C"
my_bool
get_one_option
(
int
optid
,
const
struct
my_option
*
opt
__attribute__
((
unused
)),
char
*
argument
__attribute__
((
unused
)))
...
...
@@ -338,6 +356,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
return
0
;
}
static
int
get_options
(
int
argc
,
char
**
argv
)
{
int
ho_error
;
...
...
@@ -353,6 +372,7 @@ static int get_options(int argc, char **argv)
return
(
0
);
}
int
check_dup_symbols
(
SYMBOL
*
s1
,
SYMBOL
*
s2
)
{
if
(
s1
->
length
!=
s2
->
length
||
strncmp
(
s1
->
name
,
s2
->
name
,
s1
->
length
))
...
...
@@ -367,6 +387,7 @@ your lex.h has duplicate definition for a symbol \"%s\"\n\n";
return
1
;
}
int
check_duplicates
()
{
SYMBOL
*
cur1
,
*
cur2
,
*
s_end
,
*
f_end
;
...
...
@@ -377,21 +398,29 @@ int check_duplicates()
for
(
cur1
=
symbols
;
cur1
<
s_end
;
cur1
++
)
{
for
(
cur2
=
cur1
+
1
;
cur2
<
s_end
;
cur2
++
)
{
if
(
check_dup_symbols
(
cur1
,
cur2
))
return
1
;
}
for
(
cur2
=
sql_functions
;
cur2
<
f_end
;
cur2
++
)
{
if
(
check_dup_symbols
(
cur1
,
cur2
))
return
1
;
}
}
for
(
cur1
=
sql_functions
;
cur1
<
f_end
;
cur1
++
)
{
for
(
cur2
=
cur1
+
1
;
cur2
<
f_end
;
cur2
++
)
{
if
(
check_dup_symbols
(
cur1
,
cur2
))
return
1
;
}
}
return
0
;
}
int
main
(
int
argc
,
char
**
argv
)
{
MY_INIT
(
argv
[
0
]);
...
...
@@ -443,7 +472,8 @@ int main(int argc,char **argv)
for(;;){
\n
\
register uchar first_char= (uchar)cur_struct;
\n
\
\n
\
if (first_char==0){
\n
\
if (first_char == 0)
\n
\
{
\n
\
register int16 ires= (int16)(cur_struct>>16);
\n
\
if (ires==array_elements(symbols)) return 0;
\n
\
register SYMBOL *res;
\n
\
...
...
sql/gstream.h
View file @
3b073a08
...
...
@@ -26,7 +26,7 @@ public:
numeric
,
l_bra
,
r_bra
,
comma
,
comma
};
GTextReadStream
(
const
char
*
buffer
,
int
size
)
...
...
sql/item_create.cc
View file @
3b073a08
...
...
@@ -103,10 +103,13 @@ Item *create_func_cot(Item* a)
new
Item_func_tan
(
a
));
}
#ifdef HAVE_COMPRESS
Item
*
create_func_crc32
(
Item
*
a
)
{
return
new
Item_func_crc32
(
a
);
}
#endif
Item
*
create_func_date_format
(
Item
*
a
,
Item
*
b
)
{
...
...
sql/item_create.h
View file @
3b073a08
...
...
@@ -32,7 +32,9 @@ Item *create_func_connection_id(void);
Item
*
create_func_conv
(
Item
*
a
,
Item
*
b
,
Item
*
c
);
Item
*
create_func_cos
(
Item
*
a
);
Item
*
create_func_cot
(
Item
*
a
);
#ifdef HAVE_COMPRESS
Item
*
create_func_crc32
(
Item
*
a
);
#endif
Item
*
create_func_date_format
(
Item
*
a
,
Item
*
b
);
Item
*
create_func_dayname
(
Item
*
a
);
Item
*
create_func_dayofmonth
(
Item
*
a
);
...
...
sql/item_func.cc
View file @
3b073a08
...
...
@@ -27,7 +27,9 @@
#include <hash.h>
#include <time.h>
#include <ft_global.h>
#ifdef HAVE_COMPRESS
#include <zlib.h>
#endif
/* return TRUE if item is a constant */
...
...
@@ -965,6 +967,8 @@ longlong Item_func_min_max::val_int()
return
value
;
}
#ifdef HAVE_COMPRESS
longlong
Item_func_crc32
::
val_int
()
{
String
*
res
=
args
[
0
]
->
val_str
(
&
value
);
...
...
@@ -976,6 +980,7 @@ longlong Item_func_crc32::val_int()
null_value
=
0
;
return
(
longlong
)
crc32
(
0L
,
(
Bytef
*
)
res
->
ptr
(),
res
->
length
());
}
#endif
/* HAVE_COMPRESS */
longlong
Item_func_length
::
val_int
()
...
...
sql/item_func.h
View file @
3b073a08
...
...
@@ -549,6 +549,8 @@ public:
const
char
*
func_name
()
const
{
return
"greatest"
;
}
};
#ifdef HAVE_COMPRESS
class
Item_func_crc32
:
public
Item_int_func
{
String
value
;
...
...
@@ -558,7 +560,7 @@ public:
const
char
*
func_name
()
const
{
return
"crc32"
;
}
void
fix_length_and_dec
()
{
max_length
=
10
;
}
};
#endif
class
Item_func_length
:
public
Item_int_func
{
...
...
sql/lex.h
View file @
3b073a08
...
...
@@ -448,7 +448,9 @@ static SYMBOL sql_functions[] = {
{
"COUNT"
,
SYM
(
COUNT_SYM
),
0
,
0
},
{
"COS"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_cos
)},
{
"COT"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_cot
)},
#ifdef HAVE_COMPRESS
{
"CRC32"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_crc32
)},
#endif
{
"CROSSES"
,
SYM
(
FUNC_ARG2
),
0
,
CREATE_FUNC
(
create_func_crosses
)},
{
"CURDATE"
,
SYM
(
CURDATE
),
0
,
0
},
{
"CURTIME"
,
SYM
(
CURTIME
),
0
,
0
},
...
...
sql/sql_show.cc
View file @
3b073a08
...
...
@@ -483,7 +483,6 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild)
(
void
)
sprintf
(
path
,
"%s/%s"
,
mysql_data_home
,
db
);
(
void
)
unpack_dirname
(
path
,
path
);
field_list
.
push_back
(
item
=
new
Item_empty_string
(
"Name"
,
NAME_LEN
));
item
->
maybe_null
=
1
;
field_list
.
push_back
(
item
=
new
Item_empty_string
(
"Type"
,
10
));
item
->
maybe_null
=
1
;
field_list
.
push_back
(
item
=
new
Item_empty_string
(
"Row_format"
,
10
));
...
...
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