Commit fd07116e authored by unknown's avatar unknown

merge

BitKeeper/etc/logging_ok:
  auto-union
configure.in:
  Auto merged
mysql-test/t/ndb_blob.test:
  Auto merged
ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
  Auto merged
parents f809e037 1230daf8
No related merge requests found
......@@ -123,14 +123,16 @@ if (($opt_directory ne $PWD) && (!-d $opt_directory && !$opt_dry_run))
if ($opt_pull)
{
&logger("Updating BK tree $REPO to latest ChangeSet first");
$command= "cd $REPO; bk pull; cd ..";
&run_command($command, "Could not update $REPO!");
chdir ($REPO) or &abort("Could not chdir to $REPO!");
&run_command("bk pull", "Could not update $REPO!");
chdir ($PWD) or &abort("Could not chdir to $PWD!");
unless ($opt_skip_manual)
{
&logger("Updating manual tree in $opt_docdir");
$command= "cd $opt_docdir; bk pull; cd ..";
&run_command($command, "Could not update $opt_docdir!");
chdir ($opt_docdir) or &abort("Could not chdir to $opt_docdir!");
&run_command("bk pull", "Could not update $opt_docdir!");
chdir ($PWD) or &abort("Could not chdir to $PWD!");
}
}
......
......@@ -150,20 +150,20 @@ sub main
####
sub fix_mysql_version
{
chdir("$destdir");
my $header_file= (-f 'include/mysql_version.h.in')? 'include/mysql_version.h.in' : 'include/mysql_version.h';
open(MYSQL_VERSION,"<$header_file") or die "Unable to open include/mysql_version.h for read: $!\n";
undef $/;
my $mysql_version= <MYSQL_VERSION>;
close(MYSQL_VERSION);
chdir("$destdir");
my $header_file= (-f 'include/mysql_version.h.in')? 'include/mysql_version.h.in' : 'include/mysql_version.h';
$mysql_version=~ s/\#define LICENSE[\s\t]+GPL/#define LICENSE Commercial/;
open(MYSQL_VERSION,">$header_file") or die "Unable to open include/mysql_version.h for write: $!\n";
print MYSQL_VERSION $mysql_version;
close(MYSQL_VERSION);
chdir("$cwd");
open(MYSQL_VERSION,"<$header_file") or die "Unable to open $header_file for read: $!\n";
undef $/;
my $mysql_version= <MYSQL_VERSION>;
close(MYSQL_VERSION);
$mysql_version=~ s/\#define LICENSE[\s\t]+GPL/#define LICENSE Commercial/;
open(MYSQL_VERSION,">$header_file") or die "Unable to open $header_file for write: $!\n";
print MYSQL_VERSION $mysql_version;
close(MYSQL_VERSION);
chdir("$cwd");
}
####
......
......@@ -859,7 +859,7 @@ static int get_options(int argc, char **argv)
opt_max_allowed_packet= *mysql_params->p_max_allowed_packet;
opt_net_buffer_length= *mysql_params->p_net_buffer_length;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, 0)))
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
exit(ho_error);
*mysql_params->p_max_allowed_packet= opt_max_allowed_packet;
......@@ -2693,8 +2693,9 @@ char *get_arg(char *line, my_bool get_next_arg)
ptr++;
if (*ptr == '\\') // short command was used
ptr+= 2;
while (*ptr &&!my_isspace(charset_info, *ptr)) // skip command
ptr++;
else
while (*ptr &&!my_isspace(charset_info, *ptr)) // skip command
ptr++;
}
if (!*ptr)
return NullS;
......
......@@ -276,7 +276,7 @@ int main(int argc,char *argv[])
mysql_init(&mysql);
load_defaults("my",load_default_groups,&argc,&argv);
save_argv = argv; /* Save for free_defaults */
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, 0)))
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
{
free_defaults(save_argv);
exit(ho_error);
......
......@@ -666,7 +666,7 @@ static int parse_args(int *argc, char*** argv)
result_file = stdout;
load_defaults("my",load_default_groups,argc,argv);
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
return 0;
......
......@@ -295,7 +295,7 @@ static int get_options(int *argc, char ***argv)
load_defaults("my", load_default_groups, argc, argv);
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, 0)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
if (!what_to_do)
......
......@@ -604,7 +604,7 @@ static int get_options(int *argc, char ***argv)
md_result_file= stdout;
load_defaults("my",load_default_groups,argc,argv);
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, 0)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
*mysql_params->p_max_allowed_packet= opt_max_allowed_packet;
......
......@@ -228,7 +228,7 @@ static int get_options(int *argc, char ***argv)
{
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, 0)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
if (enclosed && opt_enclosed)
......
......@@ -95,7 +95,7 @@ int parse_args(int argc, char** argv)
{
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL)))
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
exit(ho_error);
return 0;
......
......@@ -133,7 +133,7 @@ int parse_args(int argc, char **argv)
load_defaults("my",load_default_groups,&argc,&argv);
default_argv= argv;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL)))
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
exit(ho_error);
return 0;
......
......@@ -297,7 +297,7 @@ get_options(int *argc,char ***argv)
{
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, 0)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
if (tty_password)
......
......@@ -2100,7 +2100,7 @@ int parse_args(int argc, char **argv)
load_defaults("my",load_default_groups,&argc,&argv);
default_argv= argv;
if ((handle_options(&argc, &argv, my_long_options, get_one_option, 0)))
if ((handle_options(&argc, &argv, my_long_options, get_one_option)))
exit(1);
if (argc > 1)
......
......@@ -24,7 +24,7 @@ pkginclude_HEADERS = readline/readline.h
noinst_HEADERS = chared.h el.h histedit.h key.h parse.h refresh.h sig.h \
sys.h tokenizer.h config.h hist.h map.h prompt.h read.h \
search.h tty.h libedit_term.h term.h
search.h tty.h libedit_term.h
EXTRA_DIST = makelist.sh np/unvis.c np/strlcpy.c np/vis.c np/vis.h np/strlcat.c np/fgetln.c
......
......@@ -84,7 +84,7 @@ el_init(const char *prog, FILE *fin, FILE *fout, FILE *ferr)
el_free(el);
return NULL;
}
(void) key_init(el);
(void) el_key_init(el);
(void) map_init(el);
if (tty_init(el) == -1)
el->el_flags |= NO_TTY;
......@@ -112,7 +112,7 @@ el_end(EditLine *el)
el_reset(el);
term_end(el);
key_end(el);
el_key_end(el);
map_end(el);
tty_end(el);
ch_end(el);
......
......@@ -98,7 +98,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"
......
......@@ -103,14 +103,14 @@ private int key__decode_char(char *, int, int);
* Initialize the key maps
*/
protected int
key_init(EditLine *el)
el_key_init(EditLine *el)
{
el->el_key.buf = (char *) el_malloc(KEY_BUFSIZ);
if (el->el_key.buf == NULL)
return (-1);
el->el_key.map = NULL;
key_reset(el);
el_key_reset(el);
return (0);
}
......@@ -119,7 +119,7 @@ key_init(EditLine *el)
* Free the key maps
*/
protected void
key_end(EditLine *el)
el_key_end(EditLine *el)
{
el_free((ptr_t) el->el_key.buf);
......@@ -133,7 +133,7 @@ key_end(EditLine *el)
* Associate cmd with a key value
*/
protected key_value_t *
key_map_cmd(EditLine *el, int cmd)
el_key_map_cmd(EditLine *el, int cmd)
{
el->el_key.val.cmd = (el_action_t) cmd;
......@@ -145,7 +145,7 @@ key_map_cmd(EditLine *el, int cmd)
* Associate str with a key value
*/
protected key_value_t *
key_map_str(EditLine *el, char *str)
el_key_map_str(EditLine *el, char *str)
{
el->el_key.val.str = str;
......@@ -159,7 +159,7 @@ key_map_str(EditLine *el, char *str)
* [Always bind the ansi arrow keys?]
*/
protected void
key_reset(EditLine *el)
el_key_reset(EditLine *el)
{
node__put(el, el->el_key.map);
......@@ -177,7 +177,7 @@ key_reset(EditLine *el)
* The last character read is returned in *ch.
*/
protected int
key_get(EditLine *el, char *ch, key_value_t *val)
el_key_get(EditLine *el, char *ch, key_value_t *val)
{
return (node_trav(el, el->el_key.map, ch, val));
......@@ -191,7 +191,7 @@ key_get(EditLine *el, char *ch, key_value_t *val)
* out str or a unix command.
*/
protected void
key_add(EditLine *el, const char *key, key_value_t *val, int ntype)
el_key_add(EditLine *el, const char *key, key_value_t *val, int ntype)
{
if (key[0] == '\0') {
......@@ -219,7 +219,7 @@ key_add(EditLine *el, const char *key, key_value_t *val, int ntype)
*
*/
protected void
key_clear(EditLine *el, el_action_t *map, const char *in)
el_key_clear(EditLine *el, el_action_t *map, const char *in)
{
if ((map[(unsigned char)*in] == ED_SEQUENCE_LEAD_IN) &&
......@@ -227,7 +227,7 @@ key_clear(EditLine *el, el_action_t *map, const char *in)
el->el_map.alt[(unsigned char)*in] != ED_SEQUENCE_LEAD_IN) ||
(map == el->el_map.alt &&
el->el_map.key[(unsigned char)*in] != ED_SEQUENCE_LEAD_IN)))
(void) key_delete(el, in);
(void) el_key_delete(el, in);
}
......@@ -236,7 +236,7 @@ key_clear(EditLine *el, el_action_t *map, const char *in)
* they exists.
*/
protected int
key_delete(EditLine *el, const char *key)
el_key_delete(EditLine *el, const char *key)
{
if (key[0] == '\0') {
......@@ -257,7 +257,7 @@ key_delete(EditLine *el, const char *key)
* Print entire el->el_key.map if null
*/
protected void
key_print(EditLine *el, const char *key)
el_key_print(EditLine *el, const char *key)
{
/* do nothing if el->el_key.map is empty and null key specified */
......@@ -504,7 +504,7 @@ node_lookup(EditLine *el, const char *str, key_node_t *ptr, int cnt)
if (str[1] == 0) {
el->el_key.buf[ncnt + 1] = '"';
el->el_key.buf[ncnt + 2] = '\0';
key_kprint(el, el->el_key.buf,
el_key_kprint(el, el->el_key.buf,
&ptr->val, ptr->type);
return (0);
} else
......@@ -552,7 +552,7 @@ node_enum(EditLine *el, key_node_t *ptr, int cnt)
/* print this key and function */
el->el_key.buf[ncnt + 1] = '"';
el->el_key.buf[ncnt + 2] = '\0';
key_kprint(el, el->el_key.buf, &ptr->val, ptr->type);
el_key_kprint(el, el->el_key.buf, &ptr->val, ptr->type);
} else
(void) node_enum(el, ptr->next, ncnt + 1);
......@@ -568,7 +568,7 @@ node_enum(EditLine *el, key_node_t *ptr, int cnt)
* function specified by val
*/
protected void
key_kprint(EditLine *el, const char *key, key_value_t *val, int ntype)
el_key_kprint(EditLine *el, const char *key, key_value_t *val, int ntype)
{
el_bindings_t *fp;
char unparsbuf[EL_BUFSIZ];
......@@ -579,7 +579,7 @@ key_kprint(EditLine *el, const char *key, key_value_t *val, int ntype)
case XK_STR:
case XK_EXE:
(void) fprintf(el->el_outfile, fmt, key,
key__decode_str(val->str, unparsbuf,
el_key__decode_str(val->str, unparsbuf,
ntype == XK_STR ? "\"\"" : "[]"));
break;
case XK_CMD:
......@@ -644,7 +644,7 @@ key__decode_char(char *buf, int cnt, int ch)
* Make a printable version of the ey
*/
protected char *
key__decode_str(const char *str, char *buf, const char *sep)
el_key__decode_str(const char *str, char *buf, const char *sep)
{
char *b;
const char *p;
......
......@@ -62,18 +62,19 @@ typedef struct el_key_t {
#define XK_NOD 2
#define XK_EXE 3
protected int key_init(EditLine *);
protected void key_end(EditLine *);
protected key_value_t *key_map_cmd(EditLine *, int);
protected key_value_t *key_map_str(EditLine *, char *);
protected void key_reset(EditLine *);
protected int key_get(EditLine *, char *, key_value_t *);
protected void key_add(EditLine *, const char *, key_value_t *, int);
protected void key_clear(EditLine *, el_action_t *, const char *);
protected int key_delete(EditLine *, const char *);
protected void key_print(EditLine *, const char *);
protected void key_kprint(EditLine *, const char *, key_value_t *,
protected int el_key_init(EditLine *);
protected void el_key_end(EditLine *);
protected key_value_t *el_key_map_cmd(EditLine *, int);
protected key_value_t *el_key_map_str(EditLine *, char *);
protected void el_key_reset(EditLine *);
protected int el_key_get(EditLine *, char *, key_value_t *);
protected void el_key_add(EditLine *,
const char *, key_value_t *, int);
protected void el_key_clear(EditLine *, el_action_t *, const char *);
protected int el_key_delete(EditLine *, const char *);
protected void el_key_print(EditLine *, const char *);
protected void el_key_kprint(EditLine *, const char *, key_value_t *,
int);
protected char *key__decode_str(const char *, char *, const char *);
protected char *el_key__decode_str(const char *, char *, const char *);
#endif /* _h_el_key */
......@@ -1011,7 +1011,8 @@ map_init_meta(EditLine *el)
break;
default:
buf[1] = i & 0177;
key_add(el, buf, key_map_cmd(el, (int) map[i]), XK_CMD);
el_key_add(el, buf,
el_key_map_cmd(el, (int) map[i]), XK_CMD);
break;
}
map[(int) buf[0]] = ED_SEQUENCE_LEAD_IN;
......@@ -1033,7 +1034,7 @@ map_init_vi(EditLine *el)
el->el_map.type = MAP_VI;
el->el_map.current = el->el_map.key;
key_reset(el);
el_key_reset(el);
for (i = 0; i < N_KEYS; i++) {
key[i] = vii[i];
......@@ -1062,7 +1063,7 @@ map_init_emacs(EditLine *el)
el->el_map.type = MAP_EMACS;
el->el_map.current = el->el_map.key;
key_reset(el);
el_key_reset(el);
for (i = 0; i < N_KEYS; i++) {
key[i] = emacs[i];
......@@ -1075,7 +1076,7 @@ map_init_emacs(EditLine *el)
buf[0] = CONTROL('X');
buf[1] = CONTROL('X');
buf[2] = 0;
key_add(el, buf, key_map_cmd(el, EM_EXCHANGE_MARK), XK_CMD);
el_key_add(el, buf, el_key_map_cmd(el, EM_EXCHANGE_MARK), XK_CMD);
tty_bind_char(el, 1);
term_bind_arrow(el);
......@@ -1132,7 +1133,7 @@ map_print_key(EditLine *el, el_action_t *map, const char *in)
el_bindings_t *bp;
if (in[0] == '\0' || in[1] == '\0') {
(void) key__decode_str(in, outbuf, "");
(void) el_key__decode_str(in, outbuf, "");
for (bp = el->el_map.help; bp->name != NULL; bp++)
if (bp->func == map[(unsigned char) *in]) {
(void) fprintf(el->el_outfile,
......@@ -1140,7 +1141,7 @@ map_print_key(EditLine *el, el_action_t *map, const char *in)
return;
}
} else
key_print(el, in);
el_key_print(el, in);
}
......@@ -1162,20 +1163,20 @@ map_print_some_keys(EditLine *el, el_action_t *map, int first, int last)
if (first == last)
(void) fprintf(el->el_outfile,
"%-15s-> is undefined\n",
key__decode_str(firstbuf, unparsbuf, STRQQ));
el_key__decode_str(firstbuf, unparsbuf, STRQQ));
return;
}
for (bp = el->el_map.help; bp->name != NULL; bp++) {
if (bp->func == map[first]) {
if (first == last) {
(void) fprintf(el->el_outfile, "%-15s-> %s\n",
key__decode_str(firstbuf, unparsbuf, STRQQ),
el_key__decode_str(firstbuf, unparsbuf, STRQQ),
bp->name);
} else {
(void) fprintf(el->el_outfile,
"%-4s to %-7s-> %s\n",
key__decode_str(firstbuf, unparsbuf, STRQQ),
key__decode_str(lastbuf, extrabuf, STRQQ),
el_key__decode_str(firstbuf, unparsbuf, STRQQ),
el_key__decode_str(lastbuf, extrabuf, STRQQ),
bp->name);
}
return;
......@@ -1229,7 +1230,7 @@ map_print_all_keys(EditLine *el)
map_print_some_keys(el, el->el_map.alt, prev, i - 1);
(void) fprintf(el->el_outfile, "Multi-character bindings\n");
key_print(el, "");
el_key_print(el, "");
(void) fprintf(el->el_outfile, "Arrow key bindings\n");
term_print_arrow(el, "");
}
......@@ -1322,9 +1323,9 @@ map_bind(EditLine *el, int argc, const char **argv)
return (-1);
}
if (in[1])
(void) key_delete(el, in);
(void) el_key_delete(el, in);
else if (map[(unsigned char) *in] == ED_SEQUENCE_LEAD_IN)
(void) key_delete(el, in);
(void) el_key_delete(el, in);
else
map[(unsigned char) *in] = ED_UNASSIGNED;
return (0);
......@@ -1352,9 +1353,9 @@ map_bind(EditLine *el, int argc, const char **argv)
return (-1);
}
if (key)
term_set_arrow(el, in, key_map_str(el, out), ntype);
term_set_arrow(el, in, el_key_map_str(el, out), ntype);
else
key_add(el, in, key_map_str(el, out), ntype);
el_key_add(el, in, el_key_map_str(el, out), ntype);
map[(unsigned char) *in] = ED_SEQUENCE_LEAD_IN;
break;
......@@ -1365,13 +1366,13 @@ map_bind(EditLine *el, int argc, const char **argv)
return (-1);
}
if (key)
term_set_arrow(el, in, key_map_str(el, out), ntype);
term_set_arrow(el, in, el_key_map_str(el, out), ntype);
else {
if (in[1]) {
key_add(el, in, key_map_cmd(el, cmd), ntype);
el_key_add(el, in, el_key_map_cmd(el, cmd), ntype);
map[(unsigned char) *in] = ED_SEQUENCE_LEAD_IN;
} else {
key_clear(el, map, in);
el_key_clear(el, map, in);
map[(unsigned char) *in] = cmd;
}
}
......
......@@ -198,6 +198,10 @@ read_preread(EditLine *el)
return (0);
#ifdef FIONREAD
#ifndef MIN // definition of MIN is lacking on hpux..
#define MIN(x,y) (((x)<(y))?(x):(y))
#endif
(void) ioctl(el->el_infd, FIONREAD, (ioctl_t) & chrs);
if (chrs > 0) {
char buf[EL_BUFSIZ];
......@@ -262,7 +266,7 @@ read_getcmd(EditLine *el, el_action_t *cmdnum, char *ch)
cmd = el->el_map.current[(unsigned char) *ch];
if (cmd == ED_SEQUENCE_LEAD_IN) {
key_value_t val;
switch (key_get(el, ch, &val)) {
switch (el_key_get(el, ch, &val)) {
case XK_CMD:
cmd = val.cmd;
break;
......@@ -459,7 +463,8 @@ el_gets(EditLine *el, int *nread)
#endif /* DEBUG_READ */
break;
}
if ((uint)cmdnum >= (uint)(el->el_map.nfunc)) { /* BUG CHECK command */
if ((unsigned int)cmdnum >= (unsigned int)(el->el_map.nfunc))
{ /* BUG CHECK command */
#ifdef DEBUG_EDIT
(void) fprintf(el->el_errfile,
"ERROR: illegal command from key 0%o\r\n", ch);
......
......@@ -67,10 +67,6 @@ __RCSID("$NetBSD: term.c,v 1.35 2002/03/18 16:00:59 christos Exp $");
#include "el.h"
/* Solaris's term.h does horrid things. */
#if (defined(HAVE_TERM_H) && !defined(SUNOS))
#include <term.h>
#endif
#include <sys/types.h>
#include <sys/ioctl.h>
......@@ -1079,32 +1075,32 @@ term_reset_arrow(EditLine *el)
static const char stOH[] = {033, 'O', 'H', '\0'};
static const char stOF[] = {033, 'O', 'F', '\0'};
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);
key_add(el, strD, &arrow[A_K_LT].fun, arrow[A_K_LT].type);
key_add(el, strH, &arrow[A_K_HO].fun, arrow[A_K_HO].type);
key_add(el, strF, &arrow[A_K_EN].fun, arrow[A_K_EN].type);
key_add(el, stOA, &arrow[A_K_UP].fun, arrow[A_K_UP].type);
key_add(el, stOB, &arrow[A_K_DN].fun, arrow[A_K_DN].type);
key_add(el, stOC, &arrow[A_K_RT].fun, arrow[A_K_RT].type);
key_add(el, stOD, &arrow[A_K_LT].fun, arrow[A_K_LT].type);
key_add(el, stOH, &arrow[A_K_HO].fun, arrow[A_K_HO].type);
key_add(el, stOF, &arrow[A_K_EN].fun, arrow[A_K_EN].type);
el_key_add(el, strA, &arrow[A_K_UP].fun, arrow[A_K_UP].type);
el_key_add(el, strB, &arrow[A_K_DN].fun, arrow[A_K_DN].type);
el_key_add(el, strC, &arrow[A_K_RT].fun, arrow[A_K_RT].type);
el_key_add(el, strD, &arrow[A_K_LT].fun, arrow[A_K_LT].type);
el_key_add(el, strH, &arrow[A_K_HO].fun, arrow[A_K_HO].type);
el_key_add(el, strF, &arrow[A_K_EN].fun, arrow[A_K_EN].type);
el_key_add(el, stOA, &arrow[A_K_UP].fun, arrow[A_K_UP].type);
el_key_add(el, stOB, &arrow[A_K_DN].fun, arrow[A_K_DN].type);
el_key_add(el, stOC, &arrow[A_K_RT].fun, arrow[A_K_RT].type);
el_key_add(el, stOD, &arrow[A_K_LT].fun, arrow[A_K_LT].type);
el_key_add(el, stOH, &arrow[A_K_HO].fun, arrow[A_K_HO].type);
el_key_add(el, stOF, &arrow[A_K_EN].fun, arrow[A_K_EN].type);
if (el->el_map.type == MAP_VI) {
key_add(el, &strA[1], &arrow[A_K_UP].fun, arrow[A_K_UP].type);
key_add(el, &strB[1], &arrow[A_K_DN].fun, arrow[A_K_DN].type);
key_add(el, &strC[1], &arrow[A_K_RT].fun, arrow[A_K_RT].type);
key_add(el, &strD[1], &arrow[A_K_LT].fun, arrow[A_K_LT].type);
key_add(el, &strH[1], &arrow[A_K_HO].fun, arrow[A_K_HO].type);
key_add(el, &strF[1], &arrow[A_K_EN].fun, arrow[A_K_EN].type);
key_add(el, &stOA[1], &arrow[A_K_UP].fun, arrow[A_K_UP].type);
key_add(el, &stOB[1], &arrow[A_K_DN].fun, arrow[A_K_DN].type);
key_add(el, &stOC[1], &arrow[A_K_RT].fun, arrow[A_K_RT].type);
key_add(el, &stOD[1], &arrow[A_K_LT].fun, arrow[A_K_LT].type);
key_add(el, &stOH[1], &arrow[A_K_HO].fun, arrow[A_K_HO].type);
key_add(el, &stOF[1], &arrow[A_K_EN].fun, arrow[A_K_EN].type);
el_key_add(el, &strA[1], &arrow[A_K_UP].fun, arrow[A_K_UP].type);
el_key_add(el, &strB[1], &arrow[A_K_DN].fun, arrow[A_K_DN].type);
el_key_add(el, &strC[1], &arrow[A_K_RT].fun, arrow[A_K_RT].type);
el_key_add(el, &strD[1], &arrow[A_K_LT].fun, arrow[A_K_LT].type);
el_key_add(el, &strH[1], &arrow[A_K_HO].fun, arrow[A_K_HO].type);
el_key_add(el, &strF[1], &arrow[A_K_EN].fun, arrow[A_K_EN].type);
el_key_add(el, &stOA[1], &arrow[A_K_UP].fun, arrow[A_K_UP].type);
el_key_add(el, &stOB[1], &arrow[A_K_DN].fun, arrow[A_K_DN].type);
el_key_add(el, &stOC[1], &arrow[A_K_RT].fun, arrow[A_K_RT].type);
el_key_add(el, &stOD[1], &arrow[A_K_LT].fun, arrow[A_K_LT].type);
el_key_add(el, &stOH[1], &arrow[A_K_HO].fun, arrow[A_K_HO].type);
el_key_add(el, &stOF[1], &arrow[A_K_EN].fun, arrow[A_K_EN].type);
}
}
......@@ -1158,7 +1154,7 @@ term_print_arrow(EditLine *el, const char *name)
for (i = 0; i < A_K_NKEYS; i++)
if (*name == '\0' || strcmp(name, arrow[i].name) == 0)
if (arrow[i].type != XK_NOD)
key_kprint(el, arrow[i].name, &arrow[i].fun,
el_key_kprint(el, arrow[i].name, &arrow[i].fun,
arrow[i].type);
}
......@@ -1199,20 +1195,20 @@ term_bind_arrow(EditLine *el)
* unassigned key.
*/
if (arrow[i].type == XK_NOD)
key_clear(el, map, p);
el_key_clear(el, map, p);
else {
if (p[1] && (dmap[j] == map[j] ||
map[j] == ED_SEQUENCE_LEAD_IN)) {
key_add(el, p, &arrow[i].fun,
el_key_add(el, p, &arrow[i].fun,
arrow[i].type);
map[j] = ED_SEQUENCE_LEAD_IN;
} else if (map[j] == ED_UNASSIGNED) {
key_clear(el, map, p);
el_key_clear(el, map, p);
if (arrow[i].type == XK_CMD)
map[j] = arrow[i].fun.cmd;
else
key_add(el, p, &arrow[i].fun,
arrow[i].type);
el_key_add(el, p, &arrow[i].fun,
arrow[i].type);
}
}
}
......@@ -1245,6 +1241,8 @@ term__flush(void)
/* term_telltc():
* Print the current termcap characteristics
*/
char *el_key__decode_str(const char *, char *, const char *);
protected int
/*ARGSUSED*/
term_telltc(EditLine *el, int argc __attribute__((unused)),
......@@ -1272,7 +1270,7 @@ term_telltc(EditLine *el, int argc __attribute__((unused)),
(void) fprintf(el->el_outfile, "\t%25s (%s) == %s\n",
t->long_name,
t->name, *ts && **ts ?
key__decode_str(*ts, upbuf, "") : "(empty)");
el_key__decode_str(*ts, upbuf, "") : "(empty)");
(void) fputc('\n', el->el_outfile);
return (0);
}
......
/* $NetBSD: term.h,v 1.13 2002/03/18 16:01:00 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Christos Zoulas of Cornell University.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)term.h 8.1 (Berkeley) 6/4/93
*/
/*
* el.term.h: Termcap header
*/
#ifndef _h_el_term
#define _h_el_term
#include "histedit.h"
typedef struct { /* Symbolic function key bindings */
const char *name; /* name of the key */
int key; /* Index in termcap table */
key_value_t fun; /* Function bound to it */
int type; /* Type of function */
} fkey_t;
typedef struct {
coord_t t_size; /* # lines and cols */
int t_flags;
#define TERM_CAN_INSERT 0x001 /* Has insert cap */
#define TERM_CAN_DELETE 0x002 /* Has delete cap */
#define TERM_CAN_CEOL 0x004 /* Has CEOL cap */
#define TERM_CAN_TAB 0x008 /* Can use tabs */
#define TERM_CAN_ME 0x010 /* Can turn all attrs. */
#define TERM_CAN_UP 0x020 /* Can move up */
#define TERM_HAS_META 0x040 /* Has a meta key */
#define TERM_HAS_AUTO_MARGINS 0x080 /* Has auto margins */
#define TERM_HAS_MAGIC_MARGINS 0x100 /* Has magic margins */
char *t_buf; /* Termcap buffer */
int t_loc; /* location used */
char **t_str; /* termcap strings */
int *t_val; /* termcap values */
char *t_cap; /* Termcap buffer */
fkey_t *t_fkey; /* Array of keys */
} el_term_t;
/*
* fKey indexes
*/
#define A_K_DN 0
#define A_K_UP 1
#define A_K_LT 2
#define A_K_RT 3
#define A_K_HO 4
#define A_K_EN 5
#define A_K_NKEYS 6
protected void term_move_to_line(EditLine *, int);
protected void term_move_to_char(EditLine *, int);
protected void term_clear_EOL(EditLine *, int);
protected void term_overwrite(EditLine *, const char *, int);
protected void term_insertwrite(EditLine *, char *, int);
protected void term_deletechars(EditLine *, int);
protected void term_clear_screen(EditLine *);
protected void term_beep(EditLine *);
protected int term_change_size(EditLine *, int, int);
protected int term_get_size(EditLine *, int *, int *);
protected int term_init(EditLine *);
protected void term_bind_arrow(EditLine *);
protected void term_print_arrow(EditLine *, const char *);
protected int term_clear_arrow(EditLine *, const char *);
protected int term_set_arrow(EditLine *, const char *, key_value_t *, int);
protected void term_end(EditLine *);
protected int term_set(EditLine *, const char *);
protected int term_settc(EditLine *, int, const char **);
protected int term_telltc(EditLine *, int, const char **);
protected int term_echotc(EditLine *, int, const char **);
protected int term__putc(int);
protected void term__flush(void);
/*
* Easy access macros
*/
#define EL_FLAGS (el)->el_term.t_flags
#define EL_CAN_INSERT (EL_FLAGS & TERM_CAN_INSERT)
#define EL_CAN_DELETE (EL_FLAGS & TERM_CAN_DELETE)
#define EL_CAN_CEOL (EL_FLAGS & TERM_CAN_CEOL)
#define EL_CAN_TAB (EL_FLAGS & TERM_CAN_TAB)
#define EL_CAN_ME (EL_FLAGS & TERM_CAN_ME)
#define EL_HAS_META (EL_FLAGS & TERM_HAS_META)
#define EL_HAS_AUTO_MARGINS (EL_FLAGS & TERM_HAS_AUTO_MARGINS)
#define EL_HAS_MAGIC_MARGINS (EL_FLAGS & TERM_HAS_MAGIC_MARGINS)
#endif /* _h_el_term */
......@@ -784,15 +784,15 @@ tty_bind_char(EditLine *el, int force)
if (new[0] == old[0] && !force)
continue;
/* Put the old default binding back, and set the new binding */
key_clear(el, map, (char *)old);
el_key_clear(el, map, (char *)old);
map[old[0]] = dmap[old[0]];
key_clear(el, map, (char *)new);
el_key_clear(el, map, (char *)new);
/* MAP_VI == 1, MAP_EMACS == 0... */
map[new[0]] = tp->bind[el->el_map.type];
if (dalt) {
key_clear(el, alt, (char *)old);
el_key_clear(el, alt, (char *)old);
alt[old[0]] = dalt[old[0]];
key_clear(el, alt, (char *)new);
el_key_clear(el, alt, (char *)new);
alt[new[0]] = tp->bind[el->el_map.type + 1];
}
}
......
......@@ -1873,13 +1873,6 @@ else
fi
AC_SUBST(TERMCAP_LIB)
# for libedit 2.6.7
case "${host}" in
*-*-solaris2*)
AC_DEFINE_UNQUOTED(SUNOS, 1, [macro for libedit-2.6.7, current platform is solaris-2])
;;
esac
LIBEDIT_LOBJECTS=""
AC_CHECK_FUNC(strunvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS unvis.o"])
AC_CHECK_FUNC(strvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS vis.o"])
......@@ -2450,8 +2443,10 @@ elif test "$extra_charsets" = none; then
CHARSETS="$CHARSETS"
elif test "$extra_charsets" = complex; then
CHARSETS="$CHARSETS $CHARSETS_COMPLEX"
AC_DEFINE([DEFINE_ALL_CHARACTER_SETS],1,[all charsets are available])
elif test "$extra_charsets" = all; then
CHARSETS="$CHARSETS $CHARSETS_AVAILABLE"
AC_DEFINE([DEFINE_ALL_CHARACTER_SETS],1,[all charsets are available])
else
EXTRA_CHARSETS=`echo $extra_charsets | sed -e 's/,/ /g'`
CHARSETS="$CHARSETS $EXTRA_CHARSETS"
......
......@@ -99,7 +99,7 @@ static int get_options(int *argc,char ***argv)
{
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
if (*argc < 1)
......
......@@ -67,7 +67,7 @@ int main(int argc, char *argv[])
progname= argv[0];
if (handle_options(&argc, &argv, my_long_options, get_one_option, NULL))
if (handle_options(&argc, &argv, my_long_options, get_one_option))
exit(-1);
if (!argv[0] || !argv[1] || (pid= atoi(argv[0])) <= 0 ||
(t= atoi(argv[1])) <= 0)
......
......@@ -157,7 +157,7 @@ static int get_options(int *argc,char ***argv)
{
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
if (!*argc && !print_all_codes)
......
......@@ -121,7 +121,7 @@ static int parse_args(int argc, char **argv)
{
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL)))
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
exit(ho_error);
/*
......
......@@ -90,7 +90,7 @@ static int get_options(int *argc,char ***argv)
{
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
if (*argc == 0)
......
......@@ -151,9 +151,7 @@ typedef uint rf_SetTimer;
#endif
/* ERROR is defined in wingdi.h */
#ifdef ERROR
#undef ERROR
#endif
/* We need to close files to break connections on shutdown */
#ifndef SIGNAL_WITH_VIO_CLOSE
......
......@@ -54,15 +54,15 @@ struct my_option
int app_type; /* To be used by an application */
};
extern char *disabled_my_option;
extern my_bool my_getopt_print_errors;
typedef my_bool (* my_get_one_option) (int, const struct my_option *, char * );
typedef void (* my_error_reporter) (enum loglevel level, const char *format, ... );
extern char *disabled_my_option;
extern my_bool my_getopt_print_errors;
extern my_error_reporter my_getopt_error_reporter;
extern int handle_options (int *argc, char ***argv,
const struct my_option *longopts, my_get_one_option,
my_error_reporter );
const struct my_option *longopts, my_get_one_option);
extern void my_print_help(const struct my_option *options);
extern void my_print_variables(const struct my_option *options);
extern void my_getopt_register_get_addr(gptr* (*func_addr)(const char *, uint,
......
......@@ -58,6 +58,8 @@ void init_time(void);
my_time_t
my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, bool *in_dst_time_gap);
void set_zero_time(MYSQL_TIME *tm);
C_MODE_END
#endif /* _my_time_h_ */
......@@ -2337,21 +2337,6 @@ row_drop_table_for_mysql(
srv_print_innodb_table_monitor = FALSE;
}
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
ut_a(name != NULL);
if (srv_created_new_raw) {
fputs(
"InnoDB: A new raw disk partition was initialized or\n"
"InnoDB: innodb_force_recovery is on: we do not allow\n"
"InnoDB: database modifications by the user. Shut down\n"
"InnoDB: mysqld and edit my.cnf so that newraw is replaced\n"
"InnoDB: with raw, and innodb_force_... is removed.\n",
stderr);
return(DB_ERROR);
}
quoted_name = mem_strdupq(name, '\'');
namelen = strlen(quoted_name);
sql = mem_alloc((sizeof str1) + (sizeof str2) - 2 + 1 + namelen);
......
......@@ -1587,9 +1587,10 @@ NetWare. */
fprintf(stderr,
"InnoDB: You have now successfully upgraded to the multiple tablespaces\n"
"InnoDB: format. You should NOT DOWNGRADE again to an earlier version of\n"
"InnoDB: InnoDB! But if you absolutely need to downgrade, see section 4.6 of\n"
"InnoDB: http://www.innodb.com/ibman.php for instructions.\n");
"InnoDB: format. You should NOT DOWNGRADE to an earlier version of\n"
"InnoDB: InnoDB! But if you absolutely need to downgrade, see\n"
"InnoDB: http://dev.mysql.com/doc/mysql/en/Multiple_tablespaces.html\n"
"InnoDB: for instructions.\n");
}
if (srv_force_recovery == 0) {
......
......@@ -671,7 +671,7 @@ static void get_options(register int *argc, register char ***argv)
if (isatty(fileno(stdout)))
testflag|=T_WRITE_LOOP;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
if (*argc == 0)
......
......@@ -337,7 +337,7 @@ static void get_options(int *argc, char ***argv)
{
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
my_progname= argv[0][0];
......
......@@ -3167,13 +3167,6 @@ mysql_stmt_send_long_data(MYSQL_STMT *stmt, uint param_number,
Fetch and conversion of result set rows (binary protocol).
*********************************************************************/
static void set_zero_time(MYSQL_TIME *tm)
{
bzero((void *)tm, sizeof(*tm));
tm->time_type= MYSQL_TIMESTAMP_NONE;
}
/*
Read date, (time, datetime) value from network buffer and store it
in MYSQL_TIME structure.
......
......@@ -1585,7 +1585,7 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
int old_lock;
MYISAM_SHARE *share=info->s;
MI_STATE_INFO old_state;
DBUG_ENTER("sort_index");
DBUG_ENTER("mi_sort_index");
if (!(param->testflag & T_SILENT))
printf("- Sorting index for MyISAM-table '%s'\n",name);
......@@ -1664,7 +1664,7 @@ err:
err2:
VOID(my_delete(param->temp_filename,MYF(MY_WME)));
DBUG_RETURN(-1);
} /* sort_index */
} /* mi_sort_index */
/* Sort records recursive using one index */
......@@ -1672,7 +1672,7 @@ err2:
static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
my_off_t pagepos, File new_file)
{
uint length,nod_flag,used_length;
uint length,nod_flag,used_length, key_length;
uchar *buff,*keypos,*endpos;
uchar key[MI_MAX_POSSIBLE_KEY_BUFF];
my_off_t new_page_pos,next_page;
......@@ -1693,7 +1693,7 @@ static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
llstr(pagepos,llbuff));
goto err;
}
if ((nod_flag=mi_test_if_nod(buff)))
if ((nod_flag=mi_test_if_nod(buff)) || keyinfo->flag & HA_FULLTEXT)
{
used_length=mi_getint(buff);
keypos=buff+2+nod_flag;
......@@ -1704,7 +1704,7 @@ static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
{
next_page=_mi_kpos(nod_flag,keypos);
_mi_kpointer(info,keypos-nod_flag,param->new_file_pos); /* Save new pos */
if (sort_one_index(param,info,keyinfo,next_page, new_file))
if (sort_one_index(param,info,keyinfo,next_page,new_file))
{
DBUG_PRINT("error",("From page: %ld, keyoffset: %d used_length: %d",
(ulong) pagepos, (int) (keypos - buff),
......@@ -1714,11 +1714,25 @@ static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
}
}
if (keypos >= endpos ||
((*keyinfo->get_key)(keyinfo,nod_flag,&keypos,key)) == 0)
(key_length=(*keyinfo->get_key)(keyinfo,nod_flag,&keypos,key)) == 0)
break;
#ifdef EXTRA_DEBUG
assert(keypos <= endpos);
#endif
DBUG_ASSERT(keypos <= endpos);
if (keyinfo->flag & HA_FULLTEXT)
{
uint off;
int subkeys;
get_key_full_length_rdonly(off, key);
subkeys=ft_sintXkorr(key+off);
if (subkeys < 0)
{
next_page= _mi_dpos(info,0,key+key_length);
_mi_dpointer(info,keypos-nod_flag-info->s->rec_reflength,
param->new_file_pos); /* Save new pos */
if (sort_one_index(param,info,&info->s->ft2_keyinfo,
next_page,new_file))
goto err;
}
}
}
}
......
......@@ -644,7 +644,7 @@ static void get_options(int argc, char *argv[])
{
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL)))
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
exit(ho_error);
return;
......
......@@ -68,7 +68,7 @@ int main(int argc,char *argv[])
struct { MI_INFO *info; } aio0, *aio=&aio0; /* for GWS_IN_USE */
MY_INIT(argv[0]);
if ((error=handle_options(&argc, &argv, my_long_options, get_one_option, 0)))
if (error=handle_options(&argc, &argv, my_long_options, get_one_option))
exit(error);
if (count || dump)
verbose=0;
......
......@@ -696,7 +696,7 @@ static void get_options(register int *argc,register char ***argv)
if (isatty(fileno(stdout)))
check_param.testflag|=T_WRITE_LOOP;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
/* If using repair, then update checksum if one uses --update-state */
......
......@@ -350,7 +350,7 @@ static void get_options(int *argc,char ***argv)
if (isatty(fileno(stdout)))
write_loop=1;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
if (!*argc)
......
......@@ -34,14 +34,17 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
{
int save_errno,errpos=0;
uint files=0,i,dir_length,length,key_parts;
ulonglong file_offset;
ulonglong file_offset=0;
char name_buff[FN_REFLEN*2],buff[FN_REFLEN],*end;
MYRG_INFO *m_info=0;
File fd;
IO_CACHE file;
MI_INFO *isam=0;
uint found_merge_insert_method= 0;
DBUG_ENTER("myrg_open");
LINT_INIT(key_parts);
bzero((char*) &file,sizeof(file));
if ((fd=my_open(fn_format(name_buff,name,"",MYRG_NAME_EXT,4),
O_RDONLY | O_SHARE,MYF(0))) < 0)
......@@ -69,10 +72,10 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
continue; /* Skip empty lines */
if (buff[0] == '#')
{
if( !strncmp(buff+1,"INSERT_METHOD=",14))
if (!strncmp(buff+1,"INSERT_METHOD=",14))
{ /* Lookup insert method */
int tmp=find_type(buff+15,&merge_insert_method,2);
m_info->merge_insert_method = (uint) (tmp >= 0 ? tmp : 0);
found_merge_insert_method = (uint) (tmp >= 0 ? tmp : 0);
}
continue; /* Skip comments */
}
......@@ -84,8 +87,8 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
VOID(cleanup_dirname(buff,name_buff));
}
if (!(isam=mi_open(buff,mode,(handle_locking?HA_OPEN_WAIT_IF_LOCKED:0))))
goto err;
if (!m_info)
goto err;
if (!m_info) /* First file */
{
key_parts=isam->s->base.key_parts;
if (!(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO) +
......@@ -97,15 +100,10 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
{
m_info->open_tables=(MYRG_TABLE *) (m_info+1);
m_info->rec_per_key_part=(ulong *) (m_info->open_tables+files);
m_info->tables= files;
files= 0;
}
else
{
m_info->open_tables=0;
m_info->rec_per_key_part=0;
}
m_info->tables=files;
m_info->reclength=isam->s->base.reclength;
file_offset=files=0;
errpos=3;
}
m_info->open_tables[files].table= isam;
......@@ -122,14 +120,16 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
m_info->del+= isam->state->del;
m_info->data_file_length+= isam->state->data_file_length;
for (i=0; i < key_parts; i++)
m_info->rec_per_key_part[i]+=isam->s->state.rec_per_key_part[i] / m_info->tables;
m_info->rec_per_key_part[i]+= (isam->s->state.rec_per_key_part[i] /
m_info->tables);
}
if (!m_info && !(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO),
MYF(MY_WME|MY_ZEROFILL))))
MYF(MY_WME | MY_ZEROFILL))))
goto err;
/* Don't mark table readonly, for ALTER TABLE ... UNION=(...) to work */
m_info->options&= ~(HA_OPTION_COMPRESS_RECORD | HA_OPTION_READ_ONLY_DATA);
m_info->merge_insert_method= found_merge_insert_method;
if (sizeof(my_off_t) == 4 && file_offset > (ulonglong) (ulong) ~0L)
{
......
......@@ -438,7 +438,7 @@ SLAVE_MYERR="$MYSQL_TEST_DIR/var/log/slave.err"
CURRENT_TEST="$MYSQL_TEST_DIR/var/log/current_test"
SMALL_SERVER="--key_buffer_size=1M --sort_buffer=256K --max_heap_table_size=1M"
export MASTER_MYPORT SLAVE_MYPORT MYSQL_TCP_PORT
export MASTER_MYPORT SLAVE_MYPORT MYSQL_TCP_PORT MASTER_MYSOCK
if [ x$SOURCE_DIST = x1 ] ; then
MY_BASEDIR=$MYSQL_TEST_DIR
......@@ -525,13 +525,6 @@ else
fi
fi
MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR $EXTRA_MYSQLBINLOG_OPT"
MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose"
MYSQL="$MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
export MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR
if [ -z "$MASTER_MYSQLD" ]
then
MASTER_MYSQLD=$MYSQLD
......@@ -564,6 +557,12 @@ then
fi
MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR $EXTRA_MYSQLBINLOG_OPT"
MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose"
MYSQL="$MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
export MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR
MYSQL_TEST_ARGS="--no-defaults --socket=$MASTER_MYSOCK --database=$DB \
--user=$DBUSER --password=$DBPASSWD --silent -v --skip-safemalloc \
--tmpdir=$MYSQL_TMP_DIR --port=$MASTER_MYPORT $MYSQL_TEST_SSL_OPTS"
......
drop table if exists t1,t2,t3;
drop database if exists test_$1;
drop database if exists mysqltest;
create table t1 (b char(0));
insert into t1 values (""),(null);
select * from t1;
......@@ -58,18 +58,18 @@ select 1ea10.1a20,1e+ 1e+10 from 1ea10;
drop table 1ea10;
create table t1 (t1.index int);
drop table t1;
drop database if exists test_$1;
drop database if exists mysqltest;
Warnings:
Note 1008 Can't drop database 'test_$1'; database doesn't exist
create database test_$1;
create table test_$1.$test1 (a$1 int, $b int, c$ int);
insert into test_$1.$test1 values (1,2,3);
select a$1, $b, c$ from test_$1.$test1;
Note 1008 Can't drop database 'mysqltest'; database doesn't exist
create database mysqltest;
create table mysqltest.$test1 (a$1 int, $b int, c$ int);
insert into mysqltest.$test1 values (1,2,3);
select a$1, $b, c$ from mysqltest.$test1;
a$1 $b c$
1 2 3
create table test_$1.test2$ (a int);
drop table test_$1.test2$;
drop database test_$1;
create table mysqltest.test2$ (a int);
drop table mysqltest.test2$;
drop database mysqltest;
create table `` (a int);
ERROR 42000: Incorrect table name ''
drop table if exists ``;
......@@ -320,9 +320,9 @@ t3 CREATE TABLE `t3` (
select * from t3;
id name
drop table t2, t3;
create database test_$1;
create table test_$1.t3 like t1;
create temporary table t3 like test_$1.t3;
create database mysqltest;
create table mysqltest.t3 like t1;
create temporary table t3 like mysqltest.t3;
show create table t3;
Table Create Table
t3 CREATE TEMPORARY TABLE `t3` (
......@@ -339,7 +339,7 @@ t2 CREATE TABLE `t2` (
select * from t2;
id name
create table t3 like t1;
create table t3 like test_$1.t3;
create table t3 like mysqltest.t3;
ERROR 42S01: Table 't3' already exists
create table non_existing_database.t1 like t1;
Got one of the listed errors
......@@ -351,7 +351,7 @@ create table t3 like `a/a`;
ERROR 42000: Incorrect table name 'a/a'
drop table t1, t2, t3;
drop table t3;
drop database test_$1;
drop database mysqltest;
SET SESSION storage_engine="heap";
SELECT @@storage_engine;
@@storage_engine
......@@ -488,12 +488,12 @@ Note 1291 Column 'cset' has duplicated value 'b' in SET
Note 1291 Column 'cset' has duplicated value 'B' in SET
Note 1291 Column 'cset' has duplicated value 'd' in SET
drop table t1, t2, t3;
create database test_$1;
use test_$1;
create database mysqltest;
use mysqltest;
select database();
database()
test_$1
drop database test_$1;
mysqltest
drop database mysqltest;
select database();
database()
NULL
......
......@@ -7,6 +7,15 @@ FULLTEXT KEY (a)
repair table t1 quick;
Table Op Msg_type Msg_text
test.t1 repair status OK
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
select count(*) from t1 where match a against ('aaaxxx');
count(*)
260
......
......@@ -18,7 +18,7 @@ explain extended select grp,group_concat(c) from t1 group by grp;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using filesort
Warnings:
Note 1003 select test.t1.grp AS `grp`,group_concat(test.t1.c seperator ',') AS `group_concat(c)` from test.t1 group by test.t1.grp
Note 1003 select test.t1.grp AS `grp`,group_concat(test.t1.c separator ',') AS `group_concat(c)` from test.t1 group by test.t1.grp
select grp,group_concat(a,c) from t1 group by grp;
grp group_concat(a,c)
1 1a
......@@ -93,7 +93,7 @@ explain extended select grp,group_concat(distinct c order by c desc) from t1 gro
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using filesort
Warnings:
Note 1003 select test.t1.grp AS `grp`,group_concat(distinct test.t1.c order by test.t1.c seperator ',') AS `group_concat(distinct c order by c desc)` from test.t1 group by test.t1.grp
Note 1003 select test.t1.grp AS `grp`,group_concat(distinct test.t1.c order by test.t1.c separator ',') AS `group_concat(distinct c order by c desc)` from test.t1 group by test.t1.grp
select grp,group_concat(c order by c separator ",") from t1 group by grp;
grp group_concat(c order by c separator ",")
1 a
......@@ -113,7 +113,7 @@ explain extended select grp,group_concat(distinct c order by c separator ",") fr
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using filesort
Warnings:
Note 1003 select test.t1.grp AS `grp`,group_concat(distinct test.t1.c order by test.t1.c seperator ',') AS `group_concat(distinct c order by c separator ",")` from test.t1 group by test.t1.grp
Note 1003 select test.t1.grp AS `grp`,group_concat(distinct test.t1.c order by test.t1.c separator ',') AS `group_concat(distinct c order by c separator ",")` from test.t1 group by test.t1.grp
select grp,group_concat(distinct c order by c desc separator ",") from t1 group by grp;
grp group_concat(distinct c order by c desc separator ",")
1 a
......
......@@ -148,6 +148,16 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings:
Note 1003 select test.t1.a AS `a`,test.t1.b AS `b`,test.t1.c AS `c` from test.t1 where (_latin1'a' in (test.t1.a,test.t1.b,(test.t1.c collate _latin1'latin1_bin')))
drop table t1;
set names utf8;
create table t1 (a char(10) character set utf8 not null);
insert into t1 values ('bbbb'),(_koi8r'ÃÃÃÃ'),(_latin1'ÄÄÄÄ');
select a from t1 where a in ('bbbb',_koi8r'ÃÃÃÃ',_latin1'ÄÄÄÄ') order by a;
a
ÄÄÄÄ
bbbb
цццц
drop table t1;
set names latin1;
select '1.0' in (1,2);
'1.0' in (1,2)
1
......
drop table if exists t1,t2,t3,t4;
drop table if exists t0,t5,t6,t7,t8,t9;
drop database if exists mysqltest;
create table T1 (id int primary key, Word varchar(40) not null, Index(Word));
create table t4 (id int primary key, Word varchar(40) not null);
INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c');
......@@ -42,6 +44,26 @@ select count(bags.a) from t1 as Bags;
count(bags.a)
0
drop table t1;
create database mysqltest;
use MYSQLTEST;
create table t1 (a int);
select T1.a from MYSQLTEST.T1;
a
select t1.a from MYSQLTEST.T1;
a
select mysqltest.t1.* from MYSQLTEST.t1;
a
select MYSQLTEST.t1.* from MYSQLTEST.t1;
a
select MYSQLTEST.T1.* from MYSQLTEST.T1;
a
select MYSQLTEST.T1.* from T1;
a
alter table t1 rename to T1;
select MYSQLTEST.t1.* from MYSQLTEST.t1;
a
drop database mysqltest;
use test;
create table t1 (a int);
create table t2 (a int);
delete p1.*,P2.* from t1 as p1, t2 as p2 where p1.a=P2.a;
......@@ -58,10 +80,3 @@ ERROR 42000: Not unique table/alias: 'C'
drop table t1, t2;
show tables;
Tables_in_test
create table t1 (a int);
select TEST.t1.* from TEST.t1;
a
alter table t1 rename to T1;
select TEST.t1.* from TEST.t1;
a
drop table t1;
......@@ -642,3 +642,12 @@ x y
1 3
1 2
drop table t1,t2,t3;
create table t1 (a int);
create table t2 (a int);
insert into t1 values (0);
insert into t2 values (1);
create table t3 engine=merge union=(t1, t2) select * from t1;
ERROR HY000: You can't specify target table 't1' for update in FROM clause
create table t3 engine=merge union=(t1, t2) select * from t2;
ERROR HY000: You can't specify target table 't2' for update in FROM clause
drop table t1, t2;
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
drop database if exists test2;
drop database if exists mysqltest;
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
attr1 INT NOT NULL,
......@@ -369,8 +369,8 @@ attr2 INT,
attr3 VARCHAR(10)
) ENGINE=ndbcluster;
INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413');
create database test2;
use test2;
create database mysqltest;
use mysqltest;
CREATE TABLE t2 (
a bigint unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
......@@ -388,4 +388,4 @@ select b,test.t1.attr1 from test.t1, t2 where test.t1.pk1 < a;
b attr1
9413 9412
drop table test.t1, t2;
drop database test2;
drop database mysqltest;
......@@ -93,6 +93,9 @@ a length(b) substr(b,1+4*900,2) length(d) substr(d,1+6*900,3)
2 4512 b1 6000 dd1
update t1 set d=null where a=1;
commit;
select a from t1 where d is null;
a
1
delete from t1 where a=1;
delete from t1 where a=2;
commit;
......@@ -372,3 +375,5 @@ rollback;
select count(*) from t1;
count(*)
0
drop table t1;
drop database mysqltest;
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
drop database if exists test2;
drop database if exists mysqltest;
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
attr1 INT NOT NULL
......@@ -211,8 +211,8 @@ CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
attr1 INT NOT NULL
) ENGINE=ndbcluster;
create database test2;
use test2;
create database mysqltest;
use mysqltest;
CREATE TABLE t2 (
a bigint unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
......@@ -254,4 +254,4 @@ select count(*) from t2;
count(*)
0
drop table test.t1, t2;
drop database test2;
drop database mysqltest;
......@@ -375,4 +375,17 @@ a
13
14
15
delete from t1 where a > 3;
select a, not(not(a)) from t1;
a not(not(a))
NULL NULL
0 0
1 1
2 1
3 1
explain extended select a, not(not(a)), not(a <= 2 and not(a)), not(a not like "1"), not (a not in (1,2)), not(a != 2) from t1 where not(not(a)) having not(not(a));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL a 5 NULL 5 Using where; Using index
Warnings:
Note 1003 select test.t1.a AS `a`,(test.t1.a <> 0) AS `not(not(a))`,((test.t1.a > 2) or test.t1.a) AS `not(a <= 2 and not(a))`,(test.t1.a like _latin1'1') AS `not(a not like "1")`,(test.t1.a in (1,2)) AS `not (a not in (1,2))`,(test.t1.a = 2) AS `not(a != 2)` from test.t1 where test.t1.a having test.t1.a
drop table t1;
......@@ -259,3 +259,14 @@ execute `
1234
1234
set names default;
create table t1 (a varchar(10)) charset=utf8;
insert into t1 (a) values ('yahoo');
set character_set_connection=latin1;
prepare stmt from 'select a from t1 where a like ?';
set @var='google';
execute stmt using @var;
a
execute stmt using @var;
a
deallocate prepare stmt;
drop table t1;
......@@ -334,12 +334,12 @@ prepare stmt1 from ' deallocate prepare never_prepared ' ;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'never_prepared' at line 1
prepare stmt4 from ' use test ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt3 from ' create database drop_me ';
prepare stmt3 from ' create database mysqltest ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
create database drop_me ;
prepare stmt3 from ' drop database drop_me ';
create database mysqltest ;
prepare stmt3 from ' drop database mysqltest ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
drop database drop_me ;
drop database mysqltest ;
prepare stmt3 from ' grant all on test.t1 to drop_user@localhost
identified by ''looser'' ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
......
drop table if exists t0,t1,t2,t3,t4;
drop table if exists t0,t5,t6,t7,t8,t9;
create table t0 SELECT 1,"table 1";
create table t2 SELECT 2,"table 2";
create table t3 SELECT 3,"table 3";
......
This diff is collapsed.
......@@ -4,12 +4,12 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create database test1;
drop database if exists test1;
create database mysqltest;
drop database if exists mysqltest;
Warnings:
Note 1008 Can't drop database 'test1'; database doesn't exist
show tables from test1;
ERROR HY000: Can't read dir of './test1/' (Errcode: X)
Note 1008 Can't drop database 'mysqltest'; database doesn't exist
show tables from mysqltest;
ERROR HY000: Can't read dir of './mysqltest/' (Errcode: X)
create table t1 (a int);
drop table if exists t1;
Warnings:
......
drop table if exists t1,t2;
drop database if exists mysqltest;
create table t1 (a int not null primary key, b int not null,c int not null, key(b,c));
insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4);
check table t1 fast;
......@@ -362,39 +363,39 @@ t1 HEAP 9 Fixed 0 5 # # # 5 NULL NULL NULL NULL latin1_swedish_ci NULL
t2 HEAP 9 Fixed 0 5 # # # 5 NULL NULL NULL NULL latin1_swedish_ci NULL
t3 HEAP 9 Fixed 0 9 # # # 9 NULL NULL NULL NULL latin1_swedish_ci NULL
drop table t1, t2, t3;
create database test_$1;
show create database test_$1;
create database mysqltest;
show create database mysqltest;
Database Create Database
test_$1 CREATE DATABASE `test_$1` /*!40100 DEFAULT CHARACTER SET latin1 */
create table test_$1.t1(a int);
insert into test_$1.t1 values(1);
grant select on `test_$1`.* to mysqltest_1@localhost;
grant usage on `test_$1`.* to mysqltest_2@localhost;
grant drop on `test_$1`.* to mysqltest_3@localhost;
mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */
create table mysqltest.t1(a int);
insert into mysqltest.t1 values(1);
grant select on `mysqltest`.* to mysqltest_1@localhost;
grant usage on `mysqltest`.* to mysqltest_2@localhost;
grant drop on `mysqltest`.* to mysqltest_3@localhost;
select * from t1;
a
1
show create database test_$1;
show create database mysqltest;
Database Create Database
test_$1 CREATE DATABASE `test_$1` /*!40100 DEFAULT CHARACTER SET latin1 */
mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */
drop table t1;
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'test_$1'
drop database test_$1;
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'test_$1'
select * from test_$1.t1;
ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'test_$1'
show create database test_$1;
ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'test_$1'
drop table test_$1.t1;
ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'test_$1'
drop database test_$1;
ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'test_$1'
select * from test_$1.t1;
ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'test_$1'
show create database test_$1;
ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'test_$1'
drop table test_$1.t1;
drop database test_$1;
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest'
drop database mysqltest;
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest'
select * from mysqltest.t1;
ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest'
show create database mysqltest;
ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest'
drop table mysqltest.t1;
ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest'
drop database mysqltest;
ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest'
select * from mysqltest.t1;
ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest'
show create database mysqltest;
ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest'
drop table mysqltest.t1;
drop database mysqltest;
set names binary;
delete from mysql.user
where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
......
This diff is collapsed.
......@@ -436,6 +436,14 @@ select length(version()) > 1 as `*` UNION select 2;
*
1
2
create table t1 (a int);
insert into t1 values (0), (3), (1), (2);
explain (select * from t1) union (select * from t1) order by a;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
2 UNION t1 ALL NULL NULL NULL NULL 4
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL Using filesort
drop table t1;
CREATE TABLE t1 ( id int(3) unsigned default '0') ENGINE=MyISAM;
INSERT INTO t1 (id) VALUES("1");
CREATE TABLE t2 ( id int(3) unsigned default '0', id_master int(5) default '0', text1 varchar(5) default NULL, text2 varchar(5) default NULL) ENGINE=MyISAM;
......
......@@ -110,14 +110,14 @@ drop database mysqltest;
#
# Rights for renaming test (Bug #3270)
#
connect (root,localhost,root,,test,$MASTER_MYPORT,master.sock);
connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection root;
--disable_warnings
create database mysqltest;
--enable_warnings
create table mysqltest.t1 (a int,b int,c int);
grant all on mysqltest.t1 to mysqltest_1@localhost;
connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,master.sock);
connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
connection user1;
-- error 1142
alter table t1 rename t2;
......
......@@ -4,7 +4,7 @@
--disable_warnings
drop table if exists t1,t2,t3;
drop database if exists test_$1;
drop database if exists mysqltest;
--enable_warnings
create table t1 (b char(0));
......@@ -69,14 +69,14 @@ drop table 1ea10;
create table t1 (t1.index int);
drop table t1;
# Test that we get warning for this
drop database if exists test_$1;
create database test_$1;
create table test_$1.$test1 (a$1 int, $b int, c$ int);
insert into test_$1.$test1 values (1,2,3);
select a$1, $b, c$ from test_$1.$test1;
create table test_$1.test2$ (a int);
drop table test_$1.test2$;
drop database test_$1;
drop database if exists mysqltest;
create database mysqltest;
create table mysqltest.$test1 (a$1 int, $b int, c$ int);
insert into mysqltest.$test1 values (1,2,3);
select a$1, $b, c$ from mysqltest.$test1;
create table mysqltest.test2$ (a int);
drop table mysqltest.test2$;
drop database mysqltest;
--error 1103
create table `` (a int);
......@@ -281,16 +281,16 @@ drop table t3;
show create table t3;
select * from t3;
drop table t2, t3;
create database test_$1;
create table test_$1.t3 like t1;
create temporary table t3 like test_$1.t3;
create database mysqltest;
create table mysqltest.t3 like t1;
create temporary table t3 like mysqltest.t3;
show create table t3;
create table t2 like t3;
show create table t2;
select * from t2;
create table t3 like t1;
--error 1050
create table t3 like test_$1.t3;
create table t3 like mysqltest.t3;
--error 1044,1
create table non_existing_database.t1 like t1;
--error 1051
......@@ -301,7 +301,7 @@ create temporary table t3 like t1;
create table t3 like `a/a`;
drop table t1, t2, t3;
drop table t3;
drop database test_$1;
drop database mysqltest;
#
# Test default table type
......@@ -393,10 +393,10 @@ drop table t1, t2, t3;
# Bug #1209
#
create database test_$1;
use test_$1;
create database mysqltest;
use mysqltest;
select database();
drop database test_$1;
drop database mysqltest;
select database();
# Connect without a database
......
......@@ -44,6 +44,9 @@ while ($1)
# converting to two-level
repair table t1 quick;
check table t1;
optimize table t1; # BUG#5327 - mi_sort_index() of 2-level tree
check table t1;
select count(*) from t1 where match a against ('aaaxxx');
select count(*) from t1 where match a against ('aaayyy');
......@@ -102,6 +105,11 @@ CREATE TABLE t1 (
FULLTEXT KEY (a)
) ENGINE=MyISAM;
#
# now same as about but w/o repair table
# 2-level tree created by mi_write
#
# two-level entry, second-level tree with depth 2
--disable_query_log
let $1=260;
......
......@@ -75,6 +75,13 @@ select * from t1 where 'a' in (a,b,c collate latin1_bin);
explain extended select * from t1 where 'a' in (a,b,c collate latin1_bin);
drop table t1;
set names utf8;
create table t1 (a char(10) character set utf8 not null);
insert into t1 values ('bbbb'),(_koi8r'ÃÃÃÃ'),(_latin1'ÄÄÄÄ');
select a from t1 where a in ('bbbb',_koi8r'ÃÃÃÃ',_latin1'ÄÄÄÄ') order by a;
drop table t1;
set names latin1;
select '1.0' in (1,2);
select 1 in ('1.0',2);
select 1 in (1,'2.0');
......
......@@ -4,6 +4,9 @@
--disable_warnings
drop table if exists t1,t2,t3,t4;
# Clear up from other tests (to ensure that SHOW TABLES below is right)
drop table if exists t0,t5,t6,t7,t8,t9;
drop database if exists mysqltest;
--enable_warnings
create table T1 (id int primary key, Word varchar(40) not null, Index(Word));
......@@ -31,6 +34,23 @@ select count(T1.a) from t1;
select count(bags.a) from t1 as Bags;
drop table t1;
#
# Test all caps database name
#
create database mysqltest;
use MYSQLTEST;
create table t1 (a int);
select T1.a from MYSQLTEST.T1;
select t1.a from MYSQLTEST.T1;
select mysqltest.t1.* from MYSQLTEST.t1;
select MYSQLTEST.t1.* from MYSQLTEST.t1;
select MYSQLTEST.T1.* from MYSQLTEST.T1;
select MYSQLTEST.T1.* from T1;
alter table t1 rename to T1;
select MYSQLTEST.t1.* from MYSQLTEST.t1;
drop database mysqltest;
use test;
#
# multiupdate/delete & --lower-case-table-names
#
......@@ -54,13 +74,3 @@ select C.a, c.a from t1 c, t2 C;
drop table t1, t2;
show tables;
#
# Test all caps database name
#
create table t1 (a int);
select TEST.t1.* from TEST.t1;
alter table t1 rename to T1;
select TEST.t1.* from TEST.t1;
drop table t1;
......@@ -271,3 +271,17 @@ select * from t3 where x = 1 and y < 5 order by y;
# Bug is that followng query returns empty set while it must be same as above
select * from t3 where x = 1 and y < 5 order by y desc;
drop table t1,t2,t3;
#
# Bug#5232: CREATE TABLE ... SELECT
#
create table t1 (a int);
create table t2 (a int);
insert into t1 values (0);
insert into t2 values (1);
--error 1093
create table t3 engine=merge union=(t1, t2) select * from t1;
--error 1093
create table t3 engine=merge union=(t1, t2) select * from t2;
drop table t1, t2;
......@@ -2,7 +2,7 @@
--disable_warnings
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
drop database if exists test2;
drop database if exists mysqltest;
--enable_warnings
#
......@@ -340,8 +340,8 @@ CREATE TABLE t1 (
INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413');
create database test2;
use test2;
create database mysqltest;
use mysqltest;
CREATE TABLE t2 (
a bigint unsigned NOT NULL PRIMARY KEY,
......@@ -355,7 +355,5 @@ select b from test.t1, t2 where c = test.t1.attr2;
select b,test.t1.attr1 from test.t1, t2 where test.t1.pk1 < a;
drop table test.t1, t2;
drop database test2;
drop database mysqltest;
......@@ -2,7 +2,7 @@
--disable_warnings
drop table if exists t1;
drop database if exists test2;
drop database if exists mysqltest;
--enable_warnings
#
......@@ -241,8 +241,8 @@ select * from t1 order by a;
# multi db
create database test2;
use test2;
create database mysqltest;
use mysqltest;
CREATE TABLE t2 (
a bigint unsigned NOT NULL PRIMARY KEY,
......@@ -306,5 +306,5 @@ select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
from t1 order by a;
rollback;
select count(*) from t1;
--drop table t1;
drop table t1;
drop database mysqltest;
......@@ -2,7 +2,7 @@
--disable_warnings
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
drop database if exists test2;
drop database if exists mysqltest;
--enable_warnings
#
......@@ -263,8 +263,8 @@ CREATE TABLE t1 (
attr1 INT NOT NULL
) ENGINE=ndbcluster;
create database test2;
use test2;
create database mysqltest;
use mysqltest;
CREATE TABLE t2 (
a bigint unsigned NOT NULL PRIMARY KEY,
......@@ -292,7 +292,6 @@ select count(*) from test.t1;
select count(*) from t2;
drop table test.t1, t2;
drop database test2;
drop database mysqltest;
......@@ -65,4 +65,8 @@ select * from t1 where not((a < 5 and a < 10) and (not(a > 16) or a > 17));
explain select * from t1 where ((a between 5 and 15) and (not(a like 10)));
select * from t1 where ((a between 5 and 15) and (not(a like 10)));
delete from t1 where a > 3;
select a, not(not(a)) from t1;
explain extended select a, not(not(a)), not(a <= 2 and not(a)), not(a not like "1"), not (a not in (1,2)), not(a != 2) from t1 where not(not(a)) having not(not(a));
drop table t1;
......@@ -261,3 +261,20 @@ execute `
set names default;
#
# BUG#4368 "select * from t1 where a like ?" crashes server if a is in utf8
# and ? is in latin1
# Check that Item converting latin1 to utf8 (for LIKE function) is created
# in memory of prepared statement.
#
create table t1 (a varchar(10)) charset=utf8;
insert into t1 (a) values ('yahoo');
set character_set_connection=latin1;
prepare stmt from 'select a from t1 where a like ?';
set @var='google';
execute stmt using @var;
execute stmt using @var;
deallocate prepare stmt;
drop table t1;
......@@ -350,11 +350,11 @@ prepare stmt4 from ' use test ' ;
## create/drop database
--error 1295
prepare stmt3 from ' create database drop_me ';
create database drop_me ;
prepare stmt3 from ' create database mysqltest ';
create database mysqltest ;
--error 1295
prepare stmt3 from ' drop database drop_me ';
drop database drop_me ;
prepare stmt3 from ' drop database mysqltest ';
drop database mysqltest ;
## grant/revoke + drop user
--error 1295
......
......@@ -4,6 +4,8 @@
--disable_warnings
drop table if exists t0,t1,t2,t3,t4;
# Clear up from other tests (to ensure that SHOW TABLES below is right)
drop table if exists t0,t5,t6,t7,t8,t9;
--enable_warnings
create table t0 SELECT 1,"table 1";
......
......@@ -6,41 +6,41 @@
source include/master-slave.inc;
--disable_warnings
drop database if exists test2;
drop database if exists test3;
drop database if exists mysqltest2;
drop database if exists mysqltest3;
--enable_warnings
create database test2 character set latin2;
create database mysqltest2 character set latin2;
set @@character_set_server=latin5;
create database test3;
create database mysqltest3;
--disable_query_log
select "--- --master--" as "";
--enable_query_log
show create database test2;
show create database test3;
show create database mysqltest2;
show create database mysqltest3;
sync_slave_with_master;
--disable_query_log
select "--- --slave--" as "";
--enable_query_log
show create database test2;
show create database test3;
show create database mysqltest2;
show create database mysqltest3;
connection master;
set @@collation_server=armscii8_bin;
drop database test3;
create database test3;
drop database mysqltest3;
create database mysqltest3;
--disable_query_log
select "--- --master--" as "";
--enable_query_log
show create database test3;
show create database mysqltest3;
sync_slave_with_master;
--disable_query_log
select "--- --slave--" as "";
--enable_query_log
show create database test3;
show create database mysqltest3;
connection master;
use test2;
use mysqltest2;
create table t1 (a int auto_increment primary key, b varchar(100));
set character_set_client=cp850, collation_connection=latin2_croatian_ci;
insert into t1 (b) values(@@character_set_server);
......@@ -59,7 +59,7 @@ sync_slave_with_master;
--disable_query_log
select "--- --slave--" as "";
--enable_query_log
select * from test2.t1 order by a;
select * from mysqltest2.t1 order by a;
connection master;
set character_set_client=latin1, collation_connection=latin1_german1_ci;
......@@ -77,7 +77,7 @@ sync_slave_with_master;
--disable_query_log
select "--- --slave--" as "";
--enable_query_log
select * from test2.t1 order by a;
select * from mysqltest2.t1 order by a;
# See if SET ONE_SHOT gets into binlog when LOAD DATA
connection master;
......@@ -101,11 +101,11 @@ sync_slave_with_master;
--disable_query_log
select "--- --slave--" as "";
--enable_query_log
select * from test2.t1 order by a;
select * from mysqltest2.t1 order by a;
connection master;
drop database test2;
drop database test3;
drop database mysqltest2;
drop database mysqltest3;
show binlog events from 79;
sync_slave_with_master;
......
source include/master-slave.inc;
connection slave;
create database test1;
create database mysqltest;
connection master;
drop database if exists test1;
drop database if exists mysqltest;
sync_slave_with_master;
# can't read dir
--replace_result "Errcode: 1" "Errcode: X" "Errcode: 2" "Errcode: X"
--error 12
show tables from test1;
show tables from mysqltest;
connection slave;
create table t1 (a int);
......
......@@ -4,6 +4,7 @@
--disable_warnings
drop table if exists t1,t2;
drop database if exists mysqltest;
--enable_warnings
create table t1 (a int not null primary key, b int not null,c int not null, key(b,c));
......@@ -261,42 +262,42 @@ drop table t1, t2, t3;
# Test for bug #3342 SHOW CREATE DATABASE seems to require DROP privilege
#
create database test_$1;
show create database test_$1;
create table test_$1.t1(a int);
insert into test_$1.t1 values(1);
grant select on `test_$1`.* to mysqltest_1@localhost;
grant usage on `test_$1`.* to mysqltest_2@localhost;
grant drop on `test_$1`.* to mysqltest_3@localhost;
create database mysqltest;
show create database mysqltest;
create table mysqltest.t1(a int);
insert into mysqltest.t1 values(1);
grant select on `mysqltest`.* to mysqltest_1@localhost;
grant usage on `mysqltest`.* to mysqltest_2@localhost;
grant drop on `mysqltest`.* to mysqltest_3@localhost;
connect (con1,localhost,mysqltest_1,,test_$1);
connect (con1,localhost,mysqltest_1,,mysqltest);
connection con1;
select * from t1;
show create database test_$1;
show create database mysqltest;
--error 1044
drop table t1;
--error 1044
drop database test_$1;
drop database mysqltest;
connect (con2,localhost,mysqltest_2,,test);
connection con2;
--error 1044
select * from test_$1.t1;
select * from mysqltest.t1;
--error 1044
show create database test_$1;
show create database mysqltest;
--error 1044
drop table test_$1.t1;
drop table mysqltest.t1;
--error 1044
drop database test_$1;
drop database mysqltest;
connect (con3,localhost,mysqltest_3,,test);
connection con3;
--error 1044
select * from test_$1.t1;
select * from mysqltest.t1;
--error 1044
show create database test_$1;
drop table test_$1.t1;
drop database test_$1;
show create database mysqltest;
drop table mysqltest.t1;
drop database mysqltest;
connection default;
set names binary;
......
......@@ -264,6 +264,14 @@ drop table t1,t2;
select length(version()) > 1 as `*` UNION select 2;
#
# Bug #4980: problem with explain
#
create table t1 (a int);
insert into t1 values (0), (3), (1), (2);
explain (select * from t1) union (select * from t1) order by a;
drop table t1;
#
# Test for another bug with UNION and LEFT JOIN
#
......
......@@ -21,6 +21,9 @@
#include <mysys_err.h>
#include <my_getopt.h>
static void default_reporter(enum loglevel level, const char *format, ...);
my_error_reporter my_getopt_error_reporter= &default_reporter;
static int findopt(char *optpat, uint length,
const struct my_option **opt_res,
char **ffname);
......@@ -56,7 +59,8 @@ char *disabled_my_option= (char*) "0";
my_bool my_getopt_print_errors= 1;
void default_reporter(enum loglevel level, const char *format, ...)
static void default_reporter(enum loglevel level __attribute__((unused)),
const char *format, ...)
{
va_list args;
va_start(args, format);
......@@ -83,8 +87,8 @@ void my_getopt_register_get_addr(gptr* (*func_addr)(const char *, uint,
}
int handle_options(int *argc, char ***argv,
const struct my_option *longopts, my_get_one_option get_one_option,
my_error_reporter reporter)
const struct my_option *longopts,
my_get_one_option get_one_option)
{
uint opt_found, argvpos= 0, length, i;
my_bool end_of_options= 0, must_be_var, set_maximum_value,
......@@ -100,8 +104,6 @@ int handle_options(int *argc, char ***argv,
(*argv)++; /* --- || ---- */
init_variables(longopts);
if (! reporter) reporter = &default_reporter;
for (pos= *argv, pos_end=pos+ *argc; pos != pos_end ; pos++)
{
char *cur_arg= *pos;
......@@ -125,8 +127,9 @@ int handle_options(int *argc, char ***argv,
if (!*++pos)
{
if (my_getopt_print_errors)
reporter(ERROR_LEVEL, "%s: Option '-O' requires an argument\n",
my_progname);
my_getopt_error_reporter(ERROR_LEVEL,
"%s: Option '-O' requires an argument\n",
my_progname);
return EXIT_ARGUMENT_REQUIRED;
}
cur_arg= *pos;
......@@ -142,8 +145,9 @@ int handle_options(int *argc, char ***argv,
if (!*cur_arg)
{
if (my_getopt_print_errors)
reporter(ERROR_LEVEL, "%s: Option '--set-variable' requires an argument\n",
my_progname);
my_getopt_error_reporter(ERROR_LEVEL,
"%s: Option '--set-variable' requires an argument\n",
my_progname);
return EXIT_ARGUMENT_REQUIRED;
}
}
......@@ -155,8 +159,9 @@ int handle_options(int *argc, char ***argv,
if (!*++pos)
{
if (my_getopt_print_errors)
reporter(ERROR_LEVEL, "%s: Option '--set-variable' requires an argument\n",
my_progname);
my_getopt_error_reporter(ERROR_LEVEL,
"%s: Option '--set-variable' requires an argument\n",
my_progname);
return EXIT_ARGUMENT_REQUIRED;
}
cur_arg= *pos;
......@@ -215,10 +220,11 @@ int handle_options(int *argc, char ***argv,
if (opt_found > 1)
{
if (my_getopt_print_errors)
reporter(ERROR_LEVEL,
"%s: ambiguous option '--%s-%s' (--%s-%s)\n",
my_progname, special_opt_prefix[i], opt_str,
special_opt_prefix[i], prev_found);
my_getopt_error_reporter(ERROR_LEVEL,
"%s: ambiguous option '--%s-%s' (--%s-%s)\n",
my_progname, special_opt_prefix[i],
cur_arg, special_opt_prefix[i],
prev_found);
return EXIT_AMBIGUOUS_OPTION;
}
switch (i) {
......@@ -250,16 +256,20 @@ int handle_options(int *argc, char ***argv,
if (must_be_var)
{
if (my_getopt_print_errors)
reporter(option_is_loose ? WARNING_LEVEL : ERROR_LEVEL,
"%s: unknown variable '%s'\n", my_progname, cur_arg);
my_getopt_error_reporter(option_is_loose ?
WARNING_LEVEL : ERROR_LEVEL,
"%s: unknown variable '%s'\n",
my_progname, cur_arg);
if (!option_is_loose)
return EXIT_UNKNOWN_VARIABLE;
}
else
{
if (my_getopt_print_errors)
reporter(option_is_loose ? WARNING_LEVEL : ERROR_LEVEL,
"%s: unknown option '--%s'\n", my_progname, cur_arg);
my_getopt_error_reporter(option_is_loose ?
WARNING_LEVEL : ERROR_LEVEL,
"%s: unknown option '--%s'\n",
my_progname, cur_arg);
if (!option_is_loose)
return EXIT_UNKNOWN_OPTION;
}
......@@ -275,15 +285,18 @@ int handle_options(int *argc, char ***argv,
if (must_be_var)
{
if (my_getopt_print_errors)
reporter(ERROR_LEVEL, "%s: variable prefix '%s' is not unique\n",
my_progname, opt_str);
my_getopt_error_reporter(ERROR_LEVEL,
"%s: variable prefix '%s' is not unique\n",
my_progname, opt_str);
return EXIT_VAR_PREFIX_NOT_UNIQUE;
}
else
{
if (my_getopt_print_errors)
reporter(ERROR_LEVEL, "%s: ambiguous option '--%s' (%s, %s)\n",
my_progname, opt_str, prev_found, optp->name);
my_getopt_error_reporter(ERROR_LEVEL,
"%s: ambiguous option '--%s' (%s, %s)\n",
my_progname, opt_str, prev_found,
optp->name);
return EXIT_AMBIGUOUS_OPTION;
}
}
......@@ -303,8 +316,9 @@ int handle_options(int *argc, char ***argv,
if (must_be_var && (optp->var_type & GET_TYPE_MASK) == GET_NO_ARG)
{
if (my_getopt_print_errors)
reporter(ERROR_LEVEL, "%s: option '%s' cannot take an argument\n",
my_progname, optp->name);
my_getopt_error_reporter(ERROR_LEVEL,
"%s: option '%s' cannot take an argument\n",
my_progname, optp->name);
return EXIT_NO_ARGUMENT_ALLOWED;
}
value= optp->var_type & GET_ASK_ADDR ?
......@@ -315,8 +329,9 @@ int handle_options(int *argc, char ***argv,
if (optend && (optp->var_type & GET_TYPE_MASK) != GET_BOOL)
{
if (my_getopt_print_errors)
reporter(ERROR_LEVEL, "%s: option '--%s' cannot take an argument\n",
my_progname, optp->name);
my_getopt_error_reporter(ERROR_LEVEL,
"%s: option '--%s' cannot take an argument\n",
my_progname, optp->name);
return EXIT_NO_ARGUMENT_ALLOWED;
}
if ((optp->var_type & GET_TYPE_MASK) == GET_BOOL)
......@@ -354,8 +369,9 @@ int handle_options(int *argc, char ***argv,
if (!*++pos)
{
if (my_getopt_print_errors)
reporter(ERROR_LEVEL, "%s: option '--%s' requires an argument\n",
my_progname, optp->name);
my_getopt_error_reporter(ERROR_LEVEL,
"%s: option '--%s' requires an argument\n",
my_progname, optp->name);
return EXIT_ARGUMENT_REQUIRED;
}
argument= *pos;
......@@ -413,9 +429,9 @@ int handle_options(int *argc, char ***argv,
if (!pos[1])
{
if (my_getopt_print_errors)
reporter(ERROR_LEVEL,
"%s: option '-%c' requires an argument\n",
my_progname, optp->id);
my_getopt_error_reporter(ERROR_LEVEL,
"%s: option '-%c' requires an argument\n",
my_progname, optp->id);
return EXIT_ARGUMENT_REQUIRED;
}
argument= *++pos;
......@@ -426,9 +442,9 @@ int handle_options(int *argc, char ***argv,
if ((error= setval(optp, optp->value, argument,
set_maximum_value)))
{
reporter(ERROR_LEVEL,
"%s: Error while setting value '%s' to '%s'\n",
my_progname, argument, optp->name);
my_getopt_error_reporter(ERROR_LEVEL,
"%s: Error while setting value '%s' to '%s'\n",
my_progname, argument, optp->name);
return error;
}
get_one_option(optp->id, optp, argument);
......@@ -438,8 +454,9 @@ int handle_options(int *argc, char ***argv,
if (!opt_found)
{
if (my_getopt_print_errors)
reporter(ERROR_LEVEL,
"%s: unknown option '-%c'\n", my_progname, *optend);
my_getopt_error_reporter(ERROR_LEVEL,
"%s: unknown option '-%c'\n",
my_progname, *optend);
return EXIT_UNKNOWN_OPTION;
}
}
......@@ -448,9 +465,9 @@ int handle_options(int *argc, char ***argv,
}
if ((error= setval(optp, value, argument, set_maximum_value)))
{
reporter(ERROR_LEVEL,
"%s: Error while setting value '%s' to '%s'\n",
my_progname, argument, optp->name);
my_getopt_error_reporter(ERROR_LEVEL,
"%s: Error while setting value '%s' to '%s'\n",
my_progname, argument, optp->name);
return error;
}
get_one_option(optp->id, optp, argument);
......
......@@ -68,7 +68,8 @@ then
c_d="$c_d Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_d="$c_d PRIMARY KEY Host (Host,Db,User),"
c_d="$c_d KEY User (User)"
c_d="$c_d )"
c_d="$c_d ) engine=MyISAM"
c_d="$c_d CHARACTER SET utf8 COLLATE utf8_bin"
c_d="$c_d comment='Database privileges';"
i_d="INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
......@@ -97,7 +98,8 @@ then
c_h="$c_h Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_h="$c_h Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_h="$c_h PRIMARY KEY Host (Host,Db)"
c_h="$c_h )"
c_h="$c_h ) engine=MyISAM"
c_h="$c_h CHARACTER SET utf8 COLLATE utf8_bin"
c_h="$c_h comment='Host privileges; Merged with database privileges';"
fi
......@@ -140,7 +142,8 @@ then
c_u="$c_u max_updates int(11) unsigned DEFAULT 0 NOT NULL,"
c_u="$c_u max_connections int(11) unsigned DEFAULT 0 NOT NULL,"
c_u="$c_u PRIMARY KEY Host (Host,User)"
c_u="$c_u )"
c_u="$c_u ) engine=MyISAM"
c_u="$c_u CHARACTER SET utf8 COLLATE utf8_bin"
c_u="$c_u comment='Users and global privileges';"
if test "$1" = "test"
......@@ -179,7 +182,8 @@ then
c_f="$c_f dl char(128) DEFAULT '' NOT NULL,"
c_f="$c_f type enum ('function','aggregate') NOT NULL,"
c_f="$c_f PRIMARY KEY (name)"
c_f="$c_f )"
c_f="$c_f ) engine=MyISAM"
c_f="$c_f CHARACTER SET utf8 COLLATE utf8_bin"
c_f="$c_f comment='User defined functions';"
fi
......@@ -200,7 +204,8 @@ then
c_t="$c_t Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,"
c_t="$c_t PRIMARY KEY (Host,Db,User,Table_name),"
c_t="$c_t KEY Grantor (Grantor)"
c_t="$c_t )"
c_t="$c_t ) engine=MyISAM"
c_t="$c_t CHARACTER SET utf8 COLLATE utf8_bin"
c_t="$c_t comment='Table privileges';"
fi
......@@ -219,7 +224,8 @@ then
c_c="$c_c Timestamp timestamp(14),"
c_c="$c_c Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,"
c_c="$c_c PRIMARY KEY (Host,Db,User,Table_name,Column_name)"
c_c="$c_c )"
c_c="$c_c ) engine=MyISAM"
c_c="$c_c CHARACTER SET utf8 COLLATE utf8_bin"
c_c="$c_c comment='Column privileges';"
fi
......@@ -231,14 +237,15 @@ then
c_ht="$c_ht CREATE TABLE help_topic ("
c_ht="$c_ht help_topic_id int unsigned not null,"
c_ht="$c_ht name nvarchar(64) not null,"
c_ht="$c_ht name varchar(64) not null,"
c_ht="$c_ht help_category_id smallint unsigned not null,"
c_ht="$c_ht description text not null,"
c_ht="$c_ht example text not null,"
c_ht="$c_ht url nvarchar(128) not null,"
c_ht="$c_ht url varchar(128) not null,"
c_ht="$c_ht primary key (help_topic_id),"
c_ht="$c_ht unique index (name)"
c_ht="$c_ht )"
c_ht="$c_ht ) engine=MyISAM"
c_ht="$c_ht CHARACTER SET utf8"
c_ht="$c_ht comment='help topics';"
fi
......@@ -252,12 +259,13 @@ then
c_hc="$c_hc CREATE TABLE help_category ("
c_hc="$c_hc help_category_id smallint unsigned not null,"
c_hc="$c_hc name nvarchar(64) not null,"
c_hc="$c_hc name varchar(64) not null,"
c_hc="$c_hc parent_category_id smallint unsigned null,"
c_hc="$c_hc url nvarchar(128) not null,"
c_hc="$c_hc url varchar(128) not null,"
c_hc="$c_hc primary key (help_category_id),"
c_hc="$c_hc unique index (name)"
c_hc="$c_hc )"
c_hc="$c_hc ) engine=MyISAM"
c_hc="$c_hc CHARACTER SET utf8"
c_hc="$c_hc comment='help categories';"
fi
......@@ -269,10 +277,11 @@ then
c_hk="$c_hk CREATE TABLE help_keyword ("
c_hk="$c_hk help_keyword_id int unsigned not null,"
c_hk="$c_hk name nvarchar(64) not null,"
c_hk="$c_hk name varchar(64) not null,"
c_hk="$c_hk primary key (help_keyword_id),"
c_hk="$c_hk unique index (name)"
c_hk="$c_hk )"
c_hk="$c_hk ) engine=MyISAM"
c_hk="$c_hk CHARACTER SET utf8"
c_hk="$c_hk comment='help keywords';"
fi
......@@ -286,7 +295,8 @@ then
c_hr="$c_hr help_topic_id int unsigned not null references help_topic,"
c_hr="$c_hr help_keyword_id int unsigned not null references help_keyword,"
c_hr="$c_hr primary key (help_keyword_id, help_topic_id)"
c_hr="$c_hr )"
c_hr="$c_hr ) engine=MyISAM"
c_hr="$c_hr CHARACTER SET utf8"
c_hr="$c_hr comment='keyword-topic relation';"
fi
......@@ -300,7 +310,7 @@ then
c_tzn="$c_tzn Name char(64) NOT NULL,"
c_tzn="$c_tzn Time_zone_id int unsigned NOT NULL,"
c_tzn="$c_tzn PRIMARY KEY Name (Name)"
c_tzn="$c_tzn ) DEFAULT CHARACTER SET latin1"
c_tzn="$c_tzn ) engine=MyISAM CHARACTER SET utf8"
c_tzn="$c_tzn comment='Time zone names';"
if test "$1" = "test"
......@@ -322,7 +332,7 @@ then
c_tz="$c_tz Time_zone_id int unsigned NOT NULL auto_increment,"
c_tz="$c_tz Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL,"
c_tz="$c_tz PRIMARY KEY TzId (Time_zone_id)"
c_tz="$c_tz ) DEFAULT CHARACTER SET latin1"
c_tz="$c_tz ) engine=MyISAM CHARACTER SET utf8"
c_tz="$c_tz comment='Time zones';"
if test "$1" = "test"
......@@ -343,7 +353,7 @@ then
c_tzt="$c_tzt Transition_time bigint signed NOT NULL,"
c_tzt="$c_tzt Transition_type_id int unsigned NOT NULL,"
c_tzt="$c_tzt PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)"
c_tzt="$c_tzt ) DEFAULT CHARACTER SET latin1"
c_tzt="$c_tzt ) engine=MyISAM CHARACTER SET utf8"
c_tzt="$c_tzt comment='Time zone transitions';"
if test "$1" = "test"
......@@ -565,7 +575,7 @@ then
c_tztt="$c_tztt Is_DST tinyint unsigned DEFAULT 0 NOT NULL,"
c_tztt="$c_tztt Abbreviation char(8) DEFAULT '' NOT NULL,"
c_tztt="$c_tztt PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)"
c_tztt="$c_tztt ) DEFAULT CHARACTER SET latin1"
c_tztt="$c_tztt ) engine=MyISAM CHARACTER SET utf8"
c_tztt="$c_tztt comment='Time zone transition types';"
if test "$1" = "test"
......@@ -601,7 +611,7 @@ then
c_tzls="$c_tzls Transition_time bigint signed NOT NULL,"
c_tzls="$c_tzls Correction int signed NOT NULL,"
c_tzls="$c_tzls PRIMARY KEY TranTime (Transition_time)"
c_tzls="$c_tzls ) DEFAULT CHARACTER SET latin1"
c_tzls="$c_tzls ) engine=MyISAM CHARACTER SET utf8"
c_tzls="$c_tzls comment='Leap seconds information for time zones';"
if test "$1" = "test"
......
......@@ -9,12 +9,12 @@
-- this sql script.
-- On windows you should do 'mysql --force mysql < mysql_fix_privilege_tables.sql'
ALTER TABLE user type=MyISAM;
ALTER TABLE db type=MyISAM;
ALTER TABLE host type=MyISAM;
ALTER TABLE func type=MyISAM;
ALTER TABLE columns_priv type=MyISAM;
ALTER TABLE tables_priv type=MyISAM;
ALTER TABLE user type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
ALTER TABLE db type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
ALTER TABLE host type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
ALTER TABLE func type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
ALTER TABLE columns_priv type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
ALTER TABLE tables_priv type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
ALTER TABLE user change Password Password char(41) binary not null;
ALTER TABLE user add File_priv enum('N','Y') NOT NULL;
CREATE TABLE IF NOT EXISTS func (
......@@ -23,7 +23,7 @@ CREATE TABLE IF NOT EXISTS func (
dl char(128) DEFAULT '' NOT NULL,
type enum ('function','aggregate') NOT NULL,
PRIMARY KEY (name)
);
) CHARACTER SET utf8 COLLATE utf8_bin;
-- Detect whether or not we had the Grant_priv column
SET @hadGrantPriv:=0;
......@@ -63,7 +63,7 @@ CREATE TABLE IF NOT EXISTS tables_priv (
Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL,
Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,
PRIMARY KEY (Host,Db,User,Table_name)
);
) CHARACTER SET utf8 COLLATE utf8_bin;
CREATE TABLE IF NOT EXISTS columns_priv (
Host char(60) DEFAULT '' NOT NULL,
......@@ -74,7 +74,7 @@ CREATE TABLE IF NOT EXISTS columns_priv (
Timestamp timestamp(14),
Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,
PRIMARY KEY (Host,Db,User,Table_name,Column_name)
);
) CHARACTER SET utf8 COLLATE utf8_bin;
--
......@@ -156,7 +156,7 @@ description text not null,
example text not null,
url varchar(128) not null,
primary key (help_topic_id), unique index (name)
) comment='help topics';
) CHARACTER SET utf8 comment='help topics';
CREATE TABLE IF NOT EXISTS help_category (
help_category_id smallint unsigned not null,
......@@ -165,20 +165,20 @@ parent_category_id smallint unsigned null,
url varchar(128) not null,
primary key (help_category_id),
unique index (name)
) comment='help categories';
) CHARACTER SET utf8 comment='help categories';
CREATE TABLE IF NOT EXISTS help_relation (
help_topic_id int unsigned not null references help_topic,
help_keyword_id int unsigned not null references help_keyword,
primary key (help_keyword_id, help_topic_id)
) comment='keyword-topic relation';
) CHARACTER SET utf8 comment='keyword-topic relation';
CREATE TABLE IF NOT EXISTS help_keyword (
help_keyword_id int unsigned not null,
name varchar(64) not null,
primary key (help_keyword_id),
unique index (name)
) comment='help keywords';
) CHARACTER SET utf8 comment='help keywords';
#
# Create missing time zone related tables
......@@ -188,20 +188,20 @@ CREATE TABLE IF NOT EXISTS time_zone_name (
Name char(64) NOT NULL,
Time_zone_id int unsigned NOT NULL,
PRIMARY KEY Name (Name)
) DEFAULT CHARACTER SET latin1 comment='Time zone names';
) CHARACTER SET utf8 comment='Time zone names';
CREATE TABLE IF NOT EXISTS time_zone (
Time_zone_id int unsigned NOT NULL auto_increment,
Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL,
PRIMARY KEY TzId (Time_zone_id)
) DEFAULT CHARACTER SET latin1 comment='Time zones';
) CHARACTER SET utf8 comment='Time zones';
CREATE TABLE IF NOT EXISTS time_zone_transition (
Time_zone_id int unsigned NOT NULL,
Transition_time bigint signed NOT NULL,
Transition_type_id int unsigned NOT NULL,
PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)
) DEFAULT CHARACTER SET latin1 comment='Time zone transitions';
) CHARACTER SET utf8 comment='Time zone transitions';
CREATE TABLE IF NOT EXISTS time_zone_transition_type (
Time_zone_id int unsigned NOT NULL,
......@@ -210,11 +210,11 @@ Offset int signed DEFAULT 0 NOT NULL,
Is_DST tinyint unsigned DEFAULT 0 NOT NULL,
Abbreviation char(8) DEFAULT '' NOT NULL,
PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)
) DEFAULT CHARACTER SET latin1 comment='Time zone transition types';
) CHARACTER SET utf8 comment='Time zone transition types';
CREATE TABLE IF NOT EXISTS time_zone_leap_second (
Transition_time bigint signed NOT NULL,
Correction int signed NOT NULL,
PRIMARY KEY TranTime (Transition_time)
) DEFAULT CHARACTER SET latin1 comment='Leap seconds information for time zones';
) CHARACTER SET utf8 comment='Leap seconds information for time zones';
......@@ -311,6 +311,7 @@ do
fi
if test ! -f $pid_file # This is removed if normal shutdown
then
echo "STOPPING server from pid file $pid_file"
break
fi
......@@ -321,12 +322,24 @@ do
# but should work for the rest of the servers.
# The only thing is ps x => redhat 5 gives warnings when using ps -x.
# kill -9 is used or the process won't react on the kill.
numofproces=`ps xa | grep -v "grep" | grep -c $ledir/$MYSQLD`
if test -n "$mysql_tcp_port"
then
numofproces=`ps xa | grep -v "grep" | grep $ledir/$MYSQLD| grep -c "port=$mysql_tcp_port"`
else
numofproces=`ps xa | grep -v "grep" | grep -c $ledir/$MYSQLD`
fi
echo -e "\nNumber of processes running now: $numofproces" | tee -a $err_log
I=1
while test "$I" -le "$numofproces"
do
PROC=`ps xa | grep $ledir/$MYSQLD | grep -v "grep" | sed -n '$p'`
if test -n "$mysql_tcp_port"
then
PROC=`ps xa | grep "$ledir/$MYSQLD\>" | grep -v "grep" | grep "port=$mysql_tcp_port" | sed -n '$p'`
else
PROC=`ps xa | grep "$ledir/$MYSQLD\>" | grep -v "grep" | sed -n '$p'`
fi
for T in $PROC
do
break
......
......@@ -716,3 +716,13 @@ my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, bool *in_dst_time_gap)
return (my_time_t) tmp;
} /* my_system_gmt_sec */
/* Set MYSQL_TIME structure to 0000-00-00 00:00:00.000000 */
void set_zero_time(MYSQL_TIME *tm)
{
bzero((void*) tm, sizeof(*tm));
tm->time_type= MYSQL_TIMESTAMP_NONE;
}
......@@ -908,7 +908,7 @@ public:
void reset(void) { charset()->cset->fill(charset(),ptr,field_length,' '); }
int store(const char *to,uint length,CHARSET_INFO *charset);
int store(longlong nr);
int store(double nr) { return Field_str::store(nr); }
int store(double nr) { return Field_str::store(nr); } /* QQ: To be deleted */
double val_real(void);
longlong val_int(void);
String *val_str(String*,String *);
......@@ -955,7 +955,7 @@ public:
uint32 key_length() const { return (uint32) field_length; }
int store(const char *to,uint length,CHARSET_INFO *charset);
int store(longlong nr);
int store(double nr) { return Field_str::store(nr); }
int store(double nr) { return Field_str::store(nr); } /* QQ: To be deleted */
double val_real(void);
longlong val_int(void);
String *val_str(String*,String *);
......
......@@ -362,7 +362,7 @@ static int get_options(int argc, char **argv)
{
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, 0)))
if ((ho_error= handle_options(&argc, &argv, my_long_options, get_one_option)))
exit(ho_error);
if (argc >= 1)
......
......@@ -299,8 +299,9 @@ convert_error_code_to_mysql(
} else if (error == (int) DB_CANNOT_DROP_CONSTRAINT) {
return(HA_ERR_ROW_IS_REFERENCED);
return(HA_ERR_CANNOT_ADD_FOREIGN); /* TODO: This is a bit
misleading, a new MySQL error
code should be introduced */
} else if (error == (int) DB_COL_APPEARS_TWICE_IN_INDEX) {
return(HA_ERR_CRASHED);
......
......@@ -265,8 +265,9 @@ CHARSET_INFO *Item::default_charset()
return current_thd->variables.collation_connection;
}
bool DTCollation::aggregate(DTCollation &dt)
bool DTCollation::aggregate(DTCollation &dt, bool superset_conversion)
{
nagg++;
if (!my_charset_same(collation, dt.collation))
{
/*
......@@ -280,15 +281,39 @@ bool DTCollation::aggregate(DTCollation &dt)
if (derivation <= dt.derivation)
; // Do nothing
else
set(dt);
{
set(dt);
strong= nagg;
}
}
else if (dt.collation == &my_charset_bin)
{
if (dt.derivation <= derivation)
{
set(dt);
strong= nagg;
}
else
; // Do nothing
}
else if (superset_conversion)
{
if (derivation < dt.derivation &&
collation->state & MY_CS_UNICODE)
; // Do nothing
else if (dt.derivation < derivation &&
dt.collation->state & MY_CS_UNICODE)
{
set(dt);
strong= nagg;
}
else
{
// Cannot convert to superset
set(0, DERIVATION_NONE);
return 1;
}
}
else
{
set(0, DERIVATION_NONE);
......@@ -302,6 +327,7 @@ bool DTCollation::aggregate(DTCollation &dt)
else if (dt.derivation < derivation)
{
set(dt);
strong= nagg;
}
else
{
......
......@@ -41,16 +41,22 @@ class DTCollation {
public:
CHARSET_INFO *collation;
enum Derivation derivation;
uint nagg; // Total number of aggregated collations.
uint strong; // Number of the strongest collation.
DTCollation()
{
collation= &my_charset_bin;
derivation= DERIVATION_NONE;
nagg= 0;
strong= 0;
}
DTCollation(CHARSET_INFO *collation_arg, Derivation derivation_arg)
{
collation= collation_arg;
derivation= derivation_arg;
nagg= 0;
strong= 0;
}
void set(DTCollation &dt)
{
......@@ -66,9 +72,9 @@ public:
{ collation= collation_arg; }
void set(Derivation derivation_arg)
{ derivation= derivation_arg; }
bool aggregate(DTCollation &dt);
bool set(DTCollation &dt1, DTCollation &dt2)
{ set(dt1); return aggregate(dt2); }
bool aggregate(DTCollation &dt, bool superset_conversion= FALSE);
bool set(DTCollation &dt1, DTCollation &dt2, bool superset_conversion= FALSE)
{ set(dt1); return aggregate(dt2, superset_conversion); }
const char *derivation_name() const
{
switch(derivation)
......@@ -239,6 +245,7 @@ public:
virtual void top_level_item() {}
virtual void set_result_field(Field *field) {}
virtual bool is_result_field() { return 0; }
virtual bool is_bool_func() { return 0; }
virtual void save_in_result_field(bool no_conversions) {}
virtual void no_rows_in_result() {}
virtual Item *copy_or_same(THD *thd) { return this; }
......@@ -268,8 +275,7 @@ public:
virtual void bring_value() {}
Field *tmp_table_field_from_field_type(TABLE *table);
/* Used in sql_select.cc:eliminate_not_funcs() */
virtual Item *neg_transformer(THD *thd) { return NULL; }
void delete_self()
{
......
......@@ -188,25 +188,17 @@ void Item_bool_func2::fix_length_and_dec()
{
uint strong= 0;
uint weak= 0;
DTCollation coll;
if ((args[0]->collation.derivation < args[1]->collation.derivation) &&
!my_charset_same(args[0]->collation.collation,
args[1]->collation.collation) &&
(args[0]->collation.collation->state & MY_CS_UNICODE))
{
weak= 1;
}
else if ((args[1]->collation.derivation < args[0]->collation.derivation) &&
!my_charset_same(args[0]->collation.collation,
args[1]->collation.collation) &&
(args[1]->collation.collation->state & MY_CS_UNICODE))
{
strong= 1;
}
if (strong || weak)
if (args[0]->result_type() == STRING_RESULT &&
args[1]->result_type() == STRING_RESULT &&
!my_charset_same(args[0]->collation.collation,
args[1]->collation.collation) &&
!coll.set(args[0]->collation, args[1]->collation, TRUE))
{
Item* conv= 0;
strong= coll.strong;
weak= strong ? 0 : 1;
if (args[weak]->type() == STRING_ITEM)
{
String tmp, cstr;
......@@ -219,9 +211,20 @@ void Item_bool_func2::fix_length_and_dec()
}
else
{
conv= new Item_func_conv_charset(args[weak],args[strong]->collation.collation);
THD *thd= current_thd;
/*
In case we're in statement prepare, create conversion item
in its memory: it will be reused on each execute.
*/
Item_arena *arena= thd->current_arena, backup;
if (arena->is_stmt_prepare())
thd->set_n_backup_item_arena(arena, &backup);
conv= new Item_func_conv_charset(args[weak],
args[strong]->collation.collation);
if (arena->is_stmt_prepare())
thd->restore_backup_item_arena(arena, &backup);
conv->collation.set(args[weak]->collation.derivation);
conv->fix_fields(current_thd, 0, &conv);
conv->fix_fields(thd, 0, &conv);
}
args[weak]= conv ? conv : args[weak];
}
......@@ -1743,12 +1746,58 @@ void Item_func_in::fix_length_and_dec()
uint const_itm= 1;
agg_cmp_type(&cmp_type, args, arg_count);
if ((cmp_type == STRING_RESULT) &&
(agg_arg_collations_for_comparison(cmp_collation, args, arg_count)))
return;
for (arg=args+1, arg_end=args+arg_count; arg != arg_end ; arg++)
const_itm&= arg[0]->const_item();
if (cmp_type == STRING_RESULT)
{
/*
We allow consts character set conversion for
item IN (const1, const2, const3, ...)
if item is in a superset for all arguments,
and if it is a stong side according to coercibility rules.
TODO: add covnersion for non-constant IN values
via creating Item_func_conv_charset().
*/
if (agg_arg_collations_for_comparison(cmp_collation,
args, arg_count, TRUE))
return;
if ((!my_charset_same(args[0]->collation.collation,
cmp_collation.collation) || !const_itm))
{
if (agg_arg_collations_for_comparison(cmp_collation,
args, arg_count, FALSE))
return;
}
else
{
/*
Conversion is possible:
All IN arguments are constants.
*/
for (arg= args+1, arg_end= args+arg_count; arg < arg_end; arg++)
{
if (!my_charset_same(cmp_collation.collation,
arg[0]->collation.collation))
{
Item_string *conv;
String tmp, cstr, *ostr= arg[0]->val_str(&tmp);
cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(),
cmp_collation.collation);
conv= new Item_string(cstr.ptr(),cstr.length(), cstr.charset(),
arg[0]->collation.derivation);
conv->str_value.copy();
arg[0]= conv;
}
}
}
}
/*
Row item with NULLs inside can return NULL or FALSE =>
......@@ -2030,15 +2079,6 @@ void Item_cond::neg_arguments(THD *thd)
{
if (!(new_item= new Item_func_not(item)))
return; // Fatal OEM error
/*
We can use 0 as tables list because Item_func_not do not use it
on fix_fields and its arguments are already fixed.
We do not check results of fix_fields, because there are not way
to return error in this functions interface, thd->net.report_error
will be checked on upper level call.
*/
new_item->fix_fields(thd, 0, &new_item);
}
VOID(li.replace(new_item));
}
......@@ -2716,9 +2756,6 @@ longlong Item_cond_xor::val_int()
IS NULL(a) -> IS NOT NULL(a)
IS NOT NULL(a) -> IS NULL(a)
NOTE
This method is used in the eliminate_not_funcs() function.
RETURN
New item or
NULL if we cannot apply NOT transformation (see Item::neg_transformer()).
......@@ -2726,26 +2763,13 @@ longlong Item_cond_xor::val_int()
Item *Item_func_not::neg_transformer(THD *thd) /* NOT(x) -> x */
{
// We should apply negation elimination to the argument of the NOT function
return eliminate_not_funcs(thd, args[0]);
return args[0];
}
Item *Item_bool_rowready_func2::neg_transformer(THD *thd)
{
Item *item= negated_item();
if (item)
{
/*
We can use 0 as tables list because Item_func* family do not use it
on fix_fields and its arguments are already fixed.
We do not check results of fix_fields, because there are not way
to return error in this functions interface, thd->net.report_error
will be checked on upper level call.
*/
item->fix_fields(thd, 0, &item);
}
return item;
}
......@@ -2754,9 +2778,6 @@ Item *Item_bool_rowready_func2::neg_transformer(THD *thd)
Item *Item_func_isnull::neg_transformer(THD *thd)
{
Item *item= new Item_func_isnotnull(args[0]);
// see comment before fix_fields in Item_bool_rowready_func2::neg_transformer
if (item)
item->fix_fields(thd, 0, &item);
return item;
}
......@@ -2765,9 +2786,6 @@ Item *Item_func_isnull::neg_transformer(THD *thd)
Item *Item_func_isnotnull::neg_transformer(THD *thd)
{
Item *item= new Item_func_isnull(args[0]);
// see comment before fix_fields in Item_bool_rowready_func2::neg_transformer
if (item)
item->fix_fields(thd, 0, &item);
return item;
}
......@@ -2777,9 +2795,6 @@ Item *Item_cond_and::neg_transformer(THD *thd) /* NOT(a AND b AND ...) -> */
{
neg_arguments(thd);
Item *item= new Item_cond_or(list);
// see comment before fix_fields in Item_bool_rowready_func2::neg_transformer
if (item)
item->fix_fields(thd, 0, &item);
return item;
}
......@@ -2789,9 +2804,6 @@ Item *Item_cond_or::neg_transformer(THD *thd) /* NOT(a OR b OR ...) -> */
{
neg_arguments(thd);
Item *item= new Item_cond_and(list);
// see comment before fix_fields in Item_bool_rowready_func2::neg_transformer
if (item)
item->fix_fields(thd, 0, &item);
return item;
}
......
......@@ -89,6 +89,7 @@ public:
Item_bool_func(Item *a) :Item_int_func(a) {}
Item_bool_func(Item *a,Item *b) :Item_int_func(a,b) {}
Item_bool_func(THD *thd, Item_bool_func *item) :Item_int_func(thd, item) {}
bool is_bool_func() { return 1; }
void fix_length_and_dec() { decimals=0; max_length=1; }
};
......@@ -201,6 +202,7 @@ public:
bool have_rev_func() const { return rev_functype() != UNKNOWN_FUNC; }
void print(String *str) { Item_func::print_op(str); }
bool is_null() { return test(args[0]->is_null() || args[1]->is_null()); }
bool is_bool_func() { return 1; }
CHARSET_INFO *compare_collation() { return cmp.cmp_collation.collation; }
friend class Arg_comparator;
......@@ -274,7 +276,7 @@ public:
enum Functype rev_functype() const { return EQUAL_FUNC; }
cond_result eq_cmp_result() const { return COND_TRUE; }
const char *func_name() const { return "<=>"; }
Item* neg_transformer(THD *thd) { return 0; }
Item *neg_transformer(THD *thd) { return 0; }
};
......@@ -748,6 +750,7 @@ class Item_func_in :public Item_int_func
enum Functype functype() const { return IN_FUNC; }
const char *func_name() const { return " IN "; }
bool nulls_in_row();
bool is_bool_func() { return 1; }
CHARSET_INFO *compare_collation() { return cmp_collation.collation; }
};
......
......@@ -75,13 +75,16 @@ static void my_coll_agg_error(Item** args, uint count, const char *fname)
}
bool Item_func::agg_arg_collations(DTCollation &c, Item **av, uint count)
bool Item_func::agg_arg_collations(DTCollation &c, Item **av, uint count,
bool allow_superset_conversion)
{
uint i;
c.nagg= 0;
c.strong= 0;
c.set(av[0]->collation);
for (i= 1; i < count; i++)
{
if (c.aggregate(av[i]->collation))
if (c.aggregate(av[i]->collation, allow_superset_conversion))
{
my_coll_agg_error(av, count, func_name());
return TRUE;
......@@ -92,9 +95,10 @@ bool Item_func::agg_arg_collations(DTCollation &c, Item **av, uint count)
bool Item_func::agg_arg_collations_for_comparison(DTCollation &c,
Item **av, uint count)
Item **av, uint count,
bool allow_superset_conv)
{
if (agg_arg_collations(c, av, count))
if (agg_arg_collations(c, av, count, allow_superset_conv))
return TRUE;
if (c.derivation == DERIVATION_NONE)
......
......@@ -140,8 +140,11 @@ public:
Field *tmp_table_field(TABLE *t_arg);
Item *get_tmp_table_item(THD *thd);
bool agg_arg_collations(DTCollation &c, Item **items, uint nitems);
bool agg_arg_collations_for_comparison(DTCollation &c, Item **items, uint nitems);
bool agg_arg_collations(DTCollation &c, Item **items, uint nitems,
bool allow_superset_conversion= FALSE);
bool agg_arg_collations_for_comparison(DTCollation &c,
Item **items, uint nitems,
bool allow_superset_comversion= FALSE);
bool walk(Item_processor processor, byte *arg);
};
......
......@@ -2157,7 +2157,7 @@ void Item_func_group_concat::print(String *str)
(*order[i]->item)->print(str);
}
}
str->append(" seperator \'", 12);
str->append(" separator \'", 12);
str->append(*separator);
str->append("\')", 2);
}
......@@ -779,7 +779,8 @@ void unlock_global_read_lock(THD *thd)
(is_not_commit || \
global_read_lock_blocks_commit))
bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh, bool is_not_commit)
bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh,
bool is_not_commit)
{
const char *old_message;
bool result= 0, need_exit_cond;
......
......@@ -43,37 +43,41 @@ static bool test_if_number(const char *str,
#ifdef __NT__
static int eventSource = 0;
void setupWindowsEventSource()
{
if (eventSource) return;
eventSource = 1;
HKEY hRegKey = NULL;
DWORD dwError = 0;
TCHAR szPath[ MAX_PATH ];
// Create the event source registry key
dwError = RegCreateKey(HKEY_LOCAL_MACHINE,
"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\MySQL",
&hRegKey);
void setup_windows_event_source()
{
HKEY hRegKey= NULL;
DWORD dwError= 0;
TCHAR szPath[MAX_PATH];
DWORD dwTypes;
if (eventSource) // Ensure that we are only called once
return;
eventSource= 1;
// Name of the PE module that contains the message resource
GetModuleFileName(NULL, szPath, MAX_PATH);
// Create the event source registry key
dwError= RegCreateKey(HKEY_LOCAL_MACHINE,
"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\MySQL",
&hRegKey);
// Register EventMessageFile
dwError = RegSetValueEx(hRegKey, "EventMessageFile", 0, REG_EXPAND_SZ,
(PBYTE) szPath, strlen(szPath)+1);
/* Name of the PE module that contains the message resource */
GetModuleFileName(NULL, szPath, MAX_PATH);
/* Register EventMessageFile */
dwError = RegSetValueEx(hRegKey, "EventMessageFile", 0, REG_EXPAND_SZ,
(PBYTE) szPath, strlen(szPath)+1);
// Register supported event types
DWORD dwTypes = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE;
dwError = RegSetValueEx(hRegKey, "TypesSupported", 0, REG_DWORD,
(LPBYTE) &dwTypes, sizeof dwTypes);
/* Register supported event types */
dwTypes= (EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE |
EVENTLOG_INFORMATION_TYPE);
dwError= RegSetValueEx(hRegKey, "TypesSupported", 0, REG_DWORD,
(LPBYTE) &dwTypes, sizeof dwTypes);
RegCloseKey(hRegKey);
RegCloseKey(hRegKey);
}
#endif
#endif /* __NT__ */
/****************************************************************************
......@@ -1413,12 +1417,24 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u",
/* Write log events to reset the 'run environment' of the SQL command */
if (thd && thd->options & OPTION_NO_FOREIGN_KEY_CHECKS)
if (thd)
{
Query_log_event e(thd, "SET FOREIGN_KEY_CHECKS=1", 24, 0);
e.set_log_pos(this);
if (e.write(file))
goto err;
if (thd->options & OPTION_NO_FOREIGN_KEY_CHECKS)
{
Query_log_event e(thd, "SET FOREIGN_KEY_CHECKS=1", 24, 0);
e.set_log_pos(this);
if (e.write(file))
goto err;
}
#if MYSQL_VERSION_ID < 40100
if (thd->variables.convert_set)
{
Query_log_event e(thd, "SET CHARACTER SET DEFAULT", 25, 0);
e.set_log_pos(this);
if (e.write(file))
goto err;
}
#endif
}
/*
......@@ -1984,8 +2000,8 @@ void print_buffer_to_file(enum loglevel level, const char *buffer)
time_t skr;
struct tm tm_tmp;
struct tm *start;
DBUG_ENTER("print_buffer_to_log");
DBUG_ENTER("print_buffer_to_file");
DBUG_PRINT("enter",("buffer: %s", buffer));
VOID(pthread_mutex_lock(&LOCK_error_log));
......@@ -1999,13 +2015,13 @@ void print_buffer_to_file(enum loglevel level, const char *buffer)
start->tm_hour,
start->tm_min,
start->tm_sec,
level == ERROR_LEVEL ? "ERROR" : level == WARNING_LEVEL ? "WARNING" : "INFORMATION",
buffer);
(level == ERROR_LEVEL ? "ERROR" : level == WARNING_LEVEL ?
"WARNING" : "INFORMATION"),
buffer);
fflush(stderr);
VOID(pthread_mutex_unlock(&LOCK_error_log));
DBUG_VOID_RETURN;
}
......@@ -2019,6 +2035,7 @@ void sql_perror(const char *message)
#endif
}
bool flush_error_log()
{
bool result=0;
......@@ -2204,93 +2221,95 @@ void MYSQL_LOG::report_pos_in_innodb()
}
#ifdef __NT__
void print_buffer_to_nt_eventlog(enum loglevel level, char *buff, int buffLen)
void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,
uint length, int buffLen)
{
HANDLE event;
char *buffptr;
LPCSTR *buffmsgptr;
DBUG_ENTER("print_buffer_to_nt_eventlog");
buffptr = buff;
if (strlen(buff) > (uint)(buffLen-4))
buffptr= buff;
if (length > (uint)(buffLen-4))
{
char *newBuff = new char[ strlen(buff) + 4 ];
char *newBuff= new char[length + 4];
strcpy(newBuff, buff);
buffptr = newBuff;
buffptr= newBuff;
}
strcat(buffptr, "\r\n\r\n");
buffmsgptr = (LPCSTR*)&buffptr;
strmov(buffptr+length, "\r\n\r\n");
buffmsgptr= (LPCSTR*) &buffptr; // Keep windows happy
setupWindowsEventSource();
if (event = RegisterEventSource(NULL,"MySQL"))
setup_windows_event_source();
if ((event= RegisterEventSource(NULL,"MySQL")))
{
switch (level){
switch (level) {
case ERROR_LEVEL:
ReportEvent(event, EVENTLOG_ERROR_TYPE, 0, MSG_DEFAULT, NULL, 1, 0, buffmsgptr, NULL);
ReportEvent(event, EVENTLOG_ERROR_TYPE, 0, MSG_DEFAULT, NULL, 1, 0,
buffmsgptr, NULL);
break;
case WARNING_LEVEL:
ReportEvent(event, EVENTLOG_WARNING_TYPE, 0, MSG_DEFAULT, NULL, 1, 0, buffmsgptr, NULL);
ReportEvent(event, EVENTLOG_WARNING_TYPE, 0, MSG_DEFAULT, NULL, 1, 0,
buffmsgptr, NULL);
break;
case INFORMATION_LEVEL:
ReportEvent(event, EVENTLOG_INFORMATION_TYPE, 0, MSG_DEFAULT, NULL, 1, 0, buffmsgptr, NULL);
ReportEvent(event, EVENTLOG_INFORMATION_TYPE, 0, MSG_DEFAULT, NULL, 1,
0, buffmsgptr, NULL);
break;
}
DeregisterEventSource(event);
}
// if we created a string buffer, then delete it
/* if we created a string buffer, then delete it */
if (buffptr != buff)
delete[] buffptr;
DBUG_VOID_RETURN;
}
#endif
#endif /* __NT__ */
/*
Prints a printf style message to the error log and, under NT, to the Windows event log.
Prints a printf style message to the error log and, under NT, to the
Windows event log.
SYNOPSIS
vprint_msg_to_log()
event_type Type of event to write (Error, Warning, or Info)
format Printf style format of message
args va_list list of arguments for the message
event_type Type of event to write (Error, Warning, or Info)
format Printf style format of message
args va_list list of arguments for the message
NOTE
IMPLEMENTATION
This function prints the message into a buffer and then sends that buffer to other
functions to write that message to other logging sources.
This function prints the message into a buffer and then sends that buffer
to other functions to write that message to other logging sources.
RETURN VALUES
void
*/
void vprint_msg_to_log(enum loglevel level, const char *format, va_list args)
{
char buff[1024];
uint length;
DBUG_ENTER("vprint_msg_to_log");
my_vsnprintf(buff, sizeof(buff)-5, format, args);
length= my_vsnprintf(buff, sizeof(buff)-5, format, args);
print_buffer_to_file(level, buff);
#ifndef DBUG_OFF
DBUG_PRINT("error",("%s",buff));
#endif
#ifdef __NT__
print_buffer_to_nt_eventlog(level, buff, sizeof(buff));
print_buffer_to_nt_eventlog(level, buff, length, sizeof(buff));
#endif
DBUG_VOID_RETURN;
}
void sql_print_error(const char *format, ...)
void sql_print_error(const char *format, ...)
{
va_list args;
DBUG_ENTER("sql_print_error");
va_list args;
va_start(args, format);
vprint_msg_to_log(ERROR_LEVEL, format, args);
va_end(args);
......@@ -2298,11 +2317,12 @@ void sql_print_error(const char *format, ...)
DBUG_VOID_RETURN;
}
void sql_print_warning(const char *format, ...)
void sql_print_warning(const char *format, ...)
{
va_list args;
DBUG_ENTER("sql_print_warning");
va_list args;
va_start(args, format);
vprint_msg_to_log(WARNING_LEVEL, format, args);
va_end(args);
......@@ -2310,11 +2330,12 @@ void sql_print_warning(const char *format, ...)
DBUG_VOID_RETURN;
}
void sql_print_information(const char *format, ...)
void sql_print_information(const char *format, ...)
{
va_list args;
DBUG_ENTER("sql_print_information");
va_list args;
va_start(args, format);
vprint_msg_to_log(INFORMATION_LEVEL, format, args);
va_end(args);
......
......@@ -1084,10 +1084,6 @@ end:
thd->query= 0; // just to be sure
thd->query_length= 0;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
// assume no convert for next query unless set explictly
#ifdef TO_BE_REMOVED
thd->variables.convert_set = 0;
#endif
close_thread_tables(thd);
free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC));
return (thd->query_error ? thd->query_error : Log_event::exec_event(rli));
......
......@@ -297,7 +297,8 @@ enum enum_parsing_place
{
NO_MATTER,
IN_HAVING,
SELECT_LIST
SELECT_LIST,
IN_WHERE
};
struct st_table;
......@@ -376,6 +377,7 @@ int delete_precheck(THD *thd, TABLE_LIST *tables);
int insert_precheck(THD *thd, TABLE_LIST *tables, bool update);
int create_table_precheck(THD *thd, TABLE_LIST *tables,
TABLE_LIST *create_table);
Item *negate_expression(THD *thd, Item *expr);
#include "sql_class.h"
#include "opt_range.h"
......
......@@ -2940,6 +2940,13 @@ we force server id to 2, but this MySQL server will not act as a slave.");
#if defined(__NT__) || defined(HAVE_SMEM)
handle_connections_methods();
#else
#ifdef __WIN__
if ( !have_tcpip || opt_disable_networking)
{
sql_print_error("TCP/IP unavailable or disabled with --skip-networking; no available interfaces");
unireg_abort(1);
}
#endif
handle_connections_sockets(0);
#endif /* __NT__ */
......@@ -6108,14 +6115,16 @@ mysql_getopt_value(const char *keyname, uint key_length,
return option->value;
}
void option_error_reporter( enum loglevel level, const char *format, ... )
void option_error_reporter(enum loglevel level, const char *format, ...)
{
va_list args;
va_start( args, format );
vprint_msg_to_log( level, format, args );
va_end( args );
va_start(args, format);
vprint_msg_to_log(level, format, args);
va_end(args);
}
static void get_options(int argc,char **argv)
{
int ho_error;
......@@ -6123,7 +6132,9 @@ static void get_options(int argc,char **argv)
my_getopt_register_get_addr(mysql_getopt_value);
strmake(def_ft_boolean_syntax, ft_boolean_syntax,
sizeof(ft_boolean_syntax)-1);
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, option_error_reporter)))
my_getopt_error_reporter= option_error_reporter;
if ((ho_error= handle_options(&argc, &argv, my_long_options,
get_one_option)))
exit(ho_error);
if (argc > 0)
{
......
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
Modifikoval Petr -Bnajdr, snajdr@pvt.net, snajdr@cpress.cz v.0.01
ISO LATIN-8852-2
......
/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB
This file is public domain and comes with NO WARRANTY of any kind */
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Knud Riishøjgård knudriis@post.tele.dk 99 &&
Carsten H. Pedersen, carsten.pedersen@bitbybit.dk oct. 1999 / aug. 2001. */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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