Below is the list of changes that have just been committed into a local
4.1 repository of vva. When vva does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://www.mysql.com/doc/I/n/Installing_source_tree.html
ChangeSet
1.1343 02/10/07 19:37:52 vva@genie.(none) +5 -0
Merge
client/mysql.cc
1.99 02/10/07 19:37:31 vva@genie.(none) +1 -2
restore new help prompt.
client/mysql.cc
1.98 02/10/07 19:35:23 vva@genie.(none) +5 -7
restore new hep ptompt
sql/sql_parse.cc
1.247 02/10/07 19:25:50 vva@genie.(none) +0 -0
Auto merged
scripts/mysql_install_db.sh
1.36 02/10/07 19:25:49 vva@genie.(none) +0 -0
Auto merged
scripts/Makefile.am
1.22 02/10/07 19:25:49 vva@genie.(none) +0 -0
Auto merged
BitKeeper/etc/logging_ok
1.222 02/10/07 19:25:14 vva@genie.(none) +0 -0
auto-union
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: vva
# Host: genie.(none)
# Root: /home/vva/work/mysql-4.1.help/mysql-4.1.help1/RESYNC
--- 1.97/client/mysql.cc Fri Jul 19 07:04:58 2002
+++ 1.99/client/mysql.cc Mon Oct 7 19:37:31 2002
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2002 MySQL AB
+* Copyright (C) 2000-2002 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
@@ -40,7 +40,7 @@
#include <signal.h>
#include <violite.h>
-const char *VER= "12.10";
+const char *VER= "13.0";
/* Don't try to make a nice table if the data is too big */
#define MAX_COLUMN_LENGTH 1024
@@ -112,6 +112,7 @@
static HashTable ht;
+static char **defaults_argv;
enum enum_info_type { INFO_INFO,INFO_ERROR,INFO_RESULT};
typedef enum enum_info_type INFO_TYPE;
@@ -186,7 +187,7 @@
static void xmlencode_print(const char *src, uint length);
static void init_pager();
static void end_pager();
-static void init_tee();
+static int init_tee(char *);
static void end_tee();
static const char* construct_prompt();
static void init_username();
@@ -317,15 +318,19 @@
status.add_to_history=1;
status.exit_status=1;
load_defaults("my",load_default_groups,&argc,&argv);
+ defaults_argv=argv;
if (get_options(argc, (char **) argv))
{
+ free_defaults(defaults_argv);
my_end(0);
exit(1);
}
- free_defaults(argv);
if (status.batch && !status.line_buff &&
!(status.line_buff=batch_readline_init(max_allowed_packet+512,stdin)))
+ {
+ free_defaults(defaults_argv);
exit(1);
+ }
glob_buffer.realloc(512);
mysql_server_init(0, NULL, (char**) server_default_groups);
completion_hash_init(&ht, 128);
@@ -344,7 +349,7 @@
signal(SIGQUIT, mysql_end); // Catch SIGQUIT to clean up
/*
- ** Run in interactive mode like the ingres/postgres monitor
+ Run in interactive mode like the ingres/postgres monitor
*/
put_info("Welcome to the MySQL monitor. Commands end with ; or \\g.",
@@ -358,7 +363,7 @@
initialize_readline(my_progname);
if (!status.batch && !quick && !opt_html && !opt_xml)
{
- /*read-history from file, default ~/.mysql_history*/
+ /* read-history from file, default ~/.mysql_history*/
if (getenv("MYSQL_HISTFILE"))
histfile=my_strdup(getenv("MYSQL_HISTFILE"),MYF(MY_WME));
else if (getenv("HOME"))
@@ -393,13 +398,6 @@
sig_handler mysql_end(int sig)
{
mysql_close(&mysql);
-#ifdef HAVE_OPENSSL
- my_free(opt_ssl_key,MYF(MY_ALLOW_ZERO_PTR));
- my_free(opt_ssl_cert,MYF(MY_ALLOW_ZERO_PTR));
- my_free(opt_ssl_ca,MYF(MY_ALLOW_ZERO_PTR));
- my_free(opt_ssl_capath,MYF(MY_ALLOW_ZERO_PTR));
- my_free(opt_ssl_cipher,MYF(MY_ALLOW_ZERO_PTR));
-#endif
#ifdef HAVE_READLINE
if (!status.batch && !quick && !opt_html && !opt_xml)
{
@@ -429,6 +427,7 @@
my_free(default_prompt,MYF(MY_ALLOW_ZERO_PTR));
my_free(current_prompt,MYF(MY_ALLOW_ZERO_PTR));
mysql_server_end();
+ free_defaults(defaults_argv);
my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
exit(status.exit_status);
}
@@ -440,7 +439,7 @@
0, 0, 0, 0, 0},
{"auto-rehash", OPT_AUTO_REHASH,
"Enable automatic rehashing. One doesn't need to use 'rehash' to get table and field completion, but startup and reconnecting may take a longer time. Disable with --disable-auto-rehash.",
- (gptr*) &rehash, (gptr*) &rehash, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ (gptr*) &rehash, (gptr*) &rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"no-auto-rehash", 'A',
"No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect. WARNING: options deprecated; use --disable-auto-rehash instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -476,10 +475,11 @@
"Enable named commands. Named commands mean this program's internal commands; see mysql> help . When enabled, the named commands can be used from any line of the query, otherwise only from the first line, before an enter. Disable with --disable-named-commands. This option is disabled by default.",
(gptr*) &named_cmds, (gptr*) &named_cmds, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
- {"ignore-space", 'i', "Ignore space after function names.", 0, 0, 0,
+ {"ignore-spaces", 'i', "Ignore space after function names.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.",
- 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ (gptr*) &opt_local_infile,
+ (gptr*) &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"no-beep", 'b', "Turn off beep on error.", (gptr*) &opt_nobeep,
(gptr*) &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", (gptr*) ¤t_host,
@@ -490,7 +490,7 @@
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"line-numbers", OPT_LINE_NUMBERS, "Write line numbers for errors.",
(gptr*) &line_numbers, (gptr*) &line_numbers, 0, GET_BOOL,
- NO_ARG, 0, 0, 0, 0, 0, 0},
+ NO_ARG, 1, 0, 0, 0, 0, 0},
{"skip-line-numbers", 'L', "Don't write line number for errors. WARNING: -L is deprecated, use long version of this option instead.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef __WIN__
@@ -592,7 +592,7 @@
if (version)
return;
printf("\
-Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB\n\
+Copyright (C) 2002 MySQL AB\n\
This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\
and you are welcome to modify and redistribute it under the GPL license\n");
printf("Usage: %s [OPTIONS] [database]\n", my_progname);
@@ -612,7 +612,6 @@
break;
case OPT_LOCAL_INFILE:
using_opt_local_infile=1;
- opt_local_infile= test(!argument || atoi(argument)>0);
break;
case OPT_TEE:
if (argument == disabled_my_option)
@@ -621,11 +620,7 @@
end_tee();
}
else
- if (!opt_outfile)
- {
- strmov(outfile, argument);
- init_tee();
- }
+ opt_outfile= init_tee(argument);
break;
case OPT_NOTEE:
printf("WARNING: option deprecated; use --disable-tee instead.\n");
@@ -708,6 +703,7 @@
opt_mysql_unix_port= my_strdup(MYSQL_NAMEDPIPE, MYF(0));
#endif
break;
+#include <sslopt-case.h>
case 'V':
usage(1);
exit(0);
@@ -715,7 +711,6 @@
case '?':
usage(0);
exit(0);
-#include "sslopt-case.h"
}
return 0;
}
@@ -749,6 +744,7 @@
strmov(pager, "stdout");
opt_nopager= 1;
opt_outfile= 0;
+ connect_flag= 0; /* Not in interactive mode */
}
if (default_charset)
{
@@ -829,8 +825,10 @@
line[0] == 0))
continue; // Skip comment lines
- /* Check if line is a mysql command line */
- /* (We want to allow help, print and clear anywhere at line start */
+ /*
+ Check if line is a mysql command line
+ (We want to allow help, print and clear anywhere at line start
+ */
if (execute_commands && (named_cmds || glob_buffer.is_empty())
&& !in_string && (com=find_command(line,0)))
{
@@ -1015,20 +1013,20 @@
return 0;
}
-/* **************************************************************** */
-/* */
-/* Interface to Readline Completion */
-/* */
-/* **************************************************************** */
+/*****************************************************************
+ Interface to Readline Completion
+******************************************************************/
#ifdef HAVE_READLINE
static char *new_command_generator(char *text, int);
static char **new_mysql_completion (char *text, int start, int end);
-/* Tell the GNU Readline library how to complete. We want to try to complete
- on command names if this is the first word in the line, or on filenames
- if not. */
+/*
+ Tell the GNU Readline library how to complete. We want to try to complete
+ on command names if this is the first word in the line, or on filenames
+ if not.
+*/
char **no_completion (char *text __attribute__ ((unused)),
char *word __attribute__ ((unused)))
@@ -1047,11 +1045,12 @@
rl_completion_entry_function=(Function *) no_completion;
}
-/* Attempt to complete on the contents of TEXT. START and END show the
- region of TEXT that contains the word to complete. We can use the
- entire line in case we want to do some simple parsing. Return the
- array of matches, or NULL if there aren't any. */
-
+/*
+ Attempt to complete on the contents of TEXT. START and END show the
+ region of TEXT that contains the word to complete. We can use the
+ entire line in case we want to do some simple parsing. Return the
+ array of matches, or NULL if there aren't any.
+*/
static char **new_mysql_completion (char *text,
int start __attribute__((unused)),
@@ -1071,67 +1070,72 @@
static entry *e;
static uint i;
- if (!state) {
+ if (!state)
textlen=(uint) strlen(text);
- }
- if (textlen>0) { /* lookup in the hash */
- if (!state) {
+ if (textlen>0)
+ { /* lookup in the hash */
+ if (!state)
+ {
uint len;
b = find_all_matches(&ht,text,(uint) strlen(text),&len);
- if (!b) {
+ if (!b)
return NullS;
- }
e = b->pData;
}
- while (e) {
+ if (e)
+ {
ptr= strdup(e->str);
e = e->pNext;
return ptr;
}
- } else { /* traverse the entire hash, ugly but works */
+ }
+ else
+ { /* traverse the entire hash, ugly but works */
- if (!state) {
- i=0;
+ if (!state)
+ {
/* find the first used bucket */
- while (i<ht.nTableSize) {
- if (ht.arBuckets[i]) {
+ for (i=0 ; i < ht.nTableSize ; i++)
+ {
+ if (ht.arBuckets[i])
+ {
b = ht.arBuckets[i];
e = b->pData;
break;
}
- i++;
}
}
ptr= NullS;
- while (e && !ptr) { /* find valid entry in bucket */
- if ((uint) strlen(e->str)==b->nKeyLength) {
+ while (e && !ptr)
+ { /* find valid entry in bucket */
+ if ((uint) strlen(e->str) == b->nKeyLength)
ptr = strdup(e->str);
- }
/* find the next used entry */
e = e->pNext;
- if (!e) { /* find the next used bucket */
+ if (!e)
+ { /* find the next used bucket */
b = b->pNext;
- if (!b) {
- i++;
- while (i<ht.nTableSize) {
- if (ht.arBuckets[i]) {
+ if (!b)
+ {
+ for (i++ ; i<ht.nTableSize; i++)
+ {
+ if (ht.arBuckets[i])
+ {
b = ht.arBuckets[i];
e = b->pData;
break;
}
- i++;
}
- } else {
- e = b->pData;
}
+ else
+ e = b->pData;
}
}
- if (ptr) {
+ if (ptr)
return ptr;
- }
}
return NullS;
}
@@ -1266,16 +1270,13 @@
DBUG_VOID_RETURN;
}
-
/* for gnu readline */
#ifndef HAVE_INDEX
-#ifdef __cplusplus
extern "C" {
-#endif
-extern char *index(const char *,pchar c),*rindex(const char *,pchar);
+extern char *index(const char *,int c),*rindex(const char *,int);
-char *index(const char *s,pchar c)
+char *index(const char *s,int c)
{
for (;;)
{
@@ -1284,7 +1285,7 @@
}
}
-char *rindex(const char *s,pchar c)
+char *rindex(const char *s,int c)
{
reg3 char *t;
@@ -1292,19 +1293,19 @@
do if (*s == (char) c) t = (char*) s; while (*s++);
return (char*) t;
}
-#ifdef __cplusplus
}
#endif
-#endif
#endif /* HAVE_READLINE */
+
static int reconnect(void)
{
if (!status.batch)
{
put_info("No connection. Trying to reconnect...",INFO_INFO);
(void) com_connect((String *) 0, 0);
- if(rehash) com_rehash(NULL, NULL);
+ if (rehash)
+ com_rehash(NULL, NULL);
}
if (!connected)
return put_info("Can't connect to the server\n",INFO_ERROR);
@@ -1435,7 +1436,10 @@
}
else
{
- put_info("\nMySQL commands:",INFO_INFO);
+ put_info("\nFor the complete MySQL Manual online visit:\n http://www.mysql.com/documentation\n", INFO_INFO);
+ put_info("For info on technical support from MySQL developers visit:\n http://www.mysql.com/support\n", INFO_INFO);
+ put_info("For info on MySQL books, utilities, consultants, etc. visit:\n http://www.mysql.com/portal\n", INFO_INFO);
+ put_info("List of all MySQL commands:", INFO_INFO);
if (!named_cmds)
put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO);
for (i = 0; commands[i].name; i++)
@@ -1465,19 +1469,19 @@
/*
-** Execute command
-** Returns: 0 if ok
-** -1 if not fatal error
-** 1 if fatal error
+ Execute command
+ Returns: 0 if ok
+ -1 if not fatal error
+ 1 if fatal error
*/
static int
com_go(String *buffer,char *line __attribute__((unused)))
{
- char buff[160],time_buff[32];
+ char buff[200], time_buff[32], *pos;
MYSQL_RES *result;
- ulong timer;
+ ulong timer, warnings;
uint error=0;
if (!status.batch)
@@ -1486,7 +1490,7 @@
old_buffer.copy();
}
- /* Remove garbage for nicer messages */
+ /* Remove garbage for nicer messages */
LINT_INIT(buff[0]);
remove_cntrl(*buffer);
@@ -1507,7 +1511,7 @@
if (skip_updates &&
(buffer->length() < 4 || my_sortcmp(system_charset_info,buffer->ptr(),
- "SET ",4)))
+ "SET ",4)))
{
(void) put_info("Ignoring query to other database",INFO_INFO);
return 0;
@@ -1560,7 +1564,7 @@
{
if (!mysql_num_rows(result) && ! quick)
{
- sprintf(buff,"Empty set%s",time_buff);
+ strmov(buff, "Empty set");
}
else
{
@@ -1575,20 +1579,30 @@
print_tab_data(result);
else
print_table_data(result);
- sprintf(buff,"%ld %s in set%s",
+ sprintf(buff,"%ld %s in set",
(long) mysql_num_rows(result),
- (long) mysql_num_rows(result) == 1 ? "row" : "rows",
- time_buff);
+ (long) mysql_num_rows(result) == 1 ? "row" : "rows");
end_pager();
}
}
else if (mysql_affected_rows(&mysql) == ~(ulonglong) 0)
- sprintf(buff,"Query OK%s",time_buff);
+ strmov(buff,"Query OK");
else
- sprintf(buff,"Query OK, %ld %s affected%s",
+ sprintf(buff,"Query OK, %ld %s affected",
(long) mysql_affected_rows(&mysql),
- (long) mysql_affected_rows(&mysql) == 1 ? "row" : "rows",
- time_buff);
+ (long) mysql_affected_rows(&mysql) == 1 ? "row" : "rows");
+
+ pos=strend(buff);
+ if ((warnings= mysql_warning_count(&mysql)))
+ {
+ *pos++= ',';
+ *pos++= ' ';
+ pos=int2str(warnings, pos, 10);
+ pos=strmov(pos, " warning");
+ if (warnings != 1)
+ *pos++= 's';
+ }
+ strmov(pos, time_buff);
put_info(buff,INFO_RESULT);
if (mysql_info(&mysql))
put_info(mysql_info(&mysql),INFO_RESULT);
@@ -1605,7 +1619,7 @@
static void init_pager()
{
-#if !defined( __WIN__) && !defined( OS2)
+#if !defined( __WIN__) && !defined( OS2) && (!defined(HAVE_mit_thread) || !defined(THREAD))
if (!opt_nopager)
{
if (!(PAGER= popen(pager, "w")))
@@ -1621,26 +1635,27 @@
static void end_pager()
{
-#if !defined( __WIN__) && !defined( OS2)
+#if !defined( __WIN__) && !defined( OS2) && !(defined(HAVE_mit_thread) && defined(THREAD))
if (!opt_nopager)
pclose(PAGER);
#endif
}
-static void init_tee()
+
+static int init_tee(char* newfile)
{
+ FILE* new_outfile;
+ if (!(new_outfile= my_fopen(newfile, O_APPEND | O_WRONLY, MYF(MY_WME))))
+ return 0;
if (opt_outfile)
end_tee();
- if (!(OUTFILE= my_fopen(outfile, O_APPEND | O_WRONLY, MYF(MY_WME))))
- {
- opt_outfile= 0;
- init_pager();
- return;
- }
- opt_outfile= 1;
+ OUTFILE = new_outfile;
+ strmake(outfile,newfile,FN_REFLEN-1);
tee_fprintf(stdout, "Logging to file '%s'\n", outfile);
+ return 1;
}
+
static void end_tee()
{
my_fclose(OUTFILE, MYF(0));
@@ -1885,7 +1900,8 @@
#ifdef USE_MB
int l;
if (use_mb(system_charset_info) &&
- (l = my_ismbchar(system_charset_info, pos, end))) {
+ (l = my_ismbchar(system_charset_info, pos, end)))
+ {
while (l--)
tee_putc(*pos++, PAGER);
pos--;
@@ -1952,30 +1968,40 @@
if (!strlen(outfile))
{
printf("No previous outfile available, you must give a filename!\n");
- opt_outfile= 0;
return 0;
}
+ else if (opt_outfile)
+ {
+ tee_fprintf(stdout, "Currently logging to file '%s'\n", outfile);
+ return 0;
+ }
+ else
+ param = outfile; //resume using the old outfile
}
- else
- {
- while (my_isspace(system_charset_info,*param))
- param++;
- end= strmake(file_name, param, sizeof(file_name) - 1);
- while (end > file_name && (my_isspace(system_charset_info,end[-1]) ||
- my_iscntrl(system_charset_info,end[-1])))
- end--;
- end[0]= 0;
- strmov(outfile, file_name);
- }
- if (!strlen(outfile))
+
+ /* eliminate the spaces before the parameters */
+ while (my_isspace(system_charset_info,*param))
+ param++;
+ end= strmake(file_name, param, sizeof(file_name) - 1);
+ /* remove end space from command line */
+ while (end > file_name && (my_isspace(system_charset_info,end[-1]) ||
+ my_iscntrl(system_charset_info,end[-1])))
+ end--;
+ end[0]= 0;
+ if (end == file_name)
{
printf("No outfile specified!\n");
return 0;
}
- init_tee();
+ opt_outfile= init_tee(file_name);
+ if (opt_outfile)
+ tee_fprintf(stdout, "Logging to file '%s'\n", outfile);
+ else
+ tee_fprintf(stdout, "Error logging to file '%s'\n",file_name);
return 0;
}
+
static int
com_notee(String *buffer __attribute__((unused)),
char *line __attribute__((unused)))
@@ -1987,7 +2013,7 @@
}
/*
-** Sorry, this command is not available in Windows.
+ Sorry, this command is not available in Windows.
*/
#ifndef __WIN__
@@ -2044,7 +2070,7 @@
/*
-** Sorry, you can't send the result to an editor in Win32
+ Sorry, you can't send the result to an editor in Win32
*/
#ifndef __WIN__
@@ -2120,9 +2146,11 @@
put_info("Usage: \\! shell-command", INFO_ERROR);
return -1;
}
- /* The output of the shell command does not
- get directed to the pager or the outfile */
- if(system(shell_cmd) == -1)
+ /*
+ The output of the shell command does not
+ get directed to the pager or the outfile
+ */
+ if (system(shell_cmd) == -1)
{
put_info(strerror(errno), INFO_ERROR, errno);
return -1;
@@ -2444,11 +2472,11 @@
if ((status=mysql_stat(&mysql)) && !mysql_error(&mysql)[0])
{
- char *pos,buff[40];
ulong sec;
- pos=strchr(status,' ');
- *pos++=0;
- tee_fprintf(stdout, "%s\t\t\t", status); /* print label */
+ char buff[40];
+ const char *pos= strchr(status,' ');
+ /* print label */
+ tee_fprintf(stdout, "%.*s\t\t\t", (int) (pos-status), status);
if ((status=str2int(pos,10,0,LONG_MAX,(long*) &sec)))
{
nice_time((double) sec,buff,0);
@@ -2519,7 +2547,7 @@
}
if (info_type == INFO_ERROR)
{
- if(!opt_nobeep)
+ if (!opt_nobeep)
putchar('\007'); /* This should make a bell */
vidattr(A_STANDOUT);
if (error)
@@ -2602,9 +2630,11 @@
#include <time.h>
#else
#include <sys/times.h>
+#ifdef _SC_CLK_TCK // For mit-pthreads
#undef CLOCKS_PER_SEC
#define CLOCKS_PER_SEC (sysconf(_SC_CLK_TCK))
#endif
+#endif
static ulong start_timer(void)
{
@@ -2663,18 +2693,20 @@
strmov(strend(buff),")");
}
-static const char* construct_prompt() {
+static const char* construct_prompt()
+{
//erase the old prompt
processed_prompt.free();
//get the date struct
time_t lclock = time(NULL);
struct tm *t = localtime(&lclock);
//parse thru the settings for the prompt
- for (char *c = current_prompt;*c;*c++) {
- if (*c != PROMPT_CHAR) {
+ for (char *c = current_prompt; *c ; *c++)
+ {
+ if (*c != PROMPT_CHAR)
processed_prompt.append(*c);
- }
- else {
+ else
+ {
switch (*++c) {
case '\0':
//stop it from going beyond if ends with %
@@ -2796,13 +2828,16 @@
return processed_prompt.ptr();
}
-static void add_int_to_prompt(int toadd) {
+
+static void add_int_to_prompt(int toadd)
+{
char buffer[16];
int10_to_str(toadd,buffer,10);
processed_prompt.append(buffer);
}
-static void init_username() {
+static void init_username()
+{
my_free(full_username,MYF(MY_ALLOW_ZERO_PTR));
my_free(part_username,MYF(MY_ALLOW_ZERO_PTR));
@@ -2810,22 +2845,21 @@
LINT_INIT(result);
if (!mysql_query(&mysql,"select USER()") &&
(result=mysql_use_result(&mysql)))
- {
- MYSQL_ROW cur=mysql_fetch_row(result);
- full_username=my_strdup(cur[0],MYF(MY_WME));
- part_username=my_strdup(strtok(cur[0],"@"),MYF(MY_WME));
- (void) mysql_fetch_row(result); // Read eof
- }
+ {
+ MYSQL_ROW cur=mysql_fetch_row(result);
+ full_username=my_strdup(cur[0],MYF(MY_WME));
+ part_username=my_strdup(strtok(cur[0],"@"),MYF(MY_WME));
+ (void) mysql_fetch_row(result); // Read eof
+ }
}
-static int
-com_prompt(String *buffer, char *line __attribute__((unused))) {
+static int com_prompt(String *buffer, char *line)
+{
+ char *ptr=strchr(line, ' ');
prompt_counter = 0;
my_free(current_prompt,MYF(MY_ALLOW_ZERO_PTR));
- current_prompt=my_strdup(strchr(line, ' ') ?
- strchr(line, ' ')+1 :
- default_prompt,MYF(MY_WME));
- if (!strchr(line, ' '))
+ current_prompt=my_strdup(ptr ? ptr+1 : default_prompt,MYF(MY_WME));
+ if (!ptr)
tee_fprintf(stdout, "Returning to default PROMPT of %s\n", default_prompt);
else
tee_fprintf(stdout, "PROMPT set to '%s'\n", current_prompt);
--- 1.21/scripts/Makefile.am Thu Jun 27 13:27:00 2002
+++ 1.22/scripts/Makefile.am Mon Oct 7 19:25:49 2002
@@ -56,7 +56,8 @@
EXTRA_DIST = $(EXTRA_SCRIPTS) \
mysqlaccess.conf \
- mysqlbug
+ mysqlbug \
+ fill_func_tables.sql
pkgdata_DATA = make_binary_distribution
@@ -76,7 +77,8 @@
mysql_find_rows \
mysqlhotcopy \
mysqldumpslow \
- mysqld_multi
+ mysqld_multi \
+ fill_func_tables.sql
SUPERCLEANFILES = mysqlbug
@@ -127,3 +129,8 @@
# Don't update the files from bitkeeper
%::SCCS/s.%
+
+all: fill_func_tables.sql
+
+fill_func_tables.sql: fill_func_tables.pl ../Docs/manual.texi
+ ./fill_func_tables.pl < ../Docs/manual.texi > fill_func_tables.sql
\ No newline at end of file
--- 1.35/scripts/mysql_install_db.sh Mon Sep 16 17:55:15 2002
+++ 1.36/scripts/mysql_install_db.sh Mon Oct 7 19:25:49 2002
@@ -307,8 +307,8 @@
fi
echo "Installing all prepared tables"
-if eval "$execdir/mysqld $defaults --bootstrap --skip-grant-tables \
- --basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb $args" << END_OF_DATA
+if (
+ cat << END_OF_DATA
use mysql;
$c_d
$i_d
@@ -325,6 +325,9 @@
$c_t
$c_c
END_OF_DATA
+ cat fill_func_tables.sql
+) | eval "$execdir/mysqld $defaults --bootstrap --skip-grant-tables \
+ --basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb $args"
then
echo ""
if test "$IN_RPM" -eq 0
--- 1.246/sql/sql_parse.cc Mon Oct 7 02:56:11 2002
+++ 1.247/sql/sql_parse.cc Mon Oct 7 19:25:50 2002
@@ -711,11 +711,24 @@
Used when creating the initial grant tables
*/
+int str_char_count(const char* str, char c)
+{
+ int res= 0;
+ while (*str)
+ if (*(str++)==c)
+ res++;
+ return res;
+}
+
pthread_handler_decl(handle_bootstrap,arg)
{
THD *thd=(THD*) arg;
FILE *file=bootstrap_file;
char *buff;
+ char *res_fgets;
+ int have_semicolon= 0;
+ int count_quota= 0;
+ int semicolon;
/* The following must be called before DBUG_ENTER */
if (my_thread_init() || thd->store_globals())
@@ -747,17 +760,31 @@
init_sql_alloc(&thd->mem_root, MEM_ROOT_BLOCK_SIZE, MEM_ROOT_PREALLOC);
init_sql_alloc(&thd->transaction.mem_root,
TRANS_MEM_ROOT_BLOCK_SIZE, TRANS_MEM_ROOT_PREALLOC);
- while (fgets(buff, thd->net.max_packet, file))
+ thd->query_length= 0;
+ while ((res_fgets=fgets(buff, thd->net.max_packet-thd->query_length, file))
+ || buff!=(char*)thd->net.buff)
{
uint length=(uint) strlen(buff);
+ count_quota+= str_char_count(buff,'\'');
+ semicolon= (!(count_quota&(int)1) && buff[length-1] == ';');
while (length && (my_isspace(system_charset_info, buff[length-1]) ||
- buff[length-1] == ';'))
+ semicolon)){
length--;
- buff[length]=0;
+ semicolon= (!(count_quota&(int)1) && buff[length-1] == ';');
+ have_semicolon|= semicolon;
+ }
+ buff+= length;
+ thd->query_length+= length;
+ if (!have_semicolon && res_fgets){
+ *(buff++)= '\n';
+ thd->query_length++;
+ continue;
+ };
+ have_semicolon= 0;
thd->current_tablenr=0;
- thd->query_length=length;
- thd->query= thd->memdup_w_gap(buff, length+1, thd->db_length+1);
- thd->query[length] = '\0';
+ thd->query= thd->memdup_w_gap((char*)thd->net.buff,
+ thd->query_length+1, thd->db_length+1);
+ thd->query[thd->query_length] = '\0';
thd->query_id=query_id++;
if (mqh_used && thd->user_connect && check_mqh(thd, SQLCOM_END))
{
@@ -766,12 +793,15 @@
free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC));
break;
}
- mysql_parse(thd,thd->query,length);
+ mysql_parse(thd,thd->query,thd->query_length);
close_thread_tables(thd); // Free tables
if (thd->fatal_error)
break;
free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC));
free_root(&thd->transaction.mem_root,MYF(MY_KEEP_PREALLOC));
+ thd->query_length= 0;
+ buff= (char*) thd->net.buff;
+ count_quota= 0;
}
/* thd->fatal_error should be set in case something went wrong */
| Thread |
|---|
| • bk commit into 4.1 tree | vva | 7 Oct |