Commit ea058779 authored by unknown's avatar unknown

Merge work:/my/mysql-4.1 into narttu.mysql.fi:/my/mysql-4.1


sql/item_func.cc:
  Auto merged
sql/lex.h:
  Auto merged
sql/sql_show.cc:
  Auto merged
parents 2eab6ae6 e943ca1f
...@@ -601,3 +601,4 @@ vio/test-ssl ...@@ -601,3 +601,4 @@ vio/test-ssl
vio/test-sslclient vio/test-sslclient
vio/test-sslserver vio/test-sslserver
vio/viotest-ssl vio/viotest-ssl
scripts/make_win_src_distribution
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "my_global.h"
#include "mysql.h" #include "mysql.h"
static void change_user(MYSQL *sock,const char *user, const char *password, static void change_user(MYSQL *sock,const char *user, const char *password,
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "my_global.h"
#include "mysql.h" #include "mysql.h"
#define INSERT_QUERY "insert into test (name,num) values ('item %d', %d)" #define INSERT_QUERY "insert into test (name,num) values ('item %d', %d)"
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "my_global.h"
#include "mysql.h" #include "mysql.h"
#define SELECT_QUERY "select name from test where num = %d" #define SELECT_QUERY "select name from test where num = %d"
......
...@@ -22,7 +22,7 @@ noinst_HEADERS = chared.h el.h histedit.h key.h \ ...@@ -22,7 +22,7 @@ noinst_HEADERS = chared.h el.h histedit.h key.h \
parse.h refresh.h sig.h sys.h \ parse.h refresh.h sig.h sys.h \
tokenizer.h compat.h compat_conf.h fgetln.h \ tokenizer.h compat.h compat_conf.h fgetln.h \
hist.h map.h prompt.h search.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 EXTRA_DIST = makelist
......
...@@ -96,7 +96,7 @@ typedef struct el_state_t { ...@@ -96,7 +96,7 @@ typedef struct el_state_t {
#include "tty.h" #include "tty.h"
#include "prompt.h" #include "prompt.h"
#include "key.h" #include "key.h"
#include "term.h" #include "libedit_term.h"
#include "refresh.h" #include "refresh.h"
#include "chared.h" #include "chared.h"
#include "common.h" #include "common.h"
......
...@@ -62,6 +62,10 @@ typedef struct el_key_t { ...@@ -62,6 +62,10 @@ typedef struct el_key_t {
#define XK_NOD 2 #define XK_NOD 2
#define XK_EXE 3 #define XK_EXE 3
#undef key_end
#undef key_clear
#undef key_print
protected int key_init(EditLine *); protected int key_init(EditLine *);
protected void key_end(EditLine *); protected void key_end(EditLine *);
protected key_value_t *key_map_cmd(EditLine *, int); protected key_value_t *key_map_cmd(EditLine *, int);
......
...@@ -87,6 +87,7 @@ case $FLAG in ...@@ -87,6 +87,7 @@ case $FLAG in
cat $FILES | $AWK ' cat $FILES | $AWK '
BEGIN { BEGIN {
printf("/* Automatically generated file, do not edit */\n"); printf("/* Automatically generated file, do not edit */\n");
printf("#include \"compat.h\"\n");
printf("#include \"sys.h\"\n#include \"el.h\"\n"); printf("#include \"sys.h\"\n#include \"el.h\"\n");
printf("private const struct el_bindings_t el_func_help[] = {\n"); printf("private const struct el_bindings_t el_func_help[] = {\n");
low = "abcdefghijklmnopqrstuvwxyz_"; low = "abcdefghijklmnopqrstuvwxyz_";
...@@ -169,6 +170,7 @@ case $FLAG in ...@@ -169,6 +170,7 @@ case $FLAG in
cat $FILES | $AWK '/el_action_t/ { print $3 }' | sort | $AWK ' cat $FILES | $AWK '/el_action_t/ { print $3 }' | sort | $AWK '
BEGIN { BEGIN {
printf("/* Automatically generated file, do not edit */\n"); printf("/* Automatically generated file, do not edit */\n");
printf("#include \"compat.h\"\n");
printf("#include \"sys.h\"\n#include \"el.h\"\n"); printf("#include \"sys.h\"\n#include \"el.h\"\n");
printf("private const el_func_t el_func[] = {"); printf("private const el_func_t el_func[] = {");
maxlen = 80; maxlen = 80;
......
...@@ -55,6 +55,10 @@ private int read_preread(EditLine *); ...@@ -55,6 +55,10 @@ private int read_preread(EditLine *);
private int read_getcmd(EditLine *, el_action_t *, char *); private int read_getcmd(EditLine *, el_action_t *, char *);
private int read_char(EditLine *, char *); private int read_char(EditLine *, char *);
#ifndef MIN
#define MIN(A,B) ((A) < (B) ? (A) : (B))
#endif
#ifdef DEBUG_EDIT #ifdef DEBUG_EDIT
private void private void
read_debug(EditLine *el) read_debug(EditLine *el)
......
...@@ -52,6 +52,9 @@ ...@@ -52,6 +52,9 @@
#include "sys.h" #include "sys.h"
#include "el.h" #include "el.h"
#include "fcns.h" /* for EL_NUM_FCNS */ #include "fcns.h" /* for EL_NUM_FCNS */
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
/* for rl_complete() */ /* for rl_complete() */
#define TAB '\r' #define TAB '\r'
...@@ -389,7 +392,7 @@ _history_expand_command(const char *command, size_t cmdlen, char **result) ...@@ -389,7 +392,7 @@ _history_expand_command(const char *command, size_t cmdlen, char **result)
*result = NULL; *result = NULL;
cmd = alloca(cmdlen + 1); cmd = (char*) alloca(cmdlen + 1);
(void) strncpy(cmd, command, cmdlen); (void) strncpy(cmd, command, cmdlen);
cmd[cmdlen] = 0; cmd[cmdlen] = 0;
...@@ -422,7 +425,7 @@ _history_expand_command(const char *command, size_t cmdlen, char **result) ...@@ -422,7 +425,7 @@ _history_expand_command(const char *command, size_t cmdlen, char **result)
return (-1); return (-1);
prefix = 0; prefix = 0;
} }
search = alloca(len + 1); search = (char*) alloca(len + 1);
(void) strncpy(search, &cmd[idx], len); (void) strncpy(search, &cmd[idx], len);
search[len] = '\0'; search[len] = '\0';
...@@ -662,7 +665,7 @@ history_expand(char *str, char **output) ...@@ -662,7 +665,7 @@ history_expand(char *str, char **output)
if (str[0] == history_subst_char) { if (str[0] == history_subst_char) {
/* ^foo^foo2^ is equivalent to !!:s^foo^foo2^ */ /* ^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[0] = temp[1] = history_expansion_char;
temp[2] = ':'; temp[2] = ':';
temp[3] = 's'; temp[3] = 's';
...@@ -1456,7 +1459,7 @@ rl_complete_internal(int what_to_do) ...@@ -1456,7 +1459,7 @@ rl_complete_internal(int what_to_do)
ctemp--; ctemp--;
len = li->cursor - ctemp; len = li->cursor - ctemp;
temp = alloca(len + 1); temp = (char*) alloca(len + 1);
(void) strncpy(temp, ctemp, len); (void) strncpy(temp, ctemp, len);
temp[len] = '\0'; temp[len] = '\0';
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#include <sys/types.h> #include <sys/types.h>
#if HAVE_SYS_CDEFS_H #if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h> #include <sys/cdefs.h>
#else #endif
#ifndef __BEGIN_DECLS #ifndef __BEGIN_DECLS
#if defined(__cplusplus) #if defined(__cplusplus)
#define __BEGIN_DECLS extern "C" { #define __BEGIN_DECLS extern "C" {
...@@ -51,7 +51,6 @@ ...@@ -51,7 +51,6 @@
#define __END_DECLS #define __END_DECLS
#endif #endif
#endif #endif
#endif
/* list of readline stuff supported by editline library's readline wrapper */ /* list of readline stuff supported by editline library's readline wrapper */
......
...@@ -115,9 +115,9 @@ sig_init(EditLine *el) ...@@ -115,9 +115,9 @@ sig_init(EditLine *el)
#undef _DO #undef _DO
(void) sigprocmask(SIG_BLOCK, &nset, &oset); (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) if (el->el_signal == NULL)
return (-1); return (-1);
for (i = 0; sighdl[i] != -1; i++) for (i = 0; sighdl[i] != -1; i++)
...@@ -157,7 +157,7 @@ sig_set(EditLine *el) ...@@ -157,7 +157,7 @@ sig_set(EditLine *el)
(void) sigprocmask(SIG_BLOCK, &nset, &oset); (void) sigprocmask(SIG_BLOCK, &nset, &oset);
for (i = 0; sighdl[i] != -1; i++) { for (i = 0; sighdl[i] != -1; i++) {
sig_t s; libedit_sig_t s;
/* This could happen if we get interrupted */ /* This could happen if we get interrupted */
if ((s = signal(sighdl[i], sig_handler)) != sig_handler) if ((s = signal(sighdl[i], sig_handler)) != sig_handler)
el->el_signal[i] = s; el->el_signal[i] = s;
......
...@@ -62,7 +62,9 @@ ...@@ -62,7 +62,9 @@
_DO(SIGCONT) \ _DO(SIGCONT) \
_DO(SIGWINCH) _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 void sig_end(EditLine*);
protected int sig_init(EditLine*); protected int sig_init(EditLine*);
......
...@@ -43,13 +43,19 @@ ...@@ -43,13 +43,19 @@
* We have to declare a static variable here, since the * We have to declare a static variable here, since the
* termcap putchar routine does not take an argument! * termcap putchar routine does not take an argument!
*/ */
#include "sys.h" #include "sys.h"
#include <stdio.h> #include <stdio.h>
#include <signal.h> #include <signal.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#if defined(HAVE_TERMCAP_H)
#include <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/types.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
...@@ -891,7 +897,7 @@ term_set(EditLine *el, const char *term) ...@@ -891,7 +897,7 @@ term_set(EditLine *el, const char *term)
memset(el->el_term.t_cap, 0, TC_BUFSIZE); 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 <= 0) {
if (i == -1) if (i == -1)
...@@ -921,7 +927,7 @@ term_set(EditLine *el, const char *term) ...@@ -921,7 +927,7 @@ term_set(EditLine *el, const char *term)
Val(T_co) = tgetnum("co"); Val(T_co) = tgetnum("co");
Val(T_li) = tgetnum("li"); Val(T_li) = tgetnum("li");
for (t = tstr; t->name != NULL; t++) 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) if (Val(T_co) < 2)
...@@ -1061,6 +1067,8 @@ term_reset_arrow(EditLine *el) ...@@ -1061,6 +1067,8 @@ term_reset_arrow(EditLine *el)
static const char stOH[] = {033, 'O', 'H', '\0'}; static const char stOH[] = {033, 'O', 'H', '\0'};
static const char stOF[] = {033, 'O', 'F', '\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, 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, 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); 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) ...@@ -1421,7 +1429,7 @@ term_echotc(EditLine *el, int argc __attribute__((unused)), const char **argv)
break; break;
} }
if (t->name == NULL) if (t->name == NULL)
scap = tgetstr(*argv, &area); scap = tgetstr((char*) *argv, &area);
if (!scap || scap[0] == '\0') { if (!scap || scap[0] == '\0') {
if (!silent) if (!silent)
(void) fprintf(el->el_errfile, (void) fprintf(el->el_errfile,
......
...@@ -163,8 +163,8 @@ static int check_one_rb_key(HP_INFO *info, uint keynr, ulong records, ...@@ -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*)); memcpy(&recpos, key + (*keydef->get_key_length)(keydef,key), sizeof(byte*));
key_length= hp_rb_make_key(keydef, info->recbuf, recpos, 0); key_length= hp_rb_make_key(keydef, info->recbuf, recpos, 0);
if (ha_key_cmp(keydef->seg, info->recbuf, key, key_length, if (ha_key_cmp(keydef->seg, (uchar*) info->recbuf, (uchar*) key,
SEARCH_FIND | SEARCH_SAME, &not_used)) key_length, SEARCH_FIND | SEARCH_SAME, &not_used))
{ {
error= 1; error= 1;
DBUG_PRINT("error",("Record in wrong link: key: %d Record: %lx\n", DBUG_PRINT("error",("Record in wrong link: key: %d Record: %lx\n",
......
...@@ -35,7 +35,8 @@ ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, const byte *start_key, ...@@ -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; custom_arg.search_flag= SEARCH_FIND | SEARCH_SAME;
if (start_key) 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_key_len);
start_pos= tree_record_pos(rb_tree, info->recbuf, start_search_flag, start_pos= tree_record_pos(rb_tree, info->recbuf, start_search_flag,
&custom_arg); &custom_arg);
...@@ -47,8 +48,8 @@ ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, const byte *start_key, ...@@ -47,8 +48,8 @@ ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, const byte *start_key,
if (end_key) if (end_key)
{ {
custom_arg.key_length= hp_rb_pack_key(keyinfo, info->recbuf, end_key, custom_arg.key_length= hp_rb_pack_key(keyinfo, (uchar*) info->recbuf,
end_key_len); (uchar*) end_key, end_key_len);
end_pos= tree_record_pos(rb_tree, info->recbuf, end_search_flag, end_pos= tree_record_pos(rb_tree, info->recbuf, end_search_flag,
&custom_arg); &custom_arg);
} }
...@@ -370,7 +371,8 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2) ...@@ -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 (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; return 1;
} }
else else
...@@ -402,7 +404,8 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key) ...@@ -402,7 +404,8 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key)
} }
if (seg->type == HA_KEYTYPE_TEXT) 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; return 1;
} }
else else
......
...@@ -38,7 +38,8 @@ int heap_rkey(HP_INFO *info, byte *record, int inx, const byte *key, ...@@ -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.keyseg= info->s->keydef[inx].seg;
custom_arg.key_length= info->lastkey_len= 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; custom_arg.search_flag= SEARCH_FIND | SEARCH_SAME;
/* for next rkey() after deletion */ /* for next rkey() after deletion */
if (find_flag == HA_READ_AFTER_KEY) if (find_flag == HA_READ_AFTER_KEY)
......
...@@ -110,6 +110,26 @@ ...@@ -110,6 +110,26 @@
#define __STDC_EXT__ 1 /* To get large file support on hpux */ #define __STDC_EXT__ 1 /* To get large file support on hpux */
#endif #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) #if defined(THREAD) && !defined(__WIN__) && !defined(OS2)
#ifndef _POSIX_PTHREAD_SEMANTICS #ifndef _POSIX_PTHREAD_SEMANTICS
#define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */ #define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */
......
...@@ -4293,7 +4293,7 @@ static void store_param_str(NET *net, MYSQL_BIND *param) ...@@ -4293,7 +4293,7 @@ static void store_param_str(NET *net, MYSQL_BIND *param)
static void store_param_null(NET *net, MYSQL_BIND *param) static void store_param_null(NET *net, MYSQL_BIND *param)
{ {
uint pos= param->param_number; uint pos= param->param_number;
(uchar) net->buff[pos/8]|= (1 << pos & 7); net->buff[pos/8]|= (uchar) (1 << (pos & 7));
} }
......
...@@ -7,13 +7,13 @@ select 9223372036854775807,-009223372036854775808; ...@@ -7,13 +7,13 @@ select 9223372036854775807,-009223372036854775808;
9223372036854775807 -9223372036854775808 9223372036854775807 -9223372036854775808
select +9999999999999999999,-9999999999999999999; select +9999999999999999999,-9999999999999999999;
+9999999999999999999 -9999999999999999999 +9999999999999999999 -9999999999999999999
10000000000000000000 -10000000000000000000 9999999999999999999 -10000000000000000000
select cast(9223372036854775808 as unsigned)+1; select cast(9223372036854775808 as unsigned)+1;
cast(9223372036854775808 as unsigned)+1 cast(9223372036854775808 as unsigned)+1
9223372036854775809 9223372036854775809
select 9223372036854775808+1; select 9223372036854775808+1;
9223372036854775808+1 9223372036854775808+1
9223372036854775808 9223372036854775809
create table t1 (a bigint unsigned not null, primary key(a)); create table t1 (a bigint unsigned not null, primary key(a));
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE); insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE);
select * from t1; select * from t1;
......
...@@ -230,3 +230,36 @@ id_master id text1 text2 ...@@ -230,3 +230,36 @@ id_master id text1 text2
1 3 NULL bar3 1 3 NULL bar3
1 4 foo4 bar4 1 4 foo4 bar4
drop table if exists t1,t2; 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;
...@@ -12,12 +12,6 @@ select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296; ...@@ -12,12 +12,6 @@ select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296;
select 9223372036854775807,-009223372036854775808; select 9223372036854775807,-009223372036854775808;
select +9999999999999999999,-9999999999999999999; select +9999999999999999999,-9999999999999999999;
select cast(9223372036854775808 as unsigned)+1; select cast(9223372036854775808 as unsigned)+1;
#
# We need to do a REPLACE here as the atof() function returns different
# values on True64 and HPUX11
#
--replace_result 9223372036854775800 9223372036854775808
select 9223372036854775808+1; select 9223372036854775808+1;
# #
# In 3.23 we have to disable the test of column to bigint as # In 3.23 we have to disable the test of column to bigint as
......
...@@ -124,3 +124,20 @@ INSERT INTO t2 (id, id_master, text1, text2) VALUES("4", "1", ...@@ -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, 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; 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; 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;
...@@ -93,7 +93,7 @@ static struct my_option my_long_options[] = ...@@ -93,7 +93,7 @@ static struct my_option my_long_options[] =
struct hash_lex_struct struct hash_lex_struct
{ {
char first_char; int first_char;
char last_char; char last_char;
union{ union{
hash_lex_struct *char_tails; hash_lex_struct *char_tails;
...@@ -121,18 +121,20 @@ void insert_into_hash(hash_lex_struct *root, const char *name, ...@@ -121,18 +121,20 @@ void insert_into_hash(hash_lex_struct *root, const char *name,
{ {
hash_lex_struct *end, *cur, *tails; hash_lex_struct *end, *cur, *tails;
if (!root->first_char){ if (!root->first_char)
{
root->first_char= -1; root->first_char= -1;
root->iresult= index; root->iresult= index;
return; return;
} }
if (root->first_char==-1){ if (root->first_char == -1)
{
int index2= root->iresult; int index2= root->iresult;
const char *name2= const char *name2= (index2 < 0 ? sql_functions[-index2-1] :
(index2<0 ? sql_functions[-index2-1] : symbols[index2]).name + len_from_begin; symbols[index2]).name + len_from_begin;
root->first_char= name2[0]; root->first_char= (int) (uchar) name2[0];
root->last_char= root->first_char; root->last_char= (char) root->first_char;
tails= (hash_lex_struct*)malloc(sizeof(hash_lex_struct)); tails= (hash_lex_struct*)malloc(sizeof(hash_lex_struct));
root->char_tails= tails; root->char_tails= tails;
tails->first_char= -1; tails->first_char= -1;
...@@ -141,7 +143,8 @@ void insert_into_hash(hash_lex_struct *root, const char *name, ...@@ -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); 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; size_t new_size= root->last_char-(*name)+1;
if (new_size<real_size) printf("error!!!!\n"); if (new_size<real_size) printf("error!!!!\n");
tails= root->char_tails; tails= root->char_tails;
...@@ -152,10 +155,11 @@ void insert_into_hash(hash_lex_struct *root, const char *name, ...@@ -152,10 +155,11 @@ void insert_into_hash(hash_lex_struct *root, const char *name,
end= tails + new_size - real_size; end= tails + new_size - real_size;
for (cur= tails; cur<end; cur++) for (cur= tails; cur<end; cur++)
cur->first_char= 0; 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; size_t new_size= (*name)-root->first_char+1;
if (new_size<real_size) printf("error!!!!\n"); if (new_size<real_size) printf("error!!!!\n");
tails= root->char_tails; tails= root->char_tails;
...@@ -168,10 +172,11 @@ void insert_into_hash(hash_lex_struct *root, const char *name, ...@@ -168,10 +172,11 @@ void insert_into_hash(hash_lex_struct *root, const char *name,
root->last_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); name+1,len_from_begin+1,index,function);
} }
hash_lex_struct *root_by_len= 0; hash_lex_struct *root_by_len= 0;
int max_len=0; int max_len=0;
...@@ -235,20 +240,22 @@ void add_struct_to_map(hash_lex_struct *st) ...@@ -235,20 +240,22 @@ void add_struct_to_map(hash_lex_struct *st)
st->ithis= size_hash_map/4; st->ithis= size_hash_map/4;
size_hash_map+= 4; size_hash_map+= 4;
hash_map= (char*)realloc((char*)hash_map,size_hash_map); 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-4]= (char) (st->first_char == -1 ? 0 :
hash_map[size_hash_map-3]= st->first_char);
st->first_char==-1 || st->first_char==0 ? 0 : st->last_char; hash_map[size_hash_map-3]= (char) (st->first_char == -1 ||
if (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-2]= ((unsigned int)(int16)st->iresult)&255;
hash_map[size_hash_map-1]= ((unsigned int)(int16)st->iresult)>>8; 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-2]= ((unsigned int)(int16)array_elements(symbols))&255;
hash_map[size_hash_map-1]= ((unsigned int)(int16)array_elements(symbols))>>8; hash_map[size_hash_map-1]= ((unsigned int)(int16)array_elements(symbols))>>8;
} }
}; }
void add_structs_to_map(hash_lex_struct *st, int len) 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) ...@@ -256,28 +263,36 @@ void add_structs_to_map(hash_lex_struct *st, int len)
for (cur= st; cur<end; cur++) for (cur= st; cur<end; cur++)
add_struct_to_map(cur); add_struct_to_map(cur);
for (cur= st; cur<end; 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); add_structs_to_map(cur->char_tails,cur->last_char-cur->first_char+1);
}
} }
void set_links(hash_lex_struct *st, int len) void set_links(hash_lex_struct *st, int len)
{ {
hash_lex_struct *cur, *end= st+len; hash_lex_struct *cur, *end= st+len;
for (cur= st; cur<end; cur++) 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; int ilink= cur->char_tails->ithis;
hash_map[cur->ithis*4+2]= ilink%256; hash_map[cur->ithis*4+2]= ilink%256;
hash_map[cur->ithis*4+3]= ilink/256; hash_map[cur->ithis*4+3]= ilink/256;
set_links(cur->char_tails,cur->last_char-cur->first_char+1); set_links(cur->char_tails,cur->last_char-cur->first_char+1);
} }
}
} }
void print_hash_map(const char *name) void print_hash_map(const char *name)
{ {
printf("uchar %s[%d]= {\n",name,size_hash_map);
char *cur; char *cur;
int i; 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){ switch(i%4){
case 0: case 1: case 0: case 1:
if (!*cur) if (!*cur)
...@@ -292,6 +307,7 @@ void print_hash_map(const char *name) ...@@ -292,6 +307,7 @@ void print_hash_map(const char *name)
printf("};\n"); printf("};\n");
} }
void print_find_structs() void print_find_structs()
{ {
add_structs_to_map(root_by_len,max_len); add_structs_to_map(root_by_len,max_len);
...@@ -308,9 +324,10 @@ void print_find_structs() ...@@ -308,9 +324,10 @@ void print_find_structs()
print_hash_map("symbols_map"); print_hash_map("symbols_map");
} }
static void usage(int version) 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); my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
if (version) if (version)
return; return;
...@@ -322,6 +339,7 @@ and you are welcome to modify and redistribute it under the GPL license\n"); ...@@ -322,6 +339,7 @@ and you are welcome to modify and redistribute it under the GPL license\n");
my_print_help(my_long_options); my_print_help(my_long_options);
} }
extern "C" my_bool extern "C" my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)), get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument __attribute__((unused))) char *argument __attribute__((unused)))
...@@ -338,6 +356,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -338,6 +356,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
return 0; return 0;
} }
static int get_options(int argc, char **argv) static int get_options(int argc, char **argv)
{ {
int ho_error; int ho_error;
...@@ -353,6 +372,7 @@ static int get_options(int argc, char **argv) ...@@ -353,6 +372,7 @@ static int get_options(int argc, char **argv)
return(0); return(0);
} }
int check_dup_symbols(SYMBOL *s1, SYMBOL *s2) int check_dup_symbols(SYMBOL *s1, SYMBOL *s2)
{ {
if (s1->length!=s2->length || strncmp(s1->name,s2->name,s1->length)) 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"; ...@@ -367,6 +387,7 @@ your lex.h has duplicate definition for a symbol \"%s\"\n\n";
return 1; return 1;
} }
int check_duplicates() int check_duplicates()
{ {
SYMBOL *cur1, *cur2, *s_end, *f_end; SYMBOL *cur1, *cur2, *s_end, *f_end;
...@@ -377,21 +398,29 @@ int check_duplicates() ...@@ -377,21 +398,29 @@ int check_duplicates()
for (cur1= symbols; cur1<s_end; cur1++) for (cur1= symbols; cur1<s_end; cur1++)
{ {
for (cur2= cur1+1; cur2<s_end; cur2++) for (cur2= cur1+1; cur2<s_end; cur2++)
{
if (check_dup_symbols(cur1,cur2)) if (check_dup_symbols(cur1,cur2))
return 1; return 1;
}
for (cur2= sql_functions; cur2<f_end; cur2++) for (cur2= sql_functions; cur2<f_end; cur2++)
{
if (check_dup_symbols(cur1,cur2)) if (check_dup_symbols(cur1,cur2))
return 1; return 1;
}
} }
for (cur1= sql_functions; cur1<f_end; cur1++) for (cur1= sql_functions; cur1<f_end; cur1++)
{
for (cur2= cur1+1; cur2< f_end; cur2++) for (cur2= cur1+1; cur2< f_end; cur2++)
{
if (check_dup_symbols(cur1,cur2)) if (check_dup_symbols(cur1,cur2))
return 1; return 1;
}
}
return 0; return 0;
} }
int main(int argc,char **argv) int main(int argc,char **argv)
{ {
MY_INIT(argv[0]); MY_INIT(argv[0]);
...@@ -443,7 +472,8 @@ int main(int argc,char **argv) ...@@ -443,7 +472,8 @@ int main(int argc,char **argv)
for(;;){\n\ for(;;){\n\
register uchar first_char= (uchar)cur_struct;\n\ register uchar first_char= (uchar)cur_struct;\n\
\n\ \n\
if (first_char==0){\n\ if (first_char == 0)\n\
{\n\
register int16 ires= (int16)(cur_struct>>16);\n\ register int16 ires= (int16)(cur_struct>>16);\n\
if (ires==array_elements(symbols)) return 0;\n\ if (ires==array_elements(symbols)) return 0;\n\
register SYMBOL *res;\n\ register SYMBOL *res;\n\
......
...@@ -26,7 +26,7 @@ public: ...@@ -26,7 +26,7 @@ public:
numeric, numeric,
l_bra, l_bra,
r_bra, r_bra,
comma, comma
}; };
GTextReadStream(const char *buffer, int size) GTextReadStream(const char *buffer, int size)
......
...@@ -1282,7 +1282,13 @@ ha_innobase::open( ...@@ -1282,7 +1282,13 @@ ha_innobase::open(
The column is the row id in the automatical generation case, The column is the row id in the automatical generation case,
and it will never be updated anyway. and it will never be updated anyway.
*/ */
DBUG_ASSERT(key_used_on_scan == MAX_KEY);
if (key_used_on_scan != MAX_KEY) {
fprintf(stderr,
"InnoDB: Warning: table %s key_used_on_scan is %lu even though there is no\n"
"InnoDB: primary key inside InnoDB.\n",
name, (ulint)key_used_on_scan);
}
} }
auto_inc_counter_for_this_stat = 0; auto_inc_counter_for_this_stat = 0;
...@@ -4185,9 +4191,12 @@ static void free_share(INNOBASE_SHARE *share) ...@@ -4185,9 +4191,12 @@ static void free_share(INNOBASE_SHARE *share)
/********************************************************************* /*********************************************************************
Converts a MySQL table lock stored in the 'lock' field of the handle to Converts a MySQL table lock stored in the 'lock' field of the handle to
a proper type before storing the lock. MySQL also calls this when it a proper type before storing pointer to the lock into an array of pointers.
releases a lock. */ MySQL also calls this if it wants to reset some table locks to a not-locked
state during the processing of an SQL query. An example is that during a
SELECT the read lock is released early on the 'const' tables where we only
fetch one row. MySQL does not call this when it releases all locks at the
end of an SQL statement. */
THR_LOCK_DATA** THR_LOCK_DATA**
ha_innobase::store_lock( ha_innobase::store_lock(
......
...@@ -103,10 +103,13 @@ Item *create_func_cot(Item* a) ...@@ -103,10 +103,13 @@ Item *create_func_cot(Item* a)
new Item_func_tan(a)); new Item_func_tan(a));
} }
#ifdef HAVE_COMPRESS
Item *create_func_crc32(Item* a) Item *create_func_crc32(Item* a)
{ {
return new Item_func_crc32(a); return new Item_func_crc32(a);
} }
#endif
Item *create_func_date_format(Item* a,Item *b) Item *create_func_date_format(Item* a,Item *b)
{ {
......
...@@ -32,7 +32,9 @@ Item *create_func_connection_id(void); ...@@ -32,7 +32,9 @@ Item *create_func_connection_id(void);
Item *create_func_conv(Item* a, Item *b, Item *c); Item *create_func_conv(Item* a, Item *b, Item *c);
Item *create_func_cos(Item* a); Item *create_func_cos(Item* a);
Item *create_func_cot(Item* a); Item *create_func_cot(Item* a);
#ifdef HAVE_COMPRESS
Item *create_func_crc32(Item* a); Item *create_func_crc32(Item* a);
#endif
Item *create_func_date_format(Item* a,Item *b); Item *create_func_date_format(Item* a,Item *b);
Item *create_func_dayname(Item* a); Item *create_func_dayname(Item* a);
Item *create_func_dayofmonth(Item* a); Item *create_func_dayofmonth(Item* a);
......
...@@ -27,7 +27,9 @@ ...@@ -27,7 +27,9 @@
#include <hash.h> #include <hash.h>
#include <time.h> #include <time.h>
#include <ft_global.h> #include <ft_global.h>
#ifdef HAVE_COMPRESS
#include <zlib.h> #include <zlib.h>
#endif
/* return TRUE if item is a constant */ /* return TRUE if item is a constant */
...@@ -962,6 +964,8 @@ longlong Item_func_min_max::val_int() ...@@ -962,6 +964,8 @@ longlong Item_func_min_max::val_int()
return value; return value;
} }
#ifdef HAVE_COMPRESS
longlong Item_func_crc32::val_int() longlong Item_func_crc32::val_int()
{ {
String *res=args[0]->val_str(&value); String *res=args[0]->val_str(&value);
...@@ -973,6 +977,7 @@ longlong Item_func_crc32::val_int() ...@@ -973,6 +977,7 @@ longlong Item_func_crc32::val_int()
null_value=0; null_value=0;
return (longlong) crc32(0L, (Bytef*)res->ptr(), res->length()); return (longlong) crc32(0L, (Bytef*)res->ptr(), res->length());
} }
#endif /* HAVE_COMPRESS */
longlong Item_func_length::val_int() longlong Item_func_length::val_int()
......
...@@ -549,6 +549,8 @@ public: ...@@ -549,6 +549,8 @@ public:
const char *func_name() const { return "greatest"; } const char *func_name() const { return "greatest"; }
}; };
#ifdef HAVE_COMPRESS
class Item_func_crc32 :public Item_int_func class Item_func_crc32 :public Item_int_func
{ {
String value; String value;
...@@ -558,7 +560,7 @@ public: ...@@ -558,7 +560,7 @@ public:
const char *func_name() const { return "crc32"; } const char *func_name() const { return "crc32"; }
void fix_length_and_dec() { max_length=10; } void fix_length_and_dec() { max_length=10; }
}; };
#endif
class Item_func_length :public Item_int_func class Item_func_length :public Item_int_func
{ {
......
...@@ -450,7 +450,9 @@ static SYMBOL sql_functions[] = { ...@@ -450,7 +450,9 @@ static SYMBOL sql_functions[] = {
{ "COUNT", SYM(COUNT_SYM),0,0}, { "COUNT", SYM(COUNT_SYM),0,0},
{ "COS", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_cos)}, { "COS", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_cos)},
{ "COT", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_cot)}, { "COT", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_cot)},
#ifdef HAVE_COMPRESS
{ "CRC32", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_crc32)}, { "CRC32", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_crc32)},
#endif
{ "CROSSES", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_crosses)}, { "CROSSES", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_crosses)},
{ "CURDATE", SYM(CURDATE),0,0}, { "CURDATE", SYM(CURDATE),0,0},
{ "CURTIME", SYM(CURTIME),0,0}, { "CURTIME", SYM(CURTIME),0,0},
......
...@@ -451,7 +451,7 @@ inline static uint int_token(const char *str,uint length) ...@@ -451,7 +451,7 @@ inline static uint int_token(const char *str,uint length)
{ {
cmp=longlong_str; cmp=longlong_str;
smaller=LONG_NUM; smaller=LONG_NUM;
bigger=REAL_NUM; bigger= ULONGLONG_NUM;
} }
} }
while (*cmp && *cmp++ == *str++) ; while (*cmp && *cmp++ == *str++) ;
......
...@@ -91,7 +91,9 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, ...@@ -91,7 +91,9 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
*enclosed=ex->enclosed; *enclosed=ex->enclosed;
bool is_fifo=0; bool is_fifo=0;
LOAD_FILE_INFO lf_info; LOAD_FILE_INFO lf_info;
char * db = table_list->db ? table_list->db : thd->db; char *db = table_list->db; // This is never null
/* If no current database, use database where table is located */
char *tdb= thd->db ? thd->db : db;
bool transactional_table, log_delayed; bool transactional_table, log_delayed;
DBUG_ENTER("mysql_load"); DBUG_ENTER("mysql_load");
...@@ -173,10 +175,10 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, ...@@ -173,10 +175,10 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
ex->file_name+=dirname_length(ex->file_name); ex->file_name+=dirname_length(ex->file_name);
#endif #endif
if (!dirname_length(ex->file_name) && if (!dirname_length(ex->file_name) &&
strlen(ex->file_name)+strlen(mysql_data_home)+strlen(thd->db)+3 < strlen(ex->file_name)+strlen(mysql_data_home)+strlen(tdb)+3 <
FN_REFLEN) FN_REFLEN)
{ {
(void) sprintf(name,"%s/%s/%s",mysql_data_home,thd->db,ex->file_name); (void) sprintf(name,"%s/%s/%s",mysql_data_home,tdb,ex->file_name);
unpack_filename(name,name); /* Convert to system format */ unpack_filename(name,name); /* Convert to system format */
} }
else else
......
...@@ -483,7 +483,6 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild) ...@@ -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) sprintf(path,"%s/%s",mysql_data_home,db);
(void) unpack_dirname(path,path); (void) unpack_dirname(path,path);
field_list.push_back(item=new Item_empty_string("Name",NAME_LEN)); 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)); field_list.push_back(item=new Item_empty_string("Type",10));
item->maybe_null=1; item->maybe_null=1;
field_list.push_back(item=new Item_empty_string("Row_format",10)); field_list.push_back(item=new Item_empty_string("Row_format",10));
...@@ -513,6 +512,7 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild) ...@@ -513,6 +512,7 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild)
field_list.push_back(item=new Item_empty_string("Create_options",255)); field_list.push_back(item=new Item_empty_string("Create_options",255));
item->maybe_null=1; item->maybe_null=1;
field_list.push_back(item=new Item_empty_string("Comment",80)); field_list.push_back(item=new Item_empty_string("Comment",80));
item->maybe_null=1;
if (protocol->send_fields(&field_list,1)) if (protocol->send_fields(&field_list,1))
DBUG_RETURN(1); DBUG_RETURN(1);
...@@ -531,7 +531,7 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild) ...@@ -531,7 +531,7 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild)
my_casedn_str(files_charset_info, file_name); my_casedn_str(files_charset_info, file_name);
if (!(table = open_ltable(thd, &table_list, TL_READ))) if (!(table = open_ltable(thd, &table_list, TL_READ)))
{ {
for (uint i=1 ; i < field_list.elements-1 ; i++) for (uint i=2 ; i < field_list.elements ; i++)
protocol->store_null(); protocol->store_null();
// Send error to Comment field // Send error to Comment field
protocol->store(thd->net.last_error); protocol->store(thd->net.last_error);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment