diff options
-rw-r--r-- | cmd-line-utils/libedit/Makefile.am | 2 | ||||
-rw-r--r-- | cmd-line-utils/libedit/el.c | 4 | ||||
-rw-r--r-- | cmd-line-utils/libedit/el.h | 2 | ||||
-rw-r--r-- | cmd-line-utils/libedit/key.c | 34 | ||||
-rw-r--r-- | cmd-line-utils/libedit/key.h | 25 | ||||
-rw-r--r-- | cmd-line-utils/libedit/map.c | 37 | ||||
-rw-r--r-- | cmd-line-utils/libedit/read.c | 9 | ||||
-rw-r--r-- | cmd-line-utils/libedit/term.c | 68 | ||||
-rw-r--r-- | cmd-line-utils/libedit/term.h | 124 | ||||
-rw-r--r-- | cmd-line-utils/libedit/tty.c | 8 | ||||
-rw-r--r-- | configure.in | 11 | ||||
-rw-r--r-- | myisam/mi_check.c | 32 | ||||
-rw-r--r-- | mysql-test/r/fulltext2.result | 9 | ||||
-rw-r--r-- | mysql-test/r/ps.result | 11 | ||||
-rw-r--r-- | mysql-test/t/fulltext2.test | 8 | ||||
-rw-r--r-- | mysql-test/t/ps.test | 17 | ||||
-rw-r--r-- | scripts/mysql_create_system_tables.sh | 35 | ||||
-rw-r--r-- | sql/item_cmpfunc.cc | 15 |
18 files changed, 195 insertions, 256 deletions
diff --git a/cmd-line-utils/libedit/Makefile.am b/cmd-line-utils/libedit/Makefile.am index c6f9ccf06ff..a3d73a7082a 100644 --- a/cmd-line-utils/libedit/Makefile.am +++ b/cmd-line-utils/libedit/Makefile.am @@ -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 diff --git a/cmd-line-utils/libedit/el.c b/cmd-line-utils/libedit/el.c index aa4b5c6896b..1b445d40f1c 100644 --- a/cmd-line-utils/libedit/el.c +++ b/cmd-line-utils/libedit/el.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); diff --git a/cmd-line-utils/libedit/el.h b/cmd-line-utils/libedit/el.h index 9e1731c5857..49bd462ad3b 100644 --- a/cmd-line-utils/libedit/el.h +++ b/cmd-line-utils/libedit/el.h @@ -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" diff --git a/cmd-line-utils/libedit/key.c b/cmd-line-utils/libedit/key.c index e1e64e328ad..e75db00ce1b 100644 --- a/cmd-line-utils/libedit/key.c +++ b/cmd-line-utils/libedit/key.c @@ -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; diff --git a/cmd-line-utils/libedit/key.h b/cmd-line-utils/libedit/key.h index 80d8626b894..9d83d7c2521 100644 --- a/cmd-line-utils/libedit/key.h +++ b/cmd-line-utils/libedit/key.h @@ -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 */ diff --git a/cmd-line-utils/libedit/map.c b/cmd-line-utils/libedit/map.c index e044e875382..a16625311ae 100644 --- a/cmd-line-utils/libedit/map.c +++ b/cmd-line-utils/libedit/map.c @@ -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; } } diff --git a/cmd-line-utils/libedit/read.c b/cmd-line-utils/libedit/read.c index 7567a81e875..5eaa83bf482 100644 --- a/cmd-line-utils/libedit/read.c +++ b/cmd-line-utils/libedit/read.c @@ -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); diff --git a/cmd-line-utils/libedit/term.c b/cmd-line-utils/libedit/term.c index f5fb93394d8..1f90c783a2b 100644 --- a/cmd-line-utils/libedit/term.c +++ b/cmd-line-utils/libedit/term.c @@ -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); } diff --git a/cmd-line-utils/libedit/term.h b/cmd-line-utils/libedit/term.h deleted file mode 100644 index 47e08e84bf4..00000000000 --- a/cmd-line-utils/libedit/term.h +++ /dev/null @@ -1,124 +0,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 */ diff --git a/cmd-line-utils/libedit/tty.c b/cmd-line-utils/libedit/tty.c index 5253fdf87a7..fe81762fb82 100644 --- a/cmd-line-utils/libedit/tty.c +++ b/cmd-line-utils/libedit/tty.c @@ -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]; } } diff --git a/configure.in b/configure.in index 616e430ac78..788848ba4c2 100644 --- a/configure.in +++ b/configure.in @@ -1875,13 +1875,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"]) @@ -2452,10 +2445,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]) + 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]) + 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" diff --git a/myisam/mi_check.c b/myisam/mi_check.c index a1c3698b3e9..1f6089d0a3c 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -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; + } + } } } diff --git a/mysql-test/r/fulltext2.result b/mysql-test/r/fulltext2.result index 0fdb7d4dbd1..0b1d8eb9a15 100644 --- a/mysql-test/r/fulltext2.result +++ b/mysql-test/r/fulltext2.result @@ -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 diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index e161904cd6f..321b8894796 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -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; diff --git a/mysql-test/t/fulltext2.test b/mysql-test/t/fulltext2.test index cab1d096fe7..1d3a5307412 100644 --- a/mysql-test/t/fulltext2.test +++ b/mysql-test/t/fulltext2.test @@ -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; diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index e54bf8076e0..cbc76e02b42 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -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; + diff --git a/scripts/mysql_create_system_tables.sh b/scripts/mysql_create_system_tables.sh index e95d65a1224..f524b322388 100644 --- a/scripts/mysql_create_system_tables.sh +++ b/scripts/mysql_create_system_tables.sh @@ -68,7 +68,7 @@ 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';" @@ -98,7 +98,7 @@ 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 @@ -142,7 +142,7 @@ 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';" @@ -182,7 +182,7 @@ 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 @@ -204,7 +204,7 @@ 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 @@ -224,7 +224,7 @@ 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 @@ -244,7 +244,7 @@ then 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 @@ -264,7 +264,7 @@ then 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 @@ -280,7 +280,7 @@ then 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 @@ -295,7 +295,7 @@ 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 @@ -310,8 +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 )" - c_tzn="$c_tzn CHARACTER SET utf8" + c_tzn="$c_tzn ) engine=MyISAM CHARACTER SET utf8" c_tzn="$c_tzn comment='Time zone names';" if test "$1" = "test" @@ -333,8 +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 )" - c_tz="$c_tz CHARACTER SET utf8" + c_tz="$c_tz ) engine=MyISAM CHARACTER SET utf8" c_tz="$c_tz comment='Time zones';" if test "$1" = "test" @@ -355,8 +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 )" - c_tzt="$c_tzt CHARACTER SET utf8" + c_tzt="$c_tzt ) engine=MyISAM CHARACTER SET utf8" c_tzt="$c_tzt comment='Time zone transitions';" if test "$1" = "test" @@ -578,8 +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 )" - c_tztt="$c_tztt CHARACTER SET utf8" + c_tztt="$c_tztt ) engine=MyISAM CHARACTER SET utf8" c_tztt="$c_tztt comment='Time zone transition types';" if test "$1" = "test" @@ -615,8 +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 )" - c_tzts="$c_tzts CHARACTER SET utf8" + c_tzls="$c_tzls ) engine=MyISAM CHARACTER SET utf8" c_tzls="$c_tzls comment='Leap seconds information for time zones';" if test "$1" = "test" diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index f473d242b07..85b22d1eddd 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -211,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]; } |