Bug fixes, TRUNCATE, safer passwords on command line and connect timeout
Docs/manual.texi: Update of safe_mysqld, TRUNCATE and changes for 3.23.28 client/mysql.cc: Added --timeout client/mysqladmin.c: Safer password handling client/mysqldump.c: Safer password handling client/mysqlimport.c: Safer password handling client/mysqlshow.c: Safer password handling configure.in: Fixes for Darwin and added test of poll include/my_pthread.h: Fixes for darwin include/violite.h: Added test for polling libmysql/libmysql.c: connect timeout libmysql/violite.c: connect timeout mysys/hash.c: Fix when delting from empty table scripts/safe_mysqld.sh: Added --open-files, --core-file-size and --timezone sql-bench/bench-init.pl.sh: Function print_time sql-bench/crash-me.sh: Added test of truncate sql-bench/test-insert.sh: More "estimated" tests sql-bench/test-select.sh: More "estimated" tests sql/filesort.cc: Removed allocation of extra memory sql/ha_berkeley.cc: Better estimation of number of rows sql/item_create.cc: Truncate sql/item_create.h: Truncate sql/item_strfunc.cc: Removed usage of MY_FAE sql/lex.h: Truncate sql/lock.cc: Fixed possible loop bug sql/log.cc: Removed usage of FILE:s sql/mysqld.cc: Print of more server variables sql/sql_class.h: Changed FILE -> File sql/sql_insert.cc: Fixed bug in temptable handling sql/sql_lex.h: Cleanup sql/sql_load.cc: Removed usage of MY_FAE sql/sql_parse.cc: Cleanup + TRUNCATE sql/sql_select.cc: Cleanup + fix for INSERT ... SELECT sql/sql_yacc.yy: TRUNCATE sql/violite.c: Merge with client/violite.c strings/strstr-sparc.s: Fixed wrong register usage
This commit is contained in:
parent
675d31ee9a
commit
f3d2341f1f
618
Docs/manual.texi
618
Docs/manual.texi
File diff suppressed because it is too large
Load Diff
@ -115,7 +115,7 @@ static bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0,
|
|||||||
opt_compress=0,
|
opt_compress=0,
|
||||||
vertical=0,skip_line_numbers=0,skip_column_names=0,opt_html=0,
|
vertical=0,skip_line_numbers=0,skip_column_names=0,opt_html=0,
|
||||||
no_named_cmds=1; // we want this to be the default
|
no_named_cmds=1; // we want this to be the default
|
||||||
static uint verbose=0,opt_silent=0,opt_mysql_port=0;
|
static uint verbose=0,opt_silent=0,opt_mysql_port=0,opt_connect_timeout=0;
|
||||||
static my_string opt_mysql_unix_port=0;
|
static my_string opt_mysql_unix_port=0;
|
||||||
static int connect_flag=CLIENT_INTERACTIVE;
|
static int connect_flag=CLIENT_INTERACTIVE;
|
||||||
static char *current_host,*current_db,*current_user=0,*opt_password=0,
|
static char *current_host,*current_db,*current_user=0,*opt_password=0,
|
||||||
@ -334,7 +334,7 @@ sig_handler mysql_end(int sig)
|
|||||||
exit(status.exit_status);
|
exit(status.exit_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum options {OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET} ;
|
enum options {OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET, OPT_TIMEOUT} ;
|
||||||
|
|
||||||
|
|
||||||
static struct option long_options[] =
|
static struct option long_options[] =
|
||||||
@ -374,6 +374,7 @@ static struct option long_options[] =
|
|||||||
{"socket", required_argument, 0, 'S'},
|
{"socket", required_argument, 0, 'S'},
|
||||||
#include "sslopt-longopts.h"
|
#include "sslopt-longopts.h"
|
||||||
{"table", no_argument, 0, 't'},
|
{"table", no_argument, 0, 't'},
|
||||||
|
{"timeout", required_argument, 0, OPT_TIMEOUT},
|
||||||
#ifndef DONT_ALLOW_USER_CHANGE
|
#ifndef DONT_ALLOW_USER_CHANGE
|
||||||
{"user", required_argument, 0, 'u'},
|
{"user", required_argument, 0, 'u'},
|
||||||
#endif
|
#endif
|
||||||
@ -545,9 +546,12 @@ static int get_options(int argc, char **argv)
|
|||||||
case 'p':
|
case 'p':
|
||||||
if (optarg)
|
if (optarg)
|
||||||
{
|
{
|
||||||
|
char *start=optarg;
|
||||||
my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
|
my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
|
||||||
opt_password=my_strdup(optarg,MYF(MY_FAE));
|
opt_password=my_strdup(optarg,MYF(MY_FAE));
|
||||||
while (*optarg) *optarg++= 'x'; // Destroy argument
|
while (*optarg) *optarg++= 'x'; // Destroy argument
|
||||||
|
if (*start)
|
||||||
|
start[1]=0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tty_password=1;
|
tty_password=1;
|
||||||
@ -603,6 +607,9 @@ static int get_options(int argc, char **argv)
|
|||||||
opt_mysql_unix_port=my_strdup(MYSQL_NAMEDPIPE,MYF(0));
|
opt_mysql_unix_port=my_strdup(MYSQL_NAMEDPIPE,MYF(0));
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
case OPT_TIMEOUT:
|
||||||
|
opt_connect_timeout=atoi(optarg);
|
||||||
|
break;
|
||||||
case 'V': usage(1); exit(0);
|
case 'V': usage(1); exit(0);
|
||||||
case 'I':
|
case 'I':
|
||||||
case '?':
|
case '?':
|
||||||
@ -1772,6 +1779,9 @@ sql_real_connect(char *host,char *database,char *user,char *password,
|
|||||||
connected= 0;
|
connected= 0;
|
||||||
}
|
}
|
||||||
mysql_init(&mysql);
|
mysql_init(&mysql);
|
||||||
|
if (opt_connect_timeout)
|
||||||
|
mysql_options(&mysql,MYSQL_OPT_CONNECT_TIMEOUT,
|
||||||
|
(char*) &opt_connect_timeout);
|
||||||
if (opt_compress)
|
if (opt_compress)
|
||||||
mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS);
|
mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS);
|
||||||
#ifdef HAVE_OPENSSL
|
#ifdef HAVE_OPENSSL
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include <my_pthread.h> /* because of signal() */
|
#include <my_pthread.h> /* because of signal() */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ADMIN_VERSION "8.9"
|
#define ADMIN_VERSION "8.11"
|
||||||
#define MAX_MYSQL_VAR 64
|
#define MAX_MYSQL_VAR 64
|
||||||
#define MAX_TIME_TO_WAIT 3600 /* Wait for shutdown */
|
#define MAX_TIME_TO_WAIT 3600 /* Wait for shutdown */
|
||||||
#define MAX_TRUNC_LENGTH 3
|
#define MAX_TRUNC_LENGTH 3
|
||||||
@ -137,7 +137,7 @@ int main(int argc,char *argv[])
|
|||||||
{
|
{
|
||||||
int c, error = 0,option_index=0;
|
int c, error = 0,option_index=0;
|
||||||
MYSQL mysql;
|
MYSQL mysql;
|
||||||
char *host = NULL,*password=0,*user=0,**commands;
|
char *host = NULL,*opt_password=0,*user=0,**commands;
|
||||||
my_bool tty_password=0;
|
my_bool tty_password=0;
|
||||||
MY_INIT(argv[0]);
|
MY_INIT(argv[0]);
|
||||||
mysql_init(&mysql);
|
mysql_init(&mysql);
|
||||||
@ -160,9 +160,12 @@ int main(int argc,char *argv[])
|
|||||||
case 'p':
|
case 'p':
|
||||||
if (optarg)
|
if (optarg)
|
||||||
{
|
{
|
||||||
my_free(password,MYF(MY_ALLOW_ZERO_PTR));
|
char *start=optarg;
|
||||||
password=my_strdup(optarg,MYF(MY_FAE));
|
my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
|
||||||
|
opt_password=my_strdup(optarg,MYF(MY_FAE));
|
||||||
while (*optarg) *optarg++= 'x'; /* Destroy argument */
|
while (*optarg) *optarg++= 'x'; /* Destroy argument */
|
||||||
|
if (*start)
|
||||||
|
start[1]=0; /* Cut length of argument */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tty_password=1;
|
tty_password=1;
|
||||||
@ -243,12 +246,11 @@ int main(int argc,char *argv[])
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (tty_password)
|
if (tty_password)
|
||||||
password = get_tty_password(NullS);
|
opt_password = get_tty_password(NullS);
|
||||||
|
|
||||||
VOID(signal(SIGINT,endprog)); /* Here if abort */
|
VOID(signal(SIGINT,endprog)); /* Here if abort */
|
||||||
VOID(signal(SIGTERM,endprog)); /* Here if abort */
|
VOID(signal(SIGTERM,endprog)); /* Here if abort */
|
||||||
|
|
||||||
mysql_init(&mysql);
|
|
||||||
if (opt_compress)
|
if (opt_compress)
|
||||||
mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS);
|
mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS);
|
||||||
#ifdef HAVE_OPENSSL
|
#ifdef HAVE_OPENSSL
|
||||||
@ -256,7 +258,7 @@ int main(int argc,char *argv[])
|
|||||||
mysql_ssl_set(&mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
|
mysql_ssl_set(&mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
|
||||||
opt_ssl_capath);
|
opt_ssl_capath);
|
||||||
#endif /* HAVE_OPENSSL */
|
#endif /* HAVE_OPENSSL */
|
||||||
if (sql_connect(&mysql,host,user,password,option_wait))
|
if (sql_connect(&mysql,host,user,opt_password,option_wait))
|
||||||
error = 1;
|
error = 1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -269,7 +271,7 @@ int main(int argc,char *argv[])
|
|||||||
if (option_wait && !interrupted)
|
if (option_wait && !interrupted)
|
||||||
{
|
{
|
||||||
mysql_close(&mysql);
|
mysql_close(&mysql);
|
||||||
if (!sql_connect(&mysql,host,user,password,option_wait))
|
if (!sql_connect(&mysql,host,user,opt_password,option_wait))
|
||||||
continue; /* Retry */
|
continue; /* Retry */
|
||||||
}
|
}
|
||||||
error=1;
|
error=1;
|
||||||
@ -286,7 +288,7 @@ int main(int argc,char *argv[])
|
|||||||
}
|
}
|
||||||
mysql_close(&mysql);
|
mysql_close(&mysql);
|
||||||
}
|
}
|
||||||
my_free(password,MYF(MY_ALLOW_ZERO_PTR));
|
my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
|
||||||
my_free(user,MYF(MY_ALLOW_ZERO_PTR));
|
my_free(user,MYF(MY_ALLOW_ZERO_PTR));
|
||||||
free_defaults(argv);
|
free_defaults(argv);
|
||||||
my_end(0);
|
my_end(0);
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
** Tõnu Samuel <tonu@please.do.not.remove.this.spam.ee>
|
** Tõnu Samuel <tonu@please.do.not.remove.this.spam.ee>
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#define DUMP_VERSION "8.10"
|
#define DUMP_VERSION "8.11"
|
||||||
|
|
||||||
#include <global.h>
|
#include <global.h>
|
||||||
#include <my_sys.h>
|
#include <my_sys.h>
|
||||||
@ -75,7 +75,7 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick=0, extended_insert = 0,
|
|||||||
opt_delayed=0,create_options=0,opt_quoted=0,opt_databases=0,
|
opt_delayed=0,create_options=0,opt_quoted=0,opt_databases=0,
|
||||||
opt_alldbs=0,opt_create_db=0,opt_first_slave=0;
|
opt_alldbs=0,opt_create_db=0,opt_first_slave=0;
|
||||||
static MYSQL mysql_connection,*sock=0;
|
static MYSQL mysql_connection,*sock=0;
|
||||||
static char insert_pat[12 * 1024],*password=0,*current_user=0,
|
static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
|
||||||
*current_host=0,*path=0,*fields_terminated=0,
|
*current_host=0,*path=0,*fields_terminated=0,
|
||||||
*lines_terminated=0, *enclosed=0, *opt_enclosed=0, *escaped=0,
|
*lines_terminated=0, *enclosed=0, *opt_enclosed=0, *escaped=0,
|
||||||
*where=0, *default_charset;
|
*where=0, *default_charset;
|
||||||
@ -333,9 +333,12 @@ static int get_options(int *argc,char ***argv)
|
|||||||
case 'p':
|
case 'p':
|
||||||
if (optarg)
|
if (optarg)
|
||||||
{
|
{
|
||||||
my_free(password,MYF(MY_ALLOW_ZERO_PTR));
|
char *start=optarg;
|
||||||
password=my_strdup(optarg,MYF(MY_FAE));
|
my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
|
||||||
while (*optarg) *optarg++= 'x'; /* Destroy argument */
|
opt_password=my_strdup(optarg,MYF(MY_FAE));
|
||||||
|
while (*optarg) *optarg++= 'x'; /* Destroy argument */
|
||||||
|
if (*start)
|
||||||
|
start[1]=0; /* Cut length of argument */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tty_password=1;
|
tty_password=1;
|
||||||
@ -459,7 +462,7 @@ static int get_options(int *argc,char ***argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (tty_password)
|
if (tty_password)
|
||||||
password=get_tty_password(NullS);
|
opt_password=get_tty_password(NullS);
|
||||||
return(0);
|
return(0);
|
||||||
} /* get_options */
|
} /* get_options */
|
||||||
|
|
||||||
@ -1236,7 +1239,7 @@ int main(int argc, char **argv)
|
|||||||
my_end(0);
|
my_end(0);
|
||||||
exit(EX_USAGE);
|
exit(EX_USAGE);
|
||||||
}
|
}
|
||||||
if (dbConnect(current_host, current_user, password))
|
if (dbConnect(current_host, current_user, opt_password))
|
||||||
exit(EX_MYSQLERR);
|
exit(EX_MYSQLERR);
|
||||||
if (!path)
|
if (!path)
|
||||||
write_heder(stdout, *argv);
|
write_heder(stdout, *argv);
|
||||||
@ -1276,7 +1279,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
dbDisconnect(current_host);
|
dbDisconnect(current_host);
|
||||||
puts("");
|
puts("");
|
||||||
my_free(password, MYF(MY_ALLOW_ZERO_PTR));
|
my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
|
||||||
if (extended_insert)
|
if (extended_insert)
|
||||||
dynstr_free(&extended_row);
|
dynstr_free(&extended_row);
|
||||||
my_end(0);
|
my_end(0);
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
** * *
|
** * *
|
||||||
** *************************
|
** *************************
|
||||||
*/
|
*/
|
||||||
#define IMPORT_VERSION "2.4"
|
#define IMPORT_VERSION "2.5"
|
||||||
|
|
||||||
#include <global.h>
|
#include <global.h>
|
||||||
#include <my_sys.h>
|
#include <my_sys.h>
|
||||||
@ -45,7 +45,7 @@ static my_bool verbose=0,lock_tables=0,ignore_errors=0,delete=0,
|
|||||||
replace=0,silent=0,ignore=0,opt_compress=0,opt_local_file=0;
|
replace=0,silent=0,ignore=0,opt_compress=0,opt_local_file=0;
|
||||||
|
|
||||||
static MYSQL mysql_connection;
|
static MYSQL mysql_connection;
|
||||||
static char *password=0, *current_user=0,
|
static char *opt_password=0, *current_user=0,
|
||||||
*current_host=0, *current_db=0, *fields_terminated=0,
|
*current_host=0, *current_db=0, *fields_terminated=0,
|
||||||
*lines_terminated=0, *enclosed=0, *opt_enclosed=0,
|
*lines_terminated=0, *enclosed=0, *opt_enclosed=0,
|
||||||
*escaped=0, opt_low_priority=0, *opt_columns=0;
|
*escaped=0, opt_low_priority=0, *opt_columns=0;
|
||||||
@ -202,9 +202,12 @@ static int get_options(int *argc, char ***argv)
|
|||||||
case 'p':
|
case 'p':
|
||||||
if (optarg)
|
if (optarg)
|
||||||
{
|
{
|
||||||
my_free(password,MYF(MY_ALLOW_ZERO_PTR));
|
char *start=optarg;
|
||||||
password= my_strdup(optarg,MYF(MY_FAE));
|
my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
|
||||||
|
opt_password=my_strdup(optarg,MYF(MY_FAE));
|
||||||
while (*optarg) *optarg++= 'x'; /* Destroy argument */
|
while (*optarg) *optarg++= 'x'; /* Destroy argument */
|
||||||
|
if (*start)
|
||||||
|
start[1]=0; /* Cut length of argument */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tty_password= 1;
|
tty_password= 1;
|
||||||
@ -276,7 +279,7 @@ static int get_options(int *argc, char ***argv)
|
|||||||
current_db= *((*argv)++);
|
current_db= *((*argv)++);
|
||||||
(*argc)--;
|
(*argc)--;
|
||||||
if (tty_password)
|
if (tty_password)
|
||||||
password=get_tty_password(NullS);
|
opt_password=get_tty_password(NullS);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -504,7 +507,7 @@ int main(int argc, char **argv)
|
|||||||
argv_to_free= argv;
|
argv_to_free= argv;
|
||||||
if (get_options(&argc, &argv))
|
if (get_options(&argc, &argv))
|
||||||
return(1);
|
return(1);
|
||||||
if (!(sock= db_connect(current_host,current_db,current_user,password)))
|
if (!(sock= db_connect(current_host,current_db,current_user,opt_password)))
|
||||||
return(1); /* purecov: deadcode */
|
return(1); /* purecov: deadcode */
|
||||||
if (lock_tables)
|
if (lock_tables)
|
||||||
lock_table(sock, argc, argv);
|
lock_table(sock, argc, argv);
|
||||||
@ -513,7 +516,7 @@ int main(int argc, char **argv)
|
|||||||
if (exitcode == 0)
|
if (exitcode == 0)
|
||||||
exitcode = error;
|
exitcode = error;
|
||||||
db_disconnect(current_host, sock);
|
db_disconnect(current_host, sock);
|
||||||
my_free(password,MYF(MY_ALLOW_ZERO_PTR));
|
my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
|
||||||
free_defaults(argv_to_free);
|
free_defaults(argv_to_free);
|
||||||
my_end(0);
|
my_end(0);
|
||||||
return(exitcode);
|
return(exitcode);
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
||||||
static my_string host=0,password=0,user=0;
|
static my_string host=0,opt_password=0,user=0;
|
||||||
static my_bool opt_show_keys=0,opt_compress=0,opt_status=0;
|
static my_bool opt_show_keys=0,opt_compress=0,opt_status=0;
|
||||||
|
|
||||||
static void get_options(int *argc,char ***argv);
|
static void get_options(int *argc,char ***argv);
|
||||||
@ -88,15 +88,13 @@ int main(int argc, char **argv)
|
|||||||
mysql_ssl_set(&mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
|
mysql_ssl_set(&mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
|
||||||
opt_ssl_capath);
|
opt_ssl_capath);
|
||||||
#endif
|
#endif
|
||||||
if (!(mysql_real_connect(&mysql,host,user,password,
|
if (!(mysql_real_connect(&mysql,host,user,opt_password,
|
||||||
argv[0],opt_mysql_port,opt_mysql_unix_port,
|
argv[0],opt_mysql_port,opt_mysql_unix_port,
|
||||||
0)))
|
0)))
|
||||||
{
|
{
|
||||||
fprintf(stderr,"%s: %s\n",my_progname,mysql_error(&mysql));
|
fprintf(stderr,"%s: %s\n",my_progname,mysql_error(&mysql));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
/* if (!(mysql_connect(&mysql,host,user,password))) */
|
|
||||||
|
|
||||||
|
|
||||||
switch (argc)
|
switch (argc)
|
||||||
{
|
{
|
||||||
@ -111,11 +109,12 @@ int main(int argc, char **argv)
|
|||||||
if (opt_status && ! wild)
|
if (opt_status && ! wild)
|
||||||
error=list_table_status(&mysql,argv[0],argv[1]);
|
error=list_table_status(&mysql,argv[0],argv[1]);
|
||||||
else
|
else
|
||||||
error=list_fields(&mysql,argv[0],argv[1],wild); break;
|
error=list_fields(&mysql,argv[0],argv[1],wild);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
mysql_close(&mysql); /* Close & free connection */
|
mysql_close(&mysql); /* Close & free connection */
|
||||||
if (password)
|
if (opt_password)
|
||||||
my_free(password,MYF(0));
|
my_free(opt_password,MYF(0));
|
||||||
my_end(0);
|
my_end(0);
|
||||||
exit(error ? 1 : 0);
|
exit(error ? 1 : 0);
|
||||||
return 0; /* No compiler warnings */
|
return 0; /* No compiler warnings */
|
||||||
@ -223,9 +222,12 @@ get_options(int *argc,char ***argv)
|
|||||||
case 'p':
|
case 'p':
|
||||||
if (optarg)
|
if (optarg)
|
||||||
{
|
{
|
||||||
my_free(password,MYF(MY_ALLOW_ZERO_PTR));
|
char *start=optarg;
|
||||||
password=my_strdup(optarg,MYF(MY_FAE));
|
my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
|
||||||
|
opt_password=my_strdup(optarg,MYF(MY_FAE));
|
||||||
while (*optarg) *optarg++= 'x'; /* Destroy argument */
|
while (*optarg) *optarg++= 'x'; /* Destroy argument */
|
||||||
|
if (*start)
|
||||||
|
start[1]=0; /* Cut length of argument */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tty_password=1;
|
tty_password=1;
|
||||||
@ -266,7 +268,7 @@ get_options(int *argc,char ***argv)
|
|||||||
(*argc)-=optind;
|
(*argc)-=optind;
|
||||||
(*argv)+=optind;
|
(*argv)+=optind;
|
||||||
if (tty_password)
|
if (tty_password)
|
||||||
password=get_tty_password(NullS);
|
opt_password=get_tty_password(NullS);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script.
|
|||||||
AC_INIT(sql/mysqld.cc)
|
AC_INIT(sql/mysqld.cc)
|
||||||
AC_CANONICAL_SYSTEM
|
AC_CANONICAL_SYSTEM
|
||||||
# The Docs Makefile.am parses this line!
|
# The Docs Makefile.am parses this line!
|
||||||
AM_INIT_AUTOMAKE(mysql, 3.23.27-beta)
|
AM_INIT_AUTOMAKE(mysql, 3.23.28-gamma)
|
||||||
AM_CONFIG_HEADER(config.h)
|
AM_CONFIG_HEADER(config.h)
|
||||||
|
|
||||||
PROTOCOL_VERSION=10
|
PROTOCOL_VERSION=10
|
||||||
@ -687,6 +687,8 @@ case $SYSTEM_TYPE in
|
|||||||
then
|
then
|
||||||
CFLAGS="$CFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS"
|
CFLAGS="$CFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS"
|
||||||
CXXFLAGS="$CXXFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS"
|
CXXFLAGS="$CXXFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS"
|
||||||
|
CFLAGS="$CFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE"
|
||||||
|
CXXFLAGS="$CXXFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE"
|
||||||
MAX_C_OPTIMIZE="-O"
|
MAX_C_OPTIMIZE="-O"
|
||||||
with_named_curses=""
|
with_named_curses=""
|
||||||
fi
|
fi
|
||||||
@ -1235,13 +1237,13 @@ AC_FUNC_UTIME_NULL
|
|||||||
AC_FUNC_VPRINTF
|
AC_FUNC_VPRINTF
|
||||||
AC_CHECK_FUNCS(alarm bmove \
|
AC_CHECK_FUNCS(alarm bmove \
|
||||||
chsize ftruncate rint finite fpsetmask fpresetsticky\
|
chsize ftruncate rint finite fpsetmask fpresetsticky\
|
||||||
cuserid fcntl fconvert \
|
cuserid fcntl fconvert poll \
|
||||||
getrusage getpwuid getcwd getrlimit getwd index stpcpy locking longjmp \
|
getrusage getpwuid getcwd getrlimit getwd index stpcpy locking longjmp \
|
||||||
perror pread realpath rename \
|
perror pread realpath rename \
|
||||||
socket strnlen madvise mkstemp \
|
socket strnlen madvise mkstemp \
|
||||||
strtol strtoul strtoull snprintf tempnam thr_setconcurrency \
|
strtol strtoul strtoull snprintf tempnam thr_setconcurrency \
|
||||||
gethostbyaddr_r gethostbyname_r getpwnam \
|
gethostbyaddr_r gethostbyname_r getpwnam \
|
||||||
bfill bzero bcmp strstr strpbrk strerror\
|
bfill bzero bcmp strstr strpbrk strerror \
|
||||||
tell atod memcpy memmove \
|
tell atod memcpy memmove \
|
||||||
setupterm strcasecmp sighold \
|
setupterm strcasecmp sighold \
|
||||||
vidattr setupterm lrand48 localtime_r \
|
vidattr setupterm lrand48 localtime_r \
|
||||||
|
@ -351,10 +351,9 @@ struct tm *localtime_r(const time_t *clock, struct tm *res);
|
|||||||
#define pthread_kill(A,B) pthread_dummy(0)
|
#define pthread_kill(A,B) pthread_dummy(0)
|
||||||
#define pthread_condattr_init(A) pthread_dummy(0)
|
#define pthread_condattr_init(A) pthread_dummy(0)
|
||||||
#define pthread_condattr_destroy(A) pthread_dummy(0)
|
#define pthread_condattr_destroy(A) pthread_dummy(0)
|
||||||
#define pthread_cond_init( A, B ) pthread_cond_init( (A), 0 )
|
|
||||||
#define pthread_signal(A,B) pthread_dummy(0)
|
#define pthread_signal(A,B) pthread_dummy(0)
|
||||||
#undef pthread_detach_this_thread
|
#undef pthread_detach_this_thread
|
||||||
#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); }
|
#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(tmp); }
|
||||||
#undef sigset
|
#undef sigset
|
||||||
#define sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
|
#define sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
|
||||||
#endif
|
#endif
|
||||||
|
@ -108,6 +108,9 @@ my_bool vio_peer_addr(Vio * vio, char *buf);
|
|||||||
|
|
||||||
void vio_in_addr(Vio *vio, struct in_addr *in);
|
void vio_in_addr(Vio *vio, struct in_addr *in);
|
||||||
|
|
||||||
|
/* Return 1 if there is data to be read */
|
||||||
|
my_bool vio_poll_read(Vio *vio,uint timeout);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -64,6 +64,12 @@ my_string mysql_unix_port=0;
|
|||||||
|
|
||||||
#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES | CLIENT_TRANSACTIONS)
|
#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES | CLIENT_TRANSACTIONS)
|
||||||
|
|
||||||
|
#ifdef __WIN__
|
||||||
|
#define CONNECT_TIMEOUT 20
|
||||||
|
#else
|
||||||
|
#define CONNECT_TIMEOUT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(MSDOS) || defined(__WIN__)
|
#if defined(MSDOS) || defined(__WIN__)
|
||||||
#define ERRNO WSAGetLastError()
|
#define ERRNO WSAGetLastError()
|
||||||
#define perror(A)
|
#define perror(A)
|
||||||
@ -113,7 +119,7 @@ static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to,
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
static int connect2(my_socket s, const struct sockaddr *name, uint namelen,
|
static int connect2(my_socket s, const struct sockaddr *name, uint namelen,
|
||||||
uint to)
|
uint timeout)
|
||||||
{
|
{
|
||||||
#if defined(__WIN__)
|
#if defined(__WIN__)
|
||||||
return connect(s, (struct sockaddr*) name, namelen);
|
return connect(s, (struct sockaddr*) name, namelen);
|
||||||
@ -128,7 +134,7 @@ static int connect2(my_socket s, const struct sockaddr *name, uint namelen,
|
|||||||
* exactly like the normal connect() call does.
|
* exactly like the normal connect() call does.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (to == 0)
|
if (timeout == 0)
|
||||||
return connect(s, (struct sockaddr*) name, namelen);
|
return connect(s, (struct sockaddr*) name, namelen);
|
||||||
|
|
||||||
flags = fcntl(s, F_GETFL, 0); /* Set socket to not block */
|
flags = fcntl(s, F_GETFL, 0); /* Set socket to not block */
|
||||||
@ -175,13 +181,13 @@ static int connect2(my_socket s, const struct sockaddr *name, uint namelen,
|
|||||||
start_time = time(NULL);
|
start_time = time(NULL);
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
tv.tv_sec = (long) to;
|
tv.tv_sec = (long) timeout;
|
||||||
tv.tv_usec = 0;
|
tv.tv_usec = 0;
|
||||||
if ((res = select(s+1, NULL, &sfds, NULL, &tv)) >= 0)
|
if ((res = select(s+1, NULL, &sfds, NULL, &tv)) >= 0)
|
||||||
break;
|
break;
|
||||||
now_time=time(NULL);
|
now_time=time(NULL);
|
||||||
to-= (uint) (now_time - start_time);
|
timeout-= (uint) (now_time - start_time);
|
||||||
if (errno != EINTR || (int) to <= 0)
|
if (errno != EINTR || (int) timeout <= 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +201,7 @@ static int connect2(my_socket s, const struct sockaddr *name, uint namelen,
|
|||||||
return(-1);
|
return(-1);
|
||||||
|
|
||||||
if (s_err)
|
if (s_err)
|
||||||
{ /* getsockopt() could suceed */
|
{ /* getsockopt could succeed */
|
||||||
errno = s_err;
|
errno = s_err;
|
||||||
return(-1); /* but return an error... */
|
return(-1); /* but return an error... */
|
||||||
}
|
}
|
||||||
@ -1001,9 +1007,7 @@ mysql_init(MYSQL *mysql)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
bzero((char*) (mysql),sizeof(*(mysql)));
|
bzero((char*) (mysql),sizeof(*(mysql)));
|
||||||
#ifdef __WIN__
|
mysql->options.connect_timeout=CONNECT_TIMEOUT;
|
||||||
mysql->options.connect_timeout=20;
|
|
||||||
#endif
|
|
||||||
#if defined(SIGPIPE) && defined(THREAD)
|
#if defined(SIGPIPE) && defined(THREAD)
|
||||||
if (!((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE))
|
if (!((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE))
|
||||||
(void) signal(SIGPIPE,pipe_sig_handler);
|
(void) signal(SIGPIPE,pipe_sig_handler);
|
||||||
@ -1140,7 +1144,8 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
|
|||||||
const char *passwd, const char *db,
|
const char *passwd, const char *db,
|
||||||
uint port, const char *unix_socket,uint client_flag)
|
uint port, const char *unix_socket,uint client_flag)
|
||||||
{
|
{
|
||||||
char buff[100],charset_name_buff[16],*end,*host_info, *charset_name;
|
char buff[NAME_LEN+100],charset_name_buff[16],*end,*host_info,
|
||||||
|
*charset_name;
|
||||||
my_socket sock;
|
my_socket sock;
|
||||||
uint32 ip_addr;
|
uint32 ip_addr;
|
||||||
struct sockaddr_in sock_addr;
|
struct sockaddr_in sock_addr;
|
||||||
@ -1341,6 +1346,13 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
|
|||||||
|
|
||||||
/* Get version info */
|
/* Get version info */
|
||||||
mysql->protocol_version= PROTOCOL_VERSION; /* Assume this */
|
mysql->protocol_version= PROTOCOL_VERSION; /* Assume this */
|
||||||
|
if (mysql->options.connect_timeout &&
|
||||||
|
vio_poll_read(net->vio, mysql->options.connect_timeout))
|
||||||
|
{
|
||||||
|
net->last_errno= CR_SERVER_LOST;
|
||||||
|
strmov(net->last_error,ER(net->last_errno));
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
if ((pkt_length=net_safe_read(mysql)) == packet_error)
|
if ((pkt_length=net_safe_read(mysql)) == packet_error)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
@ -1496,7 +1508,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
|
|||||||
|
|
||||||
int3store(buff+2,max_allowed_packet);
|
int3store(buff+2,max_allowed_packet);
|
||||||
if (user && user[0])
|
if (user && user[0])
|
||||||
strmake(buff+5,user,32);
|
strmake(buff+5,user,32); /* Max user name */
|
||||||
else
|
else
|
||||||
read_user_name((char*) buff+5);
|
read_user_name((char*) buff+5);
|
||||||
#ifdef _CUSTOMCONFIG_
|
#ifdef _CUSTOMCONFIG_
|
||||||
@ -1507,7 +1519,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
|
|||||||
(my_bool) (mysql->protocol_version == 9));
|
(my_bool) (mysql->protocol_version == 9));
|
||||||
if (db && (mysql->server_capabilities & CLIENT_CONNECT_WITH_DB))
|
if (db && (mysql->server_capabilities & CLIENT_CONNECT_WITH_DB))
|
||||||
{
|
{
|
||||||
end=strmov(end+1,db);
|
end=strmake(end+1,db,NAME_LEN);
|
||||||
mysql->db=my_strdup(db,MYF(MY_WME));
|
mysql->db=my_strdup(db,MYF(MY_WME));
|
||||||
db=0;
|
db=0;
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,9 @@
|
|||||||
#include <my_sys.h>
|
#include <my_sys.h>
|
||||||
#include <my_net.h>
|
#include <my_net.h>
|
||||||
#include <m_string.h>
|
#include <m_string.h>
|
||||||
|
#ifdef HAVE_POLL
|
||||||
|
#include <sys/poll.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__EMX__)
|
#if defined(__EMX__)
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
@ -98,7 +101,9 @@ Vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost)
|
|||||||
if ((vio = (Vio*) my_malloc(sizeof(*vio),MYF(MY_WME))))
|
if ((vio = (Vio*) my_malloc(sizeof(*vio),MYF(MY_WME))))
|
||||||
{
|
{
|
||||||
vio_reset(vio, type, sd, 0, localhost);
|
vio_reset(vio, type, sd, 0, localhost);
|
||||||
sprintf(vio->desc, "socket (%d)", vio->sd);
|
sprintf(vio->desc,
|
||||||
|
(vio->type == VIO_TYPE_SOCKET ? "socket (%d)" : "TCP/IP (%d)"),
|
||||||
|
vio->sd);
|
||||||
#if !defined(___WIN__) && !defined(__EMX__)
|
#if !defined(___WIN__) && !defined(__EMX__)
|
||||||
#if !defined(NO_FCNTL_NONBLOCK)
|
#if !defined(NO_FCNTL_NONBLOCK)
|
||||||
vio->fcntl_mode = fcntl(sd, F_GETFL);
|
vio->fcntl_mode = fcntl(sd, F_GETFL);
|
||||||
@ -261,7 +266,7 @@ vio_is_blocking(Vio * vio)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int vio_fastsend(Vio * vio, my_bool onoff)
|
int vio_fastsend(Vio * vio __attribute__((unused)), my_bool onoff)
|
||||||
{
|
{
|
||||||
int r=0;
|
int r=0;
|
||||||
DBUG_ENTER("vio_fastsend");
|
DBUG_ENTER("vio_fastsend");
|
||||||
@ -322,7 +327,7 @@ int vio_close(Vio * vio)
|
|||||||
if (vio->type == VIO_TYPE_NAMEDPIPE)
|
if (vio->type == VIO_TYPE_NAMEDPIPE)
|
||||||
{
|
{
|
||||||
#if defined(__NT__) && defined(MYSQL_SERVER)
|
#if defined(__NT__) && defined(MYSQL_SERVER)
|
||||||
CancelIO(vio->hPipe);
|
CancelIo(vio->hPipe);
|
||||||
DisconnectNamedPipe(vio->hPipe);
|
DisconnectNamedPipe(vio->hPipe);
|
||||||
#endif
|
#endif
|
||||||
r=CloseHandle(vio->hPipe);
|
r=CloseHandle(vio->hPipe);
|
||||||
@ -397,4 +402,26 @@ void vio_in_addr(Vio *vio, struct in_addr *in)
|
|||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Return 0 if there is data to be read */
|
||||||
|
|
||||||
|
my_bool vio_poll_read(Vio *vio,uint timeout)
|
||||||
|
{
|
||||||
|
#ifndef HAVE_POLL
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
|
struct pollfd fds;
|
||||||
|
int res;
|
||||||
|
DBUG_ENTER("vio_poll");
|
||||||
|
fds.fd=vio->sd;
|
||||||
|
fds.events=POLLIN;
|
||||||
|
fds.revents=0;
|
||||||
|
if ((res=poll(&fds,1,(int) timeout*1000)) <= 0)
|
||||||
|
{
|
||||||
|
DBUG_RETURN(res < 0 ? 0 : 1); /* Don't return 1 on errors */
|
||||||
|
}
|
||||||
|
DBUG_RETURN(fds.revents & POLLIN ? 0 : 1);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* HAVE_VIO */
|
#endif /* HAVE_VIO */
|
||||||
|
@ -374,10 +374,11 @@ my_bool hash_delete(HASH *hash,byte *record)
|
|||||||
uint blength,pos2,pos_hashnr,lastpos_hashnr,idx,empty_index;
|
uint blength,pos2,pos_hashnr,lastpos_hashnr,idx,empty_index;
|
||||||
HASH_LINK *data,*lastpos,*gpos,*pos,*pos3,*empty;
|
HASH_LINK *data,*lastpos,*gpos,*pos,*pos3,*empty;
|
||||||
DBUG_ENTER("hash_delete");
|
DBUG_ENTER("hash_delete");
|
||||||
|
if (!hash->records)
|
||||||
|
DBUG_RETURN(1);
|
||||||
|
|
||||||
blength=hash->blength;
|
blength=hash->blength;
|
||||||
data=dynamic_element(&hash->array,0,HASH_LINK*);
|
data=dynamic_element(&hash->array,0,HASH_LINK*);
|
||||||
|
|
||||||
/* Search after record with key */
|
/* Search after record with key */
|
||||||
pos=data+ hash_mask(rec_hashnr(hash,record),blength,hash->records);
|
pos=data+ hash_mask(rec_hashnr(hash,record),blength,hash->records);
|
||||||
gpos = 0;
|
gpos = 0;
|
||||||
|
@ -28,10 +28,13 @@ parse_arguments() {
|
|||||||
--socket=*) MYSQL_UNIX_PORT=`echo "$arg" | sed -e "s;--socket=;;"` ;;
|
--socket=*) MYSQL_UNIX_PORT=`echo "$arg" | sed -e "s;--socket=;;"` ;;
|
||||||
--port=*) MYSQL_TCP_PORT=`echo "$arg" | sed -e "s;--port=;;"` ;;
|
--port=*) MYSQL_TCP_PORT=`echo "$arg" | sed -e "s;--port=;;"` ;;
|
||||||
--log=*) log=`echo "$arg" | sed -e "s;--log=;;"` ;;
|
--log=*) log=`echo "$arg" | sed -e "s;--log=;;"` ;;
|
||||||
--err-log=*) err_log=`echo "$arg" | sed -e "s;--err-log=;;"` ;;
|
|
||||||
--basedir=*) MY_BASEDIR_VERSION=`echo "$arg" | sed -e "s;--basedir=;;"` ;;
|
--basedir=*) MY_BASEDIR_VERSION=`echo "$arg" | sed -e "s;--basedir=;;"` ;;
|
||||||
--ledir=*) ledir=`echo "$arg" | sed -e "s;--ledir=;;"` ;;
|
|
||||||
--user=*) user=`echo "$arg" | sed -e "s;--user=;;"` ;;
|
--user=*) user=`echo "$arg" | sed -e "s;--user=;;"` ;;
|
||||||
|
--ledir=*) ledir=`echo "$arg" | sed -e "s;--ledir=;;"` ;;
|
||||||
|
--err-log=*) err_log=`echo "$arg" | sed -e "s;--err-log=;;"` ;;
|
||||||
|
--open-files=*) open_files=`echo "$arg" | sed -e "s;--open-files=;;"` ;;
|
||||||
|
--core-file-size*) core_file_size=`echo "$arg" | sed -e "s;--core_file_size=;;"` ;;
|
||||||
|
--timezone=*) TZ=`echo "$arg" | sed -e "s;--timezone=;;"` ; export TZ; ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -105,6 +108,14 @@ if test -w /
|
|||||||
then
|
then
|
||||||
# If we are root, change the err log to the right user.
|
# If we are root, change the err log to the right user.
|
||||||
touch $err_log; chown $user $err_log
|
touch $err_log; chown $user $err_log
|
||||||
|
if test -n "$open_files"
|
||||||
|
then
|
||||||
|
ulimit -n $open_files
|
||||||
|
fi
|
||||||
|
if test -n "$core_file_size"
|
||||||
|
then
|
||||||
|
ulimit -c $core_file_size
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -339,6 +339,15 @@ sub end_benchmark
|
|||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub print_time
|
||||||
|
{
|
||||||
|
my ($estimated)=@_;
|
||||||
|
if ($estimated)
|
||||||
|
{ print "Estimated time"; }
|
||||||
|
else
|
||||||
|
{ print "Time"; }
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Create a filename part for the machine that can be used for log file.
|
# Create a filename part for the machine that can be used for log file.
|
||||||
#
|
#
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
# "3-byte int" or "same as xxx".
|
# "3-byte int" or "same as xxx".
|
||||||
|
|
||||||
|
|
||||||
$version="1.50";
|
$version="1.51";
|
||||||
|
|
||||||
use DBI;
|
use DBI;
|
||||||
use Getopt::Long;
|
use Getopt::Long;
|
||||||
@ -289,6 +289,11 @@ report("rename table","rename_table",
|
|||||||
$dbh->do("drop table crash_q1");
|
$dbh->do("drop table crash_q1");
|
||||||
$dbh->do("drop table crash_q");
|
$dbh->do("drop table crash_q");
|
||||||
|
|
||||||
|
report("truncate table","truncate_table",
|
||||||
|
"create table crash_q (a integer, b integer,c CHAR(10))",
|
||||||
|
"truncate table crash_q",
|
||||||
|
"drop table crash_q1");
|
||||||
|
|
||||||
if ($dbh->do("create table crash_q (a integer, b integer,c CHAR(10))") &&
|
if ($dbh->do("create table crash_q (a integer, b integer,c CHAR(10))") &&
|
||||||
$dbh->do("create table crash_q1 (a integer, b integer,c CHAR(10) not null)"))
|
$dbh->do("create table crash_q1 (a integer, b integer,c CHAR(10) not null)"))
|
||||||
{
|
{
|
||||||
|
@ -498,6 +498,7 @@ if ($limits->{'group_functions'})
|
|||||||
$loop_time=new Benchmark;
|
$loop_time=new Benchmark;
|
||||||
$count=1;
|
$count=1;
|
||||||
|
|
||||||
|
$estimated=0;
|
||||||
for ($tests=0 ; $tests < $small_loop_count ; $tests++)
|
for ($tests=0 ; $tests < $small_loop_count ; $tests++)
|
||||||
{
|
{
|
||||||
$sth=$dbh->prepare($query="select count(*) from bench1") or die $DBI::errstr;
|
$sth=$dbh->prepare($query="select count(*) from bench1") or die $DBI::errstr;
|
||||||
@ -573,9 +574,12 @@ if ($limits->{'group_functions'})
|
|||||||
print "Warning: '$query' returned wrong number of rows\n";
|
print "Warning: '$query' returned wrong number of rows\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$end_time=new Benchmark;
|
||||||
|
last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$tests,
|
||||||
|
$small_loop_count));
|
||||||
}
|
}
|
||||||
$end_time=new Benchmark;
|
print_time($estimated);
|
||||||
print "Time for select_group ($count): " .
|
print " for select_group ($count): " .
|
||||||
timestr(timediff($end_time, $loop_time),"all") . "\n";
|
timestr(timediff($end_time, $loop_time),"all") . "\n";
|
||||||
|
|
||||||
$loop_time=new Benchmark;
|
$loop_time=new Benchmark;
|
||||||
|
@ -205,10 +205,7 @@ for ($i=0 ; $i < $opt_small_loop_count ; $i++)
|
|||||||
$opt_small_loop_count));
|
$opt_small_loop_count));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($estimated)
|
print_time($estimated);
|
||||||
{ print "Estimated time"; }
|
|
||||||
else
|
|
||||||
{ print "Time"; }
|
|
||||||
print " for select_range ($count:$rows): " .
|
print " for select_range ($count:$rows): " .
|
||||||
timestr(timediff($end_time, $loop_time),"all") . "\n";
|
timestr(timediff($end_time, $loop_time),"all") . "\n";
|
||||||
|
|
||||||
@ -243,10 +240,7 @@ if ($limits->{'group_functions'})
|
|||||||
last if ($estimated=predict_query_time($loop_time,$end_time,\$count,
|
last if ($estimated=predict_query_time($loop_time,$end_time,\$count,
|
||||||
$tests+1, $opt_loop_count));
|
$tests+1, $opt_loop_count));
|
||||||
}
|
}
|
||||||
if ($estimated)
|
print_time($estimated);
|
||||||
{ print "Estimated time"; }
|
|
||||||
else
|
|
||||||
{ print "Time"; }
|
|
||||||
print " for min_max_on_key ($count): " .
|
print " for min_max_on_key ($count): " .
|
||||||
timestr(timediff($end_time, $loop_time),"all") . "\n";
|
timestr(timediff($end_time, $loop_time),"all") . "\n";
|
||||||
|
|
||||||
@ -267,10 +261,7 @@ if ($limits->{'group_functions'})
|
|||||||
last if ($estimated=predict_query_time($loop_time,$end_time,\$count,
|
last if ($estimated=predict_query_time($loop_time,$end_time,\$count,
|
||||||
$tests+1, $opt_loop_count));
|
$tests+1, $opt_loop_count));
|
||||||
}
|
}
|
||||||
if ($estimated)
|
print_time($estimated);
|
||||||
{ print "Estimated time"; }
|
|
||||||
else
|
|
||||||
{ print "Time"; }
|
|
||||||
print " for count_on_key ($count): " .
|
print " for count_on_key ($count): " .
|
||||||
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
|
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
|
||||||
|
|
||||||
@ -289,54 +280,74 @@ if ($limits->{'group_functions'})
|
|||||||
{
|
{
|
||||||
print "Testing count(distinct) on the table\n";
|
print "Testing count(distinct) on the table\n";
|
||||||
$loop_time=new Benchmark;
|
$loop_time=new Benchmark;
|
||||||
$rows=0;
|
$rows=$estimated=$count=0;
|
||||||
for ($i=0 ; $i < $opt_medium_loop_count ; $i++)
|
for ($i=0 ; $i < $opt_medium_loop_count ; $i++)
|
||||||
{
|
{
|
||||||
|
$count+=2;
|
||||||
$rows+=fetch_all_rows($dbh,"select count(distinct region) from bench1");
|
$rows+=fetch_all_rows($dbh,"select count(distinct region) from bench1");
|
||||||
$rows+=fetch_all_rows($dbh,"select count(distinct grp) from bench1");
|
$rows+=fetch_all_rows($dbh,"select count(distinct grp) from bench1");
|
||||||
|
$end_time=new Benchmark;
|
||||||
|
last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$i+1,
|
||||||
|
$opt_medium_loop_count));
|
||||||
}
|
}
|
||||||
$end_time=new Benchmark;
|
print_time($estimated);
|
||||||
print "Time for count_distinct ($i:$rows): " .
|
print " for count_distinct ($count:$rows): " .
|
||||||
timestr(timediff($end_time, $loop_time),"all") . "\n";
|
timestr(timediff($end_time, $loop_time),"all") . "\n";
|
||||||
|
|
||||||
$loop_time=new Benchmark;
|
$loop_time=new Benchmark;
|
||||||
$rows=0;
|
$rows=$estimated=$count=0;
|
||||||
for ($i=0 ; $i < $opt_medium_loop_count ; $i++)
|
for ($i=0 ; $i < $opt_medium_loop_count ; $i++)
|
||||||
{
|
{
|
||||||
|
$count++;
|
||||||
$rows+=fetch_all_rows($dbh,"select region,count(distinct idn) from bench1 group by region");
|
$rows+=fetch_all_rows($dbh,"select region,count(distinct idn) from bench1 group by region");
|
||||||
|
$end_time=new Benchmark;
|
||||||
|
last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$i+1,
|
||||||
|
$opt_medium_loop_count));
|
||||||
}
|
}
|
||||||
$end_time=new Benchmark;
|
print_time($estimated);
|
||||||
print "Time for count_distinct_group_on_key ($i:$rows): " .
|
print " for count_distinct_group_on_key ($count:$rows): " .
|
||||||
timestr(timediff($end_time, $loop_time),"all") . "\n";
|
timestr(timediff($end_time, $loop_time),"all") . "\n";
|
||||||
|
|
||||||
$loop_time=new Benchmark;
|
$loop_time=new Benchmark;
|
||||||
$rows=0;
|
$rows=$estimated=$count=0;
|
||||||
for ($i=0 ; $i < $opt_medium_loop_count ; $i++)
|
for ($i=0 ; $i < $opt_medium_loop_count ; $i++)
|
||||||
{
|
{
|
||||||
|
$count++;
|
||||||
$rows+=fetch_all_rows($dbh,"select grp,count(distinct idn) from bench1 group by grp");
|
$rows+=fetch_all_rows($dbh,"select grp,count(distinct idn) from bench1 group by grp");
|
||||||
|
$end_time=new Benchmark;
|
||||||
|
last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$i+1,
|
||||||
|
$opt_medium_loop_count));
|
||||||
}
|
}
|
||||||
$end_time=new Benchmark;
|
print_time($estimated);
|
||||||
print "Time for count_distinct_group_on_key_parts ($i:$rows): " .
|
print " for count_distinct_group_on_key_parts ($count:$rows): " .
|
||||||
timestr(timediff($end_time, $loop_time),"all") . "\n";
|
timestr(timediff($end_time, $loop_time),"all") . "\n";
|
||||||
|
|
||||||
$loop_time=new Benchmark;
|
$loop_time=new Benchmark;
|
||||||
$rows=0;
|
$rows=$estimated=$count=0;
|
||||||
for ($i=0 ; $i < $opt_medium_loop_count ; $i++)
|
for ($i=0 ; $i < $opt_medium_loop_count ; $i++)
|
||||||
{
|
{
|
||||||
|
$count++;
|
||||||
$rows+=fetch_all_rows($dbh,"select grp,count(distinct rev_idn) from bench1 group by grp");
|
$rows+=fetch_all_rows($dbh,"select grp,count(distinct rev_idn) from bench1 group by grp");
|
||||||
|
$end_time=new Benchmark;
|
||||||
|
last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$i+1,
|
||||||
|
$opt_medium_loop_count));
|
||||||
}
|
}
|
||||||
$end_time=new Benchmark;
|
print_time($estimated);
|
||||||
print "Time for count_distinct_group ($i:$rows): " .
|
print " for count_distinct_group ($count:$rows): " .
|
||||||
timestr(timediff($end_time, $loop_time),"all") . "\n";
|
timestr(timediff($end_time, $loop_time),"all") . "\n";
|
||||||
|
|
||||||
$loop_time=new Benchmark;
|
$loop_time=new Benchmark;
|
||||||
$rows=0;
|
$rows=$estimated=$count=0;
|
||||||
for ($i=0 ; $i < $opt_medium_loop_count ; $i++)
|
for ($i=0 ; $i < $opt_medium_loop_count ; $i++)
|
||||||
{
|
{
|
||||||
|
$count++;
|
||||||
$rows+=fetch_all_rows($dbh,"select idn,count(distinct region) from bench1 group by idn");
|
$rows+=fetch_all_rows($dbh,"select idn,count(distinct region) from bench1 group by idn");
|
||||||
|
$end_time=new Benchmark;
|
||||||
|
last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$i+1,
|
||||||
|
$opt_medium_loop_count));
|
||||||
}
|
}
|
||||||
$end_time=new Benchmark;
|
print_time($estimated);
|
||||||
print "Time for count_distinct_big ($i:$rows): " .
|
print " for count_distinct_big ($count:$rows): " .
|
||||||
timestr(timediff($end_time, $loop_time),"all") . "\n";
|
timestr(timediff($end_time, $loop_time),"all") . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,8 +38,8 @@ if (my_b_write((file),(byte*) (from),param->ref_length)) \
|
|||||||
|
|
||||||
typedef struct st_buffpek { /* Struktur om sorteringsbuffrarna */
|
typedef struct st_buffpek { /* Struktur om sorteringsbuffrarna */
|
||||||
my_off_t file_pos; /* Where we are in the sort file */
|
my_off_t file_pos; /* Where we are in the sort file */
|
||||||
ha_rows count; /* Number of rows in table */
|
|
||||||
uchar *base,*key; /* key pointers */
|
uchar *base,*key; /* key pointers */
|
||||||
|
ha_rows count; /* Number of rows in table */
|
||||||
ulong mem_count; /* numbers of keys in memory */
|
ulong mem_count; /* numbers of keys in memory */
|
||||||
ulong max_keys; /* Max keys in buffert */
|
ulong max_keys; /* Max keys in buffert */
|
||||||
} BUFFPEK;
|
} BUFFPEK;
|
||||||
@ -98,7 +98,6 @@ ha_rows filesort(TABLE **table, SORT_FIELD *sortorder, uint s_length,
|
|||||||
BUFFPEK *buffpek;
|
BUFFPEK *buffpek;
|
||||||
ha_rows records;
|
ha_rows records;
|
||||||
uchar **sort_keys;
|
uchar **sort_keys;
|
||||||
gptr save_1,save_2;
|
|
||||||
IO_CACHE tempfile,*selected_records_file,*outfile;
|
IO_CACHE tempfile,*selected_records_file,*outfile;
|
||||||
SORTPARAM param;
|
SORTPARAM param;
|
||||||
DBUG_ENTER("filesort");
|
DBUG_ENTER("filesort");
|
||||||
@ -109,7 +108,6 @@ ha_rows filesort(TABLE **table, SORT_FIELD *sortorder, uint s_length,
|
|||||||
|
|
||||||
outfile= table[0]->io_cache;
|
outfile= table[0]->io_cache;
|
||||||
my_b_clear(&tempfile);
|
my_b_clear(&tempfile);
|
||||||
save_1=save_2=0;
|
|
||||||
buffpek= (BUFFPEK *) NULL; sort_keys= (uchar **) NULL; error= 1;
|
buffpek= (BUFFPEK *) NULL; sort_keys= (uchar **) NULL; error= 1;
|
||||||
maxbuffer=1;
|
maxbuffer=1;
|
||||||
param.ref_length= table[0]->file->ref_length;
|
param.ref_length= table[0]->file->ref_length;
|
||||||
@ -160,11 +158,6 @@ ha_rows filesort(TABLE **table, SORT_FIELD *sortorder, uint s_length,
|
|||||||
goto err;
|
goto err;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Reserve memory for IO_CACHE files */
|
|
||||||
if (! (save_1=my_malloc(DISK_BUFFER_SIZE,MYF(MY_WME))) ||
|
|
||||||
! (save_2=my_malloc(DISK_BUFFER_SIZE,MYF(MY_WME))))
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
memavl=sortbuff_size;
|
memavl=sortbuff_size;
|
||||||
while (memavl >= MIN_SORT_MEMORY)
|
while (memavl >= MIN_SORT_MEMORY)
|
||||||
{
|
{
|
||||||
@ -207,10 +200,6 @@ ha_rows filesort(TABLE **table, SORT_FIELD *sortorder, uint s_length,
|
|||||||
my_error(ER_OUTOFMEMORY,MYF(ME_ERROR+ME_WAITTANG),sortbuff_size);
|
my_error(ER_OUTOFMEMORY,MYF(ME_ERROR+ME_WAITTANG),sortbuff_size);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
my_free(save_1,MYF(0)); /* Free for later use */
|
|
||||||
my_free(save_2,MYF(0));
|
|
||||||
save_1=save_2=0;
|
|
||||||
|
|
||||||
param.sort_form= table[0];
|
param.sort_form= table[0];
|
||||||
param.end=(param.local_sortorder=sortorder)+s_length;
|
param.end=(param.local_sortorder=sortorder)+s_length;
|
||||||
if ((records=find_all_keys(¶m,select,sort_keys,buffpek,&maxbuffer,
|
if ((records=find_all_keys(¶m,select,sort_keys,buffpek,&maxbuffer,
|
||||||
@ -252,8 +241,6 @@ ha_rows filesort(TABLE **table, SORT_FIELD *sortorder, uint s_length,
|
|||||||
#endif
|
#endif
|
||||||
x_free((gptr) sort_keys);
|
x_free((gptr) sort_keys);
|
||||||
x_free((gptr) buffpek);
|
x_free((gptr) buffpek);
|
||||||
x_free(save_1);
|
|
||||||
x_free(save_2);
|
|
||||||
close_cached_file(&tempfile);
|
close_cached_file(&tempfile);
|
||||||
if (my_b_inited(outfile))
|
if (my_b_inited(outfile))
|
||||||
{
|
{
|
||||||
|
@ -60,6 +60,7 @@
|
|||||||
|
|
||||||
#define HA_BERKELEY_ROWS_IN_TABLE 10000 /* to get optimization right */
|
#define HA_BERKELEY_ROWS_IN_TABLE 10000 /* to get optimization right */
|
||||||
#define HA_BERKELEY_RANGE_COUNT 100
|
#define HA_BERKELEY_RANGE_COUNT 100
|
||||||
|
#define HA_BERKELEY_MAX_ROWS 10000000 /* Max rows in table */
|
||||||
|
|
||||||
const char *ha_berkeley_ext=".db";
|
const char *ha_berkeley_ext=".db";
|
||||||
bool berkeley_skip=0;
|
bool berkeley_skip=0;
|
||||||
@ -1615,12 +1616,13 @@ void ha_berkeley::update_auto_primary_key()
|
|||||||
ha_rows ha_berkeley::estimate_number_of_rows()
|
ha_rows ha_berkeley::estimate_number_of_rows()
|
||||||
{
|
{
|
||||||
ulonglong max_ident;
|
ulonglong max_ident;
|
||||||
|
ulonglong max_rows=table->max_rows ? table->max_rows : HA_BERKELEY_MAX_ROWS;
|
||||||
if (!hidden_primary_key)
|
if (!hidden_primary_key)
|
||||||
return INT_MAX32;
|
return (ha_rows) max_rows;
|
||||||
pthread_mutex_lock(&share->mutex);
|
pthread_mutex_lock(&share->mutex);
|
||||||
max_ident=share->auto_ident+EXTRA_RECORDS;
|
max_ident=share->auto_ident+EXTRA_RECORDS;
|
||||||
pthread_mutex_unlock(&share->mutex);
|
pthread_mutex_unlock(&share->mutex);
|
||||||
return (ha_rows) min(max_ident,(ulonglong) INT_MAX32);
|
return (ha_rows) min(max_ident,max_rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_BERKELEY_DB */
|
#endif /* HAVE_BERKELEY_DB */
|
||||||
|
@ -352,11 +352,6 @@ Item *create_func_to_days(Item* a)
|
|||||||
return new Item_func_to_days(a);
|
return new Item_func_to_days(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
Item *create_func_truncate (Item *a, Item *b)
|
|
||||||
{
|
|
||||||
return new Item_func_round(a,b,1);
|
|
||||||
}
|
|
||||||
|
|
||||||
Item *create_func_ucase(Item* a)
|
Item *create_func_ucase(Item* a)
|
||||||
{
|
{
|
||||||
return new Item_func_ucase(a);
|
return new Item_func_ucase(a);
|
||||||
|
@ -81,7 +81,6 @@ Item *create_func_tan(Item* a);;
|
|||||||
Item *create_func_time_format(Item *a, Item *b);
|
Item *create_func_time_format(Item *a, Item *b);
|
||||||
Item *create_func_time_to_sec(Item* a);
|
Item *create_func_time_to_sec(Item* a);
|
||||||
Item *create_func_to_days(Item* a);
|
Item *create_func_to_days(Item* a);
|
||||||
Item *create_func_truncate (Item *a, Item *b);
|
|
||||||
Item *create_func_ucase(Item* a);
|
Item *create_func_ucase(Item* a);
|
||||||
Item *create_func_version(void);
|
Item *create_func_version(void);
|
||||||
Item *create_func_weekday(Item* a);
|
Item *create_func_weekday(Item* a);
|
||||||
|
@ -1586,7 +1586,7 @@ String *Item_load_file::val_str(String *str)
|
|||||||
|
|
||||||
if (!(file_name= args[0]->val_str(str)) ||
|
if (!(file_name= args[0]->val_str(str)) ||
|
||||||
!(current_thd->master_access & FILE_ACL) ||
|
!(current_thd->master_access & FILE_ACL) ||
|
||||||
!my_stat(file_name->c_ptr(), &stat_info, MYF(MY_FAE)))
|
!my_stat(file_name->c_ptr(), &stat_info, MYF(MY_WME)))
|
||||||
goto err;
|
goto err;
|
||||||
if (!(stat_info.st_mode & S_IROTH))
|
if (!(stat_info.st_mode & S_IROTH))
|
||||||
{
|
{
|
||||||
|
@ -301,6 +301,7 @@ static SYMBOL symbols[] = {
|
|||||||
{ "TINYTEXT", SYM(TINYTEXT),0,0},
|
{ "TINYTEXT", SYM(TINYTEXT),0,0},
|
||||||
{ "TINYINT", SYM(TINYINT),0,0},
|
{ "TINYINT", SYM(TINYINT),0,0},
|
||||||
{ "TRAILING", SYM(TRAILING),0,0},
|
{ "TRAILING", SYM(TRAILING),0,0},
|
||||||
|
{ "TRUNCATE", SYM(TRUNCATE_SYM),0,0},
|
||||||
{ "TO", SYM(TO_SYM),0,0},
|
{ "TO", SYM(TO_SYM),0,0},
|
||||||
{ "TYPE", SYM(TYPE_SYM),0,0},
|
{ "TYPE", SYM(TYPE_SYM),0,0},
|
||||||
{ "UNION", SYM(UNION_SYM),0,0},
|
{ "UNION", SYM(UNION_SYM),0,0},
|
||||||
@ -442,7 +443,6 @@ static SYMBOL sql_functions[] = {
|
|||||||
{ "TIME_TO_SEC", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_time_to_sec)},
|
{ "TIME_TO_SEC", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_time_to_sec)},
|
||||||
{ "TO_DAYS", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_to_days)},
|
{ "TO_DAYS", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_to_days)},
|
||||||
{ "TRIM", SYM(TRIM),0,0},
|
{ "TRIM", SYM(TRIM),0,0},
|
||||||
{ "TRUNCATE", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_truncate )},
|
|
||||||
{ "UCASE", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ucase)},
|
{ "UCASE", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ucase)},
|
||||||
{ "UPPER", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ucase)},
|
{ "UPPER", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ucase)},
|
||||||
{ "UNIQUE_USERS", SYM(UNIQUE_USERS),0,0},
|
{ "UNIQUE_USERS", SYM(UNIQUE_USERS),0,0},
|
||||||
|
@ -70,8 +70,8 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd,TABLE **tables,uint count)
|
|||||||
thd->proc_info="Waiting for table";
|
thd->proc_info="Waiting for table";
|
||||||
pthread_mutex_unlock(&thd->mysys_var->mutex);
|
pthread_mutex_unlock(&thd->mysys_var->mutex);
|
||||||
|
|
||||||
while (global_read_lock && ! thd->killed ||
|
while (global_read_lock && ! thd->killed &&
|
||||||
thd->version != refresh_version)
|
thd->version == refresh_version)
|
||||||
{
|
{
|
||||||
(void) pthread_cond_wait(&COND_refresh,&LOCK_open);
|
(void) pthread_cond_wait(&COND_refresh,&LOCK_open);
|
||||||
}
|
}
|
||||||
|
127
sql/log.cc
127
sql/log.cc
@ -24,8 +24,6 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <m_ctype.h> // For test_if_number
|
#include <m_ctype.h> // For test_if_number
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MYSQL_LOG mysql_log,mysql_update_log,mysql_slow_log,mysql_bin_log;
|
MYSQL_LOG mysql_log,mysql_update_log,mysql_slow_log,mysql_bin_log;
|
||||||
extern I_List<i_string> binlog_do_db, binlog_ignore_db;
|
extern I_List<i_string> binlog_do_db, binlog_ignore_db;
|
||||||
|
|
||||||
@ -76,7 +74,7 @@ static int find_uniq_filename(char *name)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
MYSQL_LOG::MYSQL_LOG(): file(0),index_file(0),last_time(0),query_start(0),
|
MYSQL_LOG::MYSQL_LOG(): file(-1),index_file(-1),last_time(0),query_start(0),
|
||||||
name(0), log_type(LOG_CLOSED),write_error(0),inited(0),
|
name(0), log_type(LOG_CLOSED),write_error(0),inited(0),
|
||||||
no_rotate(0)
|
no_rotate(0)
|
||||||
{
|
{
|
||||||
@ -90,10 +88,10 @@ MYSQL_LOG::MYSQL_LOG(): file(0),index_file(0),last_time(0),query_start(0),
|
|||||||
MYSQL_LOG::~MYSQL_LOG()
|
MYSQL_LOG::~MYSQL_LOG()
|
||||||
{
|
{
|
||||||
if (inited)
|
if (inited)
|
||||||
{
|
{
|
||||||
(void) pthread_mutex_destroy(&LOCK_log);
|
(void) pthread_mutex_destroy(&LOCK_log);
|
||||||
(void) pthread_mutex_destroy(&LOCK_index);
|
(void) pthread_mutex_destroy(&LOCK_index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MYSQL_LOG::set_index_file_name(const char* index_file_name)
|
void MYSQL_LOG::set_index_file_name(const char* index_file_name)
|
||||||
@ -128,13 +126,14 @@ int MYSQL_LOG::generate_new_name(char *new_name, const char *log_name)
|
|||||||
void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
|
void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
|
||||||
const char *new_name)
|
const char *new_name)
|
||||||
{
|
{
|
||||||
|
MY_STAT tmp_stat;
|
||||||
|
char buff[512];
|
||||||
if (!inited)
|
if (!inited)
|
||||||
{
|
{
|
||||||
inited=1;
|
inited=1;
|
||||||
(void) pthread_mutex_init(&LOCK_log,NULL);
|
(void) pthread_mutex_init(&LOCK_log,NULL);
|
||||||
(void) pthread_mutex_init(&LOCK_index, NULL);
|
(void) pthread_mutex_init(&LOCK_index, NULL);
|
||||||
if(log_type_arg == LOG_BIN && *fn_ext(log_name))
|
if (log_type_arg == LOG_BIN && *fn_ext(log_name))
|
||||||
no_rotate = 1;
|
no_rotate = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,13 +148,11 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
|
|||||||
fn_format(index_file_name, name, mysql_data_home, ".index", 6);
|
fn_format(index_file_name, name, mysql_data_home, ".index", 6);
|
||||||
|
|
||||||
db[0]=0;
|
db[0]=0;
|
||||||
MY_STAT tmp_stat;
|
|
||||||
bool do_magic = ((log_type == LOG_BIN) && !my_stat(log_file_name,
|
bool do_magic = ((log_type == LOG_BIN) && !my_stat(log_file_name,
|
||||||
&tmp_stat, MYF(0)));
|
&tmp_stat, MYF(0)));
|
||||||
|
|
||||||
file=my_fopen(log_file_name,O_APPEND | O_WRONLY | O_BINARY,
|
if ((file=my_open(log_file_name,O_APPEND | O_WRONLY | O_BINARY,
|
||||||
MYF(MY_WME | ME_WAITTANG));
|
MYF(MY_WME | ME_WAITTANG)) < 0)
|
||||||
if (!file)
|
|
||||||
{
|
{
|
||||||
my_free(name,MYF(0));
|
my_free(name,MYF(0));
|
||||||
name=0;
|
name=0;
|
||||||
@ -165,21 +162,21 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
|
|||||||
|
|
||||||
if (log_type == LOG_NORMAL)
|
if (log_type == LOG_NORMAL)
|
||||||
{
|
{
|
||||||
|
char *end;
|
||||||
#ifdef __NT__
|
#ifdef __NT__
|
||||||
fprintf(file, "%s, Version: %s, started with:\nTCP Port: %d, Named Pipe: %s\n", my_progname, server_version, mysql_port, mysql_unix_port);
|
sprintf(buff, "%s, Version: %s, started with:\nTCP Port: %d, Named Pipe: %s\n", my_progname, server_version, mysql_port, mysql_unix_port);
|
||||||
#else
|
#else
|
||||||
fprintf(file, "%s, Version: %s, started with:\nTcp port: %d Unix socket: %s\n", my_progname,server_version,mysql_port,mysql_unix_port);
|
sprintf(buff, "%s, Version: %s, started with:\nTcp port: %d Unix socket: %s\n", my_progname,server_version,mysql_port,mysql_unix_port);
|
||||||
#endif
|
#endif
|
||||||
fprintf(file,"Time Id Command Argument\n");
|
end=strmov(strend(buff),"Time Id Command Argument\n");
|
||||||
(void) fflush(file);
|
my_write(file,buff,(uint) (end-buff),MYF(0));
|
||||||
}
|
}
|
||||||
else if (log_type == LOG_NEW)
|
else if (log_type == LOG_NEW)
|
||||||
{
|
{
|
||||||
time_t skr=time(NULL);
|
time_t skr=time(NULL);
|
||||||
struct tm tm_tmp;
|
struct tm tm_tmp;
|
||||||
localtime_r(&skr,&tm_tmp);
|
localtime_r(&skr,&tm_tmp);
|
||||||
|
sprintf(buff,"# %s, Version: %s at %02d%02d%02d %2d:%02d:%02d\n",
|
||||||
fprintf(file,"# %s, Version: %s at %02d%02d%02d %2d:%02d:%02d\n",
|
|
||||||
my_progname,server_version,
|
my_progname,server_version,
|
||||||
tm_tmp.tm_year % 100,
|
tm_tmp.tm_year % 100,
|
||||||
tm_tmp.tm_mon+1,
|
tm_tmp.tm_mon+1,
|
||||||
@ -187,7 +184,7 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
|
|||||||
tm_tmp.tm_hour,
|
tm_tmp.tm_hour,
|
||||||
tm_tmp.tm_min,
|
tm_tmp.tm_min,
|
||||||
tm_tmp.tm_sec);
|
tm_tmp.tm_sec);
|
||||||
(void) fflush(file);
|
my_write(file,buff,(uint) strlen(buff),MYF(0));
|
||||||
}
|
}
|
||||||
else if (log_type == LOG_BIN)
|
else if (log_type == LOG_BIN)
|
||||||
{
|
{
|
||||||
@ -198,25 +195,26 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
|
|||||||
// clean up if failed
|
// clean up if failed
|
||||||
// then if index_file has not been previously opened, try to open it
|
// then if index_file has not been previously opened, try to open it
|
||||||
// clean up if failed
|
// clean up if failed
|
||||||
if((do_magic && my_fwrite(file, (byte*)BINLOG_MAGIC, 4,
|
|
||||||
MYF(MY_NABP|MY_WME)) ||
|
if ((do_magic && my_write(file, (byte*) BINLOG_MAGIC, 4,
|
||||||
(!index_file &&
|
MYF(MY_NABP|MY_WME)) ||
|
||||||
!(index_file = my_fopen(index_file_name,O_APPEND | O_BINARY | O_RDWR,
|
(index_file < 0 &&
|
||||||
MYF(MY_WME))))))
|
(index_file = my_fopen(index_file_name,O_APPEND | O_BINARY | O_RDWR,
|
||||||
|
MYF(MY_WME))) < 0)))
|
||||||
{
|
{
|
||||||
my_fclose(file,MYF(MY_WME));
|
my_close(file,MYF(MY_WME));
|
||||||
my_free(name,MYF(0));
|
my_free(name,MYF(0));
|
||||||
name=0;
|
name=0;
|
||||||
file=0;
|
file= -1;
|
||||||
log_type=LOG_CLOSED;
|
log_type=LOG_CLOSED;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Start_log_event s;
|
Start_log_event s;
|
||||||
s.write(file);
|
s.write(file);
|
||||||
pthread_mutex_lock(&LOCK_index);
|
pthread_mutex_lock(&LOCK_index);
|
||||||
my_fseek(index_file, 0L, MY_SEEK_END, MYF(MY_WME));
|
my_seek(index_file, 0L, MY_SEEK_END, MYF(MY_WME));
|
||||||
fprintf(index_file, "%s\n", log_file_name);
|
my_write(index_file, log_file_name,strlen(log_file_name), MYF(0));
|
||||||
fflush(index_file);
|
my_write(index_file, "\n",1, MYF(0));
|
||||||
pthread_mutex_unlock(&LOCK_index);
|
pthread_mutex_unlock(&LOCK_index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -225,7 +223,7 @@ int MYSQL_LOG::get_current_log(LOG_INFO* linfo)
|
|||||||
{
|
{
|
||||||
pthread_mutex_lock(&LOCK_log);
|
pthread_mutex_lock(&LOCK_log);
|
||||||
strmake(linfo->log_file_name, log_file_name, sizeof(linfo->log_file_name));
|
strmake(linfo->log_file_name, log_file_name, sizeof(linfo->log_file_name));
|
||||||
linfo->pos = my_ftell(file, MYF(MY_WME));
|
linfo->pos = my_tell(file, MYF(MY_WME));
|
||||||
pthread_mutex_unlock(&LOCK_log);
|
pthread_mutex_unlock(&LOCK_log);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -235,63 +233,66 @@ int MYSQL_LOG::find_first_log(LOG_INFO* linfo, const char* log_name)
|
|||||||
{
|
{
|
||||||
// mutex needed because we need to make sure the file pointer does not move
|
// mutex needed because we need to make sure the file pointer does not move
|
||||||
// from under our feet
|
// from under our feet
|
||||||
if(!index_file) return LOG_INFO_INVALID;
|
if (index_file < 0) return LOG_INFO_INVALID;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
char* fname = linfo->log_file_name;
|
char* fname = linfo->log_file_name;
|
||||||
int log_name_len = (uint) strlen(log_name);
|
int log_name_len = (uint) strlen(log_name);
|
||||||
|
|
||||||
pthread_mutex_lock(&LOCK_index);
|
pthread_mutex_lock(&LOCK_index);
|
||||||
if(my_fseek(index_file, 0L, MY_SEEK_SET, MYF(MY_WME) ) == MY_FILEPOS_ERROR)
|
if (my_seek(index_file, 0L, MY_SEEK_SET, MYF(MY_WME) ) == MY_FILEPOS_ERROR)
|
||||||
|
{
|
||||||
|
error = LOG_INFO_SEEK;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
if (!fgets(fname, FN_REFLEN, index_file))
|
||||||
{
|
{
|
||||||
error = LOG_INFO_SEEK;
|
error = feof(index_file) ? LOG_INFO_EOF : LOG_INFO_IO;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(;;)
|
// if the log entry matches, empty string matching anything
|
||||||
|
if (!log_name_len ||
|
||||||
|
(fname[log_name_len] == '\n' &&
|
||||||
|
!memcmp(fname, log_name, log_name_len)))
|
||||||
{
|
{
|
||||||
if(!fgets(fname, FN_REFLEN, index_file))
|
if (log_name_len)
|
||||||
{
|
fname[log_name_len] = 0; // to kill \n
|
||||||
error = feof(index_file) ? LOG_INFO_EOF : LOG_INFO_IO;
|
else
|
||||||
goto err;
|
{
|
||||||
}
|
*(strend(fname) - 1) = 0;
|
||||||
|
}
|
||||||
// if the log entry matches, empty string matching anything
|
linfo->index_file_offset = my_tell(index_file, MYF(MY_WME));
|
||||||
if(!log_name_len || (fname[log_name_len] == '\n' && !memcmp(fname, log_name, log_name_len)))
|
break;
|
||||||
{
|
|
||||||
if(log_name_len)
|
|
||||||
fname[log_name_len] = 0; // to kill \n
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*(strend(fname) - 1) = 0;
|
|
||||||
}
|
|
||||||
linfo->index_file_offset = my_ftell(index_file, MYF(MY_WME));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
error = 0;
|
error = 0;
|
||||||
err:
|
err:
|
||||||
pthread_mutex_unlock(&LOCK_index);
|
pthread_mutex_unlock(&LOCK_index);
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int MYSQL_LOG::find_next_log(LOG_INFO* linfo)
|
int MYSQL_LOG::find_next_log(LOG_INFO* linfo)
|
||||||
{
|
{
|
||||||
// mutex needed because we need to make sure the file pointer does not move
|
// mutex needed because we need to make sure the file pointer does not move
|
||||||
// from under our feet
|
// from under our feet
|
||||||
if(!index_file) return LOG_INFO_INVALID;
|
if (!index_file) return LOG_INFO_INVALID;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
char* fname = linfo->log_file_name;
|
char* fname = linfo->log_file_name;
|
||||||
char* end ;
|
char* end ;
|
||||||
|
|
||||||
pthread_mutex_lock(&LOCK_index);
|
pthread_mutex_lock(&LOCK_index);
|
||||||
if(my_fseek(index_file, linfo->index_file_offset, MY_SEEK_SET, MYF(MY_WME) ) == MY_FILEPOS_ERROR)
|
if (my_fseek(index_file, linfo->index_file_offset, MY_SEEK_SET, MYF(MY_WME) ) == MY_FILEPOS_ERROR)
|
||||||
{
|
{
|
||||||
error = LOG_INFO_SEEK;
|
error = LOG_INFO_SEEK;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!fgets(fname, FN_REFLEN, index_file))
|
if (!fgets(fname, FN_REFLEN, index_file))
|
||||||
{
|
{
|
||||||
error = feof(index_file) ? LOG_INFO_EOF : LOG_INFO_IO;
|
error = feof(index_file) ? LOG_INFO_EOF : LOG_INFO_IO;
|
||||||
goto err;
|
goto err;
|
||||||
@ -310,11 +311,11 @@ err:
|
|||||||
// we assume that buf has at least FN_REFLEN bytes alloced
|
// we assume that buf has at least FN_REFLEN bytes alloced
|
||||||
void MYSQL_LOG::make_log_name(char* buf, const char* log_ident)
|
void MYSQL_LOG::make_log_name(char* buf, const char* log_ident)
|
||||||
{
|
{
|
||||||
if(inited)
|
if (inited)
|
||||||
{
|
{
|
||||||
int dir_len = dirname_length(log_file_name);
|
int dir_len = dirname_length(log_file_name);
|
||||||
int ident_len = (uint) strlen(log_ident);
|
int ident_len = (uint) strlen(log_ident);
|
||||||
if(dir_len + ident_len + 1 > FN_REFLEN)
|
if (dir_len + ident_len + 1 > FN_REFLEN)
|
||||||
{
|
{
|
||||||
buf[0] = 0;
|
buf[0] = 0;
|
||||||
return; // protection agains malicious buffer overflow
|
return; // protection agains malicious buffer overflow
|
||||||
@ -337,7 +338,7 @@ void MYSQL_LOG::new_file()
|
|||||||
{
|
{
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
if(no_rotate) // do not rotate logs that are marked non-rotatable
|
if (no_rotate) // do not rotate logs that are marked non-rotatable
|
||||||
return; // ( for binlog with constant name)
|
return; // ( for binlog with constant name)
|
||||||
|
|
||||||
char new_name[FN_REFLEN], *old_name=name;
|
char new_name[FN_REFLEN], *old_name=name;
|
||||||
@ -469,14 +470,14 @@ void MYSQL_LOG::write(Query_log_event* event_info)
|
|||||||
if (thd->insert_id_used)
|
if (thd->insert_id_used)
|
||||||
{
|
{
|
||||||
Intvar_log_event e((uchar)INSERT_ID_EVENT, thd->last_insert_id);
|
Intvar_log_event e((uchar)INSERT_ID_EVENT, thd->last_insert_id);
|
||||||
if(e.write(file))
|
if (e.write(file))
|
||||||
{
|
{
|
||||||
sql_print_error(ER(ER_ERROR_ON_WRITE), name, errno);
|
sql_print_error(ER(ER_ERROR_ON_WRITE), name, errno);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(thd->convert_set)
|
if (thd->convert_set)
|
||||||
{
|
{
|
||||||
char buf[1024] = "SET CHARACTER SET ";
|
char buf[1024] = "SET CHARACTER SET ";
|
||||||
char* p = strend(buf);
|
char* p = strend(buf);
|
||||||
@ -485,7 +486,7 @@ void MYSQL_LOG::write(Query_log_event* event_info)
|
|||||||
// just in case somebody wants it later
|
// just in case somebody wants it later
|
||||||
thd->query_length = (uint)(p - buf);
|
thd->query_length = (uint)(p - buf);
|
||||||
Query_log_event e(thd, buf);
|
Query_log_event e(thd, buf);
|
||||||
if(e.write(file))
|
if (e.write(file))
|
||||||
{
|
{
|
||||||
sql_print_error(ER(ER_ERROR_ON_WRITE), name, errno);
|
sql_print_error(ER(ER_ERROR_ON_WRITE), name, errno);
|
||||||
goto err;
|
goto err;
|
||||||
|
@ -130,7 +130,7 @@ extern "C" int gethostname(char *name, int namelen);
|
|||||||
|
|
||||||
#ifndef DBUG_OFF
|
#ifndef DBUG_OFF
|
||||||
static const char* default_dbug_option=IF_WIN("d:t:i:O,\\mysqld.trace",
|
static const char* default_dbug_option=IF_WIN("d:t:i:O,\\mysqld.trace",
|
||||||
"d:t:i:o,/tmp/mysqld.trace");
|
"d:t:i:o,/tmp/mysqld.trace");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __NT__
|
#ifdef __NT__
|
||||||
@ -156,7 +156,7 @@ static pthread_t select_thread;
|
|||||||
static pthread_t flush_thread; // Used when debugging
|
static pthread_t flush_thread; // Used when debugging
|
||||||
static bool opt_log,opt_update_log,opt_bin_log,opt_slow_log,opt_noacl,
|
static bool opt_log,opt_update_log,opt_bin_log,opt_slow_log,opt_noacl,
|
||||||
opt_disable_networking=0, opt_bootstrap=0,opt_skip_show_db=0,
|
opt_disable_networking=0, opt_bootstrap=0,opt_skip_show_db=0,
|
||||||
opt_ansi_mode=0,opt_myisam_log=0;
|
opt_ansi_mode=0,opt_myisam_log=0, opt_large_files=sizeof(my_off_t) > 4;
|
||||||
bool opt_sql_bin_update = 0, opt_log_slave_updates = 0;
|
bool opt_sql_bin_update = 0, opt_log_slave_updates = 0;
|
||||||
|
|
||||||
// if sql_bin_update is true, SQL_LOG_UPDATE and SQL_LOG_BIN are kept in sync, and are
|
// if sql_bin_update is true, SQL_LOG_UPDATE and SQL_LOG_BIN are kept in sync, and are
|
||||||
@ -576,8 +576,8 @@ void unireg_abort(int exit_code)
|
|||||||
{
|
{
|
||||||
if (exit_code)
|
if (exit_code)
|
||||||
sql_print_error("Aborting\n");
|
sql_print_error("Aborting\n");
|
||||||
(void) my_delete(pidfile_name,MYF(0)); // This may not always exist
|
|
||||||
clean_up(); /* purecov: inspected */
|
clean_up(); /* purecov: inspected */
|
||||||
|
(void) my_delete(pidfile_name,MYF(0)); // This may not always exist
|
||||||
exit(exit_code); /* purecov: inspected */
|
exit(exit_code); /* purecov: inspected */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2421,20 +2421,21 @@ struct show_var_st init_vars[]= {
|
|||||||
#endif
|
#endif
|
||||||
{"character_set", default_charset, SHOW_CHAR},
|
{"character_set", default_charset, SHOW_CHAR},
|
||||||
{"character_sets", (char*) &charsets_list, SHOW_CHAR_PTR},
|
{"character_sets", (char*) &charsets_list, SHOW_CHAR_PTR},
|
||||||
{"connect_timeout", (char*) &connect_timeout, SHOW_LONG},
|
|
||||||
{"concurrent_insert", (char*) &myisam_concurrent_insert, SHOW_MY_BOOL},
|
{"concurrent_insert", (char*) &myisam_concurrent_insert, SHOW_MY_BOOL},
|
||||||
|
{"connect_timeout", (char*) &connect_timeout, SHOW_LONG},
|
||||||
{"datadir", mysql_real_data_home, SHOW_CHAR},
|
{"datadir", mysql_real_data_home, SHOW_CHAR},
|
||||||
{"delay_key_write", (char*) &myisam_delay_key_write, SHOW_MY_BOOL},
|
{"delay_key_write", (char*) &myisam_delay_key_write, SHOW_MY_BOOL},
|
||||||
{"delayed_insert_limit", (char*) &delayed_insert_limit, SHOW_LONG},
|
{"delayed_insert_limit", (char*) &delayed_insert_limit, SHOW_LONG},
|
||||||
{"delayed_insert_timeout", (char*) &delayed_insert_timeout, SHOW_LONG},
|
{"delayed_insert_timeout", (char*) &delayed_insert_timeout, SHOW_LONG},
|
||||||
{"delayed_queue_size", (char*) &delayed_queue_size, SHOW_LONG},
|
{"delayed_queue_size", (char*) &delayed_queue_size, SHOW_LONG},
|
||||||
{"join_buffer_size", (char*) &join_buff_size, SHOW_LONG},
|
|
||||||
{"flush", (char*) &myisam_flush, SHOW_MY_BOOL},
|
{"flush", (char*) &myisam_flush, SHOW_MY_BOOL},
|
||||||
{"flush_time", (char*) &flush_time, SHOW_LONG},
|
{"flush_time", (char*) &flush_time, SHOW_LONG},
|
||||||
{"init_file", (char*) &opt_init_file, SHOW_CHAR_PTR},
|
{"init_file", (char*) &opt_init_file, SHOW_CHAR_PTR},
|
||||||
{"interactive_timeout", (char*) &net_interactive_timeout, SHOW_LONG},
|
{"interactive_timeout", (char*) &net_interactive_timeout, SHOW_LONG},
|
||||||
|
{"join_buffer_size", (char*) &join_buff_size, SHOW_LONG},
|
||||||
{"key_buffer_size", (char*) &keybuff_size, SHOW_LONG},
|
{"key_buffer_size", (char*) &keybuff_size, SHOW_LONG},
|
||||||
{"language", language, SHOW_CHAR},
|
{"language", language, SHOW_CHAR},
|
||||||
|
{"large_files_support", (char*) &opt_large_files, SHOW_BOOL},
|
||||||
#ifdef HAVE_MLOCKALL
|
#ifdef HAVE_MLOCKALL
|
||||||
{"locked_in_memory", (char*) &locked_in_memory, SHOW_BOOL},
|
{"locked_in_memory", (char*) &locked_in_memory, SHOW_BOOL},
|
||||||
#endif
|
#endif
|
||||||
@ -2457,12 +2458,15 @@ struct show_var_st init_vars[]= {
|
|||||||
{"myisam_recover_options", (char*) &myisam_recover_options_str, SHOW_CHAR_PTR},
|
{"myisam_recover_options", (char*) &myisam_recover_options_str, SHOW_CHAR_PTR},
|
||||||
{"myisam_sort_buffer_size", (char*) &myisam_sort_buffer_size, SHOW_LONG},
|
{"myisam_sort_buffer_size", (char*) &myisam_sort_buffer_size, SHOW_LONG},
|
||||||
{"net_buffer_length", (char*) &net_buffer_length, SHOW_LONG},
|
{"net_buffer_length", (char*) &net_buffer_length, SHOW_LONG},
|
||||||
|
{"net_read_timeout", (char*) &net_read_timeout, SHOW_LONG},
|
||||||
{"net_retry_count", (char*) &mysqld_net_retry_count, SHOW_LONG},
|
{"net_retry_count", (char*) &mysqld_net_retry_count, SHOW_LONG},
|
||||||
|
{"net_write_timeout", (char*) &net_write_timeout, SHOW_LONG},
|
||||||
{"pid_file", (char*) pidfile_name, SHOW_CHAR},
|
{"pid_file", (char*) pidfile_name, SHOW_CHAR},
|
||||||
{"port", (char*) &mysql_port, SHOW_INT},
|
{"port", (char*) &mysql_port, SHOW_INT},
|
||||||
{"protocol_version", (char*) &protocol_version, SHOW_INT},
|
{"protocol_version", (char*) &protocol_version, SHOW_INT},
|
||||||
{"record_buffer", (char*) &my_default_record_cache_size,SHOW_LONG},
|
{"record_buffer", (char*) &my_default_record_cache_size,SHOW_LONG},
|
||||||
{"server_id", (char*) &server_id, SHOW_LONG},
|
{"query_buffer_size", (char*) &query_buff_size, SHOW_LONG},
|
||||||
|
{"server_id", (char*) &server_id, SHOW_LONG},
|
||||||
{"skip_locking", (char*) &my_disable_locking, SHOW_MY_BOOL},
|
{"skip_locking", (char*) &my_disable_locking, SHOW_MY_BOOL},
|
||||||
{"skip_networking", (char*) &opt_disable_networking, SHOW_BOOL},
|
{"skip_networking", (char*) &opt_disable_networking, SHOW_BOOL},
|
||||||
{"skip_show_database", (char*) &opt_skip_show_db, SHOW_BOOL},
|
{"skip_show_database", (char*) &opt_skip_show_db, SHOW_BOOL},
|
||||||
@ -2471,11 +2475,11 @@ struct show_var_st init_vars[]= {
|
|||||||
{"sort_buffer", (char*) &sortbuff_size, SHOW_LONG},
|
{"sort_buffer", (char*) &sortbuff_size, SHOW_LONG},
|
||||||
{"table_cache", (char*) &table_cache_size, SHOW_LONG},
|
{"table_cache", (char*) &table_cache_size, SHOW_LONG},
|
||||||
{"table_type", (char*) &default_table_type_name, SHOW_CHAR_PTR},
|
{"table_type", (char*) &default_table_type_name, SHOW_CHAR_PTR},
|
||||||
|
{"thread_cache_size", (char*) &thread_cache_size, SHOW_LONG},
|
||||||
#ifdef HAVE_THR_SETCONCURRENCY
|
#ifdef HAVE_THR_SETCONCURRENCY
|
||||||
{"thread_concurrency", (char*) &concurrency, SHOW_LONG},
|
{"thread_concurrency", (char*) &concurrency, SHOW_LONG},
|
||||||
#endif
|
#endif
|
||||||
{"thread_stack", (char*) &thread_stack, SHOW_LONG},
|
{"thread_stack", (char*) &thread_stack, SHOW_LONG},
|
||||||
{"thread_cache_size", (char*) &thread_cache_size, SHOW_LONG},
|
|
||||||
#ifdef HAVE_TZNAME
|
#ifdef HAVE_TZNAME
|
||||||
{"timezone", time_zone, SHOW_CHAR},
|
{"timezone", time_zone, SHOW_CHAR},
|
||||||
#endif
|
#endif
|
||||||
@ -3394,7 +3398,7 @@ static int get_service_parameters()
|
|||||||
else if ( lstrcmp(szKeyValueName, TEXT("ShowDatabase")) == 0 )
|
else if ( lstrcmp(szKeyValueName, TEXT("ShowDatabase")) == 0 )
|
||||||
{
|
{
|
||||||
CHECK_KEY_TYPE( REG_DWORD, szKeyValueName );
|
CHECK_KEY_TYPE( REG_DWORD, szKeyValueName );
|
||||||
opt_disable_networking = !(*lpdwValue);
|
opt_skip_show_db = !(*lpdwValue);
|
||||||
}
|
}
|
||||||
else if ( lstrcmp(szKeyValueName, TEXT("HostnameCaching")) == 0 )
|
else if ( lstrcmp(szKeyValueName, TEXT("HostnameCaching")) == 0 )
|
||||||
{
|
{
|
||||||
|
@ -85,7 +85,7 @@ class MYSQL_LOG {
|
|||||||
public:
|
public:
|
||||||
private:
|
private:
|
||||||
pthread_mutex_t LOCK_log, LOCK_index;
|
pthread_mutex_t LOCK_log, LOCK_index;
|
||||||
FILE *file, *index_file;
|
File file, index_file;
|
||||||
time_t last_time,query_start;
|
time_t last_time,query_start;
|
||||||
char *name;
|
char *name;
|
||||||
enum_log_type log_type;
|
enum_log_type log_type;
|
||||||
|
@ -571,7 +571,7 @@ static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list)
|
|||||||
thread_count++;
|
thread_count++;
|
||||||
pthread_mutex_unlock(&LOCK_thread_count);
|
pthread_mutex_unlock(&LOCK_thread_count);
|
||||||
if (!(tmp->thd.db=my_strdup(table_list->db,MYF(MY_WME))) ||
|
if (!(tmp->thd.db=my_strdup(table_list->db,MYF(MY_WME))) ||
|
||||||
!(tmp->thd.query=my_strdup(table_list->real_name,MYF(MY_FAE))))
|
!(tmp->thd.query=my_strdup(table_list->real_name,MYF(MY_WME))))
|
||||||
{
|
{
|
||||||
delete tmp;
|
delete tmp;
|
||||||
thd->fatal_error=1;
|
thd->fatal_error=1;
|
||||||
@ -1323,7 +1323,8 @@ bool select_create::send_eof()
|
|||||||
{
|
{
|
||||||
VOID(pthread_mutex_lock(&LOCK_open));
|
VOID(pthread_mutex_lock(&LOCK_open));
|
||||||
mysql_unlock_tables(thd, lock);
|
mysql_unlock_tables(thd, lock);
|
||||||
hash_delete(&open_cache,(byte*) table);
|
if (!table->tmp_table)
|
||||||
|
hash_delete(&open_cache,(byte*) table);
|
||||||
lock=0; table=0;
|
lock=0; table=0;
|
||||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||||
}
|
}
|
||||||
@ -1341,7 +1342,8 @@ void select_create::abort()
|
|||||||
if (table)
|
if (table)
|
||||||
{
|
{
|
||||||
enum db_type table_type=table->db_type;
|
enum db_type table_type=table->db_type;
|
||||||
hash_delete(&open_cache,(byte*) table);
|
if (!table->tmp_table)
|
||||||
|
hash_delete(&open_cache,(byte*) table);
|
||||||
quick_rm_table(table_type,db,name);
|
quick_rm_table(table_type,db,name);
|
||||||
table=0;
|
table=0;
|
||||||
}
|
}
|
||||||
|
@ -34,19 +34,23 @@ class LEX_COLUMN;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum enum_sql_command {
|
enum enum_sql_command {
|
||||||
SQLCOM_SELECT,SQLCOM_CREATE_TABLE,SQLCOM_CREATE_INDEX,SQLCOM_ALTER_TABLE,
|
SQLCOM_SELECT, SQLCOM_CREATE_TABLE, SQLCOM_CREATE_INDEX, SQLCOM_ALTER_TABLE,
|
||||||
SQLCOM_UPDATE,SQLCOM_INSERT,SQLCOM_INSERT_SELECT,SQLCOM_DELETE,
|
SQLCOM_UPDATE, SQLCOM_INSERT, SQLCOM_INSERT_SELECT,
|
||||||
SQLCOM_DROP_TABLE,SQLCOM_DROP_INDEX,SQLCOM_SHOW_DATABASES,
|
SQLCOM_DELETE, SQLCOM_TRUNCATE, SQLCOM_DROP_TABLE, SQLCOM_DROP_INDEX,
|
||||||
SQLCOM_SHOW_TABLES,SQLCOM_SHOW_FIELDS,SQLCOM_SHOW_KEYS,
|
|
||||||
|
SQLCOM_SHOW_DATABASES, SQLCOM_SHOW_TABLES, SQLCOM_SHOW_FIELDS,
|
||||||
|
SQLCOM_SHOW_KEYS, SQLCOM_SHOW_VARIABLES, SQLCOM_SHOW_STATUS,
|
||||||
|
SQLCOM_SHOW_PROCESSLIST, SQLCOM_SHOW_MASTER_STAT, SQLCOM_SHOW_SLAVE_STAT,
|
||||||
|
SQLCOM_SHOW_GRANTS, SQLCOM_SHOW_CREATE,
|
||||||
|
|
||||||
SQLCOM_LOAD,SQLCOM_SET_OPTION,SQLCOM_LOCK_TABLES,SQLCOM_UNLOCK_TABLES,
|
SQLCOM_LOAD,SQLCOM_SET_OPTION,SQLCOM_LOCK_TABLES,SQLCOM_UNLOCK_TABLES,
|
||||||
SQLCOM_GRANT, SQLCOM_CHANGE_DB, SQLCOM_CREATE_DB, SQLCOM_DROP_DB,
|
SQLCOM_GRANT, SQLCOM_CHANGE_DB, SQLCOM_CREATE_DB, SQLCOM_DROP_DB,
|
||||||
SQLCOM_REPAIR, SQLCOM_REPLACE, SQLCOM_REPLACE_SELECT, SQLCOM_SHOW_VARIABLES,
|
SQLCOM_REPAIR, SQLCOM_REPLACE, SQLCOM_REPLACE_SELECT,
|
||||||
SQLCOM_SHOW_STATUS, SQLCOM_CREATE_FUNCTION, SQLCOM_DROP_FUNCTION,
|
SQLCOM_CREATE_FUNCTION, SQLCOM_DROP_FUNCTION,
|
||||||
SQLCOM_SHOW_PROCESSLIST,SQLCOM_REVOKE,SQLCOM_OPTIMIZE, SQLCOM_CHECK,
|
SQLCOM_REVOKE,SQLCOM_OPTIMIZE, SQLCOM_CHECK,
|
||||||
SQLCOM_FLUSH, SQLCOM_KILL, SQLCOM_SHOW_GRANTS, SQLCOM_ANALYZE,
|
SQLCOM_FLUSH, SQLCOM_KILL, SQLCOM_ANALYZE,
|
||||||
SQLCOM_ROLLBACK, SQLCOM_COMMIT, SQLCOM_SLAVE_START, SQLCOM_SLAVE_STOP,
|
SQLCOM_ROLLBACK, SQLCOM_COMMIT, SQLCOM_SLAVE_START, SQLCOM_SLAVE_STOP,
|
||||||
SQLCOM_BEGIN, SQLCOM_LOAD_MASTER_TABLE, SQLCOM_SHOW_CREATE,
|
SQLCOM_BEGIN, SQLCOM_LOAD_MASTER_TABLE, SQLCOM_CHANGE_MASTER,
|
||||||
SQLCOM_SHOW_MASTER_STAT, SQLCOM_SHOW_SLAVE_STAT, SQLCOM_CHANGE_MASTER,
|
|
||||||
SQLCOM_RENAME_TABLE, SQLCOM_BACKUP_TABLE, SQLCOM_RESTORE_TABLE,
|
SQLCOM_RENAME_TABLE, SQLCOM_BACKUP_TABLE, SQLCOM_RESTORE_TABLE,
|
||||||
SQLCOM_RESET
|
SQLCOM_RESET
|
||||||
};
|
};
|
||||||
|
@ -158,7 +158,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
|||||||
unpack_filename(name,ex->file_name);
|
unpack_filename(name,ex->file_name);
|
||||||
#ifndef __WIN__
|
#ifndef __WIN__
|
||||||
MY_STAT stat_info;
|
MY_STAT stat_info;
|
||||||
if (!my_stat(name,&stat_info,MYF(MY_FAE)))
|
if (!my_stat(name,&stat_info,MYF(MY_WME)))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
|
|
||||||
// the file must be:
|
// the file must be:
|
||||||
|
@ -71,6 +71,20 @@ static void init_signals(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static inline bool end_active_trans(THD *thd)
|
||||||
|
{
|
||||||
|
if (!(thd->options & OPTION_AUTO_COMMIT) ||
|
||||||
|
(thd->options & OPTION_BEGIN))
|
||||||
|
{
|
||||||
|
if (ha_commit(thd))
|
||||||
|
return 1;
|
||||||
|
thd->options&= ~OPTION_BEGIN;
|
||||||
|
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Check if user is ok
|
** Check if user is ok
|
||||||
** Updates:
|
** Updates:
|
||||||
@ -1143,7 +1157,7 @@ mysql_execute_command(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* ALTER TABLE ends previous transaction */
|
/* ALTER TABLE ends previous transaction */
|
||||||
if (!(thd->options & OPTION_AUTO_COMMIT) && ha_commit(thd))
|
if (end_active_trans(thd))
|
||||||
res= -1;
|
res= -1;
|
||||||
else
|
else
|
||||||
res= mysql_alter_table(thd, lex->db, lex->name,
|
res= mysql_alter_table(thd, lex->db, lex->name,
|
||||||
@ -1347,6 +1361,7 @@ mysql_execute_command(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SQLCOM_DELETE:
|
case SQLCOM_DELETE:
|
||||||
|
case SQLCOM_TRUNCATE:
|
||||||
{
|
{
|
||||||
if (check_access(thd,DELETE_ACL,tables->db,&tables->grant.privilege))
|
if (check_access(thd,DELETE_ACL,tables->db,&tables->grant.privilege))
|
||||||
goto error; /* purecov: inspected */
|
goto error; /* purecov: inspected */
|
||||||
@ -1354,11 +1369,12 @@ mysql_execute_command(void)
|
|||||||
goto error;
|
goto error;
|
||||||
// Set privilege for the WHERE clause
|
// Set privilege for the WHERE clause
|
||||||
tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege);
|
tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege);
|
||||||
res = mysql_delete(thd,tables,lex->where,lex->select_limit,
|
/* TRUNCATE ends previous transaction */
|
||||||
lex->lock_option, lex->options);
|
if (lex->sql_command == SQLCOM_TRUNCATE && end_active_trans(thd))
|
||||||
#ifdef DELETE_ITEMS
|
res= -1;
|
||||||
delete lex->where;
|
else
|
||||||
#endif
|
res = mysql_delete(thd,tables,lex->where,lex->select_limit,
|
||||||
|
lex->lock_option, lex->options);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SQLCOM_DROP_TABLE:
|
case SQLCOM_DROP_TABLE:
|
||||||
@ -1699,6 +1715,11 @@ mysql_execute_command(void)
|
|||||||
thd->server_status|= SERVER_STATUS_IN_TRANS;
|
thd->server_status|= SERVER_STATUS_IN_TRANS;
|
||||||
break;
|
break;
|
||||||
case SQLCOM_COMMIT:
|
case SQLCOM_COMMIT:
|
||||||
|
/*
|
||||||
|
We don't use end_active_trans() here to ensure that this works
|
||||||
|
even if there is a problem with the OPTION_AUTO_COMMIT flag
|
||||||
|
(Which of course should never happen...)
|
||||||
|
*/
|
||||||
thd->options&= ~OPTION_BEGIN;
|
thd->options&= ~OPTION_BEGIN;
|
||||||
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
||||||
if (!ha_commit(thd))
|
if (!ha_commit(thd))
|
||||||
|
@ -2725,7 +2725,7 @@ return_zero_rows(select_result *result,TABLE_LIST *tables,List<Item> &fields,
|
|||||||
{
|
{
|
||||||
for (TABLE_LIST *table=tables; table ; table=table->next)
|
for (TABLE_LIST *table=tables; table ; table=table->next)
|
||||||
mark_as_null_row(table->table); // All fields are NULL
|
mark_as_null_row(table->table); // All fields are NULL
|
||||||
if (having && having->val_int() == 0.0)
|
if (having && having->val_int() == 0)
|
||||||
send_row=0;
|
send_row=0;
|
||||||
}
|
}
|
||||||
if (!tables || !(result->send_fields(fields,1)))
|
if (!tables || !(result->send_fields(fields,1)))
|
||||||
@ -3204,6 +3204,7 @@ Field *create_tmp_field(TABLE *table,Item *item, Item::Type type,
|
|||||||
case Item::REAL_ITEM:
|
case Item::REAL_ITEM:
|
||||||
case Item::STRING_ITEM:
|
case Item::STRING_ITEM:
|
||||||
case Item::REF_ITEM:
|
case Item::REF_ITEM:
|
||||||
|
case Item::NULL_ITEM:
|
||||||
{
|
{
|
||||||
bool maybe_null=item->maybe_null;
|
bool maybe_null=item->maybe_null;
|
||||||
Field *new_field;
|
Field *new_field;
|
||||||
@ -4501,7 +4502,7 @@ end_send(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
|
|||||||
if (!end_of_records)
|
if (!end_of_records)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
if (join->having && join->having->val_int() == 0.0)
|
if (join->having && join->having->val_int() == 0)
|
||||||
DBUG_RETURN(0); // Didn't match having
|
DBUG_RETURN(0); // Didn't match having
|
||||||
if (join->procedure)
|
if (join->procedure)
|
||||||
error=join->procedure->send_row(*join->fields);
|
error=join->procedure->send_row(*join->fields);
|
||||||
@ -4541,7 +4542,7 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
|
|||||||
int error;
|
int error;
|
||||||
if (join->procedure)
|
if (join->procedure)
|
||||||
{
|
{
|
||||||
if (join->having && join->having->val_int() == 0.0)
|
if (join->having && join->having->val_int() == 0)
|
||||||
error= -1; // Didn't satisfy having
|
error= -1; // Didn't satisfy having
|
||||||
else
|
else
|
||||||
error=join->procedure->send_row(*join->fields) ? 1 : 0;
|
error=join->procedure->send_row(*join->fields) ? 1 : 0;
|
||||||
@ -4552,7 +4553,7 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
|
|||||||
{
|
{
|
||||||
if (!join->first_record)
|
if (!join->first_record)
|
||||||
clear_tables(join);
|
clear_tables(join);
|
||||||
if (join->having && join->having->val_int() == 0.0)
|
if (join->having && join->having->val_int() == 0)
|
||||||
error= -1; // Didn't satisfy having
|
error= -1; // Didn't satisfy having
|
||||||
else
|
else
|
||||||
error=join->result->send_data(*join->fields) ? 1 : 0;
|
error=join->result->send_data(*join->fields) ? 1 : 0;
|
||||||
@ -5111,7 +5112,7 @@ create_sort_index(JOIN_TAB *tab,ORDER *order,ha_rows select_limit)
|
|||||||
goto err; /* purecov: inspected */
|
goto err; /* purecov: inspected */
|
||||||
/* It's not fatal if the following alloc fails */
|
/* It's not fatal if the following alloc fails */
|
||||||
table->io_cache=(IO_CACHE*) my_malloc(sizeof(IO_CACHE),
|
table->io_cache=(IO_CACHE*) my_malloc(sizeof(IO_CACHE),
|
||||||
MYF(MY_FAE | MY_ZEROFILL));
|
MYF(MY_WME | MY_ZEROFILL));
|
||||||
table->status=0; // May be wrong if quick_select
|
table->status=0; // May be wrong if quick_select
|
||||||
|
|
||||||
// If table has a range, move it to select
|
// If table has a range, move it to select
|
||||||
|
@ -110,6 +110,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
|
|||||||
%token SLAVE
|
%token SLAVE
|
||||||
%token START_SYM
|
%token START_SYM
|
||||||
%token STOP_SYM
|
%token STOP_SYM
|
||||||
|
%token TRUNCATE_SYM
|
||||||
%token ROLLBACK_SYM
|
%token ROLLBACK_SYM
|
||||||
%token OPTIMIZE
|
%token OPTIMIZE
|
||||||
%token SHOW
|
%token SHOW
|
||||||
@ -492,9 +493,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
|
|||||||
|
|
||||||
%type <NONE>
|
%type <NONE>
|
||||||
query verb_clause create change select drop insert replace insert2
|
query verb_clause create change select drop insert replace insert2
|
||||||
insert_values update delete show describe load alter optimize flush
|
insert_values update delete truncate rename
|
||||||
|
show describe load alter optimize flush
|
||||||
reset begin commit rollback slave master_def master_defs
|
reset begin commit rollback slave master_def master_defs
|
||||||
repair restore backup analyze check rename
|
repair restore backup analyze check
|
||||||
field_list field_list_item field_spec kill
|
field_list field_list_item field_spec kill
|
||||||
select_item_list select_item values_list no_braces
|
select_item_list select_item values_list no_braces
|
||||||
limit_clause delete_limit_clause fields opt_values values
|
limit_clause delete_limit_clause fields opt_values values
|
||||||
@ -560,6 +562,7 @@ verb_clause:
|
|||||||
| set
|
| set
|
||||||
| slave
|
| slave
|
||||||
| show
|
| show
|
||||||
|
| truncate
|
||||||
| unlock
|
| unlock
|
||||||
| update
|
| update
|
||||||
| use
|
| use
|
||||||
@ -787,7 +790,7 @@ field_list_item:
|
|||||||
Lex->key_list.push_back(new Key($1,$2,Lex->col_list));
|
Lex->key_list.push_back(new Key($1,$2,Lex->col_list));
|
||||||
Lex->col_list.empty(); /* Alloced by sql_alloc */
|
Lex->col_list.empty(); /* Alloced by sql_alloc */
|
||||||
}
|
}
|
||||||
| opt_constraint FOREIGN KEY_SYM '(' key_list ')' references
|
| opt_constraint FOREIGN KEY_SYM opt_ident '(' key_list ')' references
|
||||||
{
|
{
|
||||||
Lex->col_list.empty(); /* Alloced by sql_alloc */
|
Lex->col_list.empty(); /* Alloced by sql_alloc */
|
||||||
}
|
}
|
||||||
@ -1553,7 +1556,8 @@ simple_expr:
|
|||||||
{ $$= new Item_func_trim($6,$4); }
|
{ $$= new Item_func_trim($6,$4); }
|
||||||
| TRIM '(' expr FROM expr ')'
|
| TRIM '(' expr FROM expr ')'
|
||||||
{ $$= new Item_func_trim($5,$3); }
|
{ $$= new Item_func_trim($5,$3); }
|
||||||
|
| TRUNCATE_SYM '(' expr ',' expr ')'
|
||||||
|
{ $$= new Item_func_round($3,$5,1); }
|
||||||
| UDA_CHAR_SUM '(' udf_expr_list ')'
|
| UDA_CHAR_SUM '(' udf_expr_list ')'
|
||||||
{
|
{
|
||||||
if ($3 != NULL)
|
if ($3 != NULL)
|
||||||
@ -2125,6 +2129,11 @@ opt_delete_option:
|
|||||||
QUICK { Lex->options|= OPTION_QUICK; }
|
QUICK { Lex->options|= OPTION_QUICK; }
|
||||||
| LOW_PRIORITY { Lex->lock_option= TL_WRITE_LOW_PRIORITY; }
|
| LOW_PRIORITY { Lex->lock_option= TL_WRITE_LOW_PRIORITY; }
|
||||||
|
|
||||||
|
truncate:
|
||||||
|
TRUNCATE_SYM TABLE_SYM table
|
||||||
|
{ Lex->sql_command= SQLCOM_TRUNCATE; Lex->options=0;
|
||||||
|
Lex->lock_option= current_thd->update_lock_default; }
|
||||||
|
|
||||||
/* Show things */
|
/* Show things */
|
||||||
|
|
||||||
show: SHOW { Lex->wild=0;} show_param
|
show: SHOW { Lex->wild=0;} show_param
|
||||||
@ -2513,6 +2522,7 @@ keyword:
|
|||||||
| STRING_SYM {}
|
| STRING_SYM {}
|
||||||
| TEMPORARY {}
|
| TEMPORARY {}
|
||||||
| TEXT_SYM {}
|
| TEXT_SYM {}
|
||||||
|
| TRUNCATE_SYM {}
|
||||||
| TIMESTAMP {}
|
| TIMESTAMP {}
|
||||||
| TIME_SYM {}
|
| TIME_SYM {}
|
||||||
| TYPE_SYM {}
|
| TYPE_SYM {}
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
|
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This library is free software; you can redistribute it and/or
|
||||||
it under the terms of the GNU General Public License as published by
|
modify it under the terms of the GNU Library General Public
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
License as published by the Free Software Foundation; either
|
||||||
(at your option) any later version.
|
version 2 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
GNU General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU Library General Public
|
||||||
along with this program; if not, write to the Free Software
|
License along with this library; if not, write to the Free
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||||
|
MA 02111-1307, USA */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Note that we can't have assertion on file descriptors; The reason for
|
Note that we can't have assertion on file descriptors; The reason for
|
||||||
@ -31,6 +32,9 @@
|
|||||||
#include <my_sys.h>
|
#include <my_sys.h>
|
||||||
#include <my_net.h>
|
#include <my_net.h>
|
||||||
#include <m_string.h>
|
#include <m_string.h>
|
||||||
|
#ifdef HAVE_POLL
|
||||||
|
#include <sys/poll.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__EMX__)
|
#if defined(__EMX__)
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
@ -398,4 +402,26 @@ void vio_in_addr(Vio *vio, struct in_addr *in)
|
|||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Return 0 if there is data to be read */
|
||||||
|
|
||||||
|
my_bool vio_poll_read(Vio *vio,uint timeout)
|
||||||
|
{
|
||||||
|
#ifndef HAVE_POLL
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
|
struct pollfd fds;
|
||||||
|
int res;
|
||||||
|
DBUG_ENTER("vio_poll");
|
||||||
|
fds.fd=vio->sd;
|
||||||
|
fds.events=POLLIN;
|
||||||
|
fds.revents=0;
|
||||||
|
if ((res=poll(&fds,1,(int) timeout*1000)) <= 0)
|
||||||
|
{
|
||||||
|
DBUG_RETURN(res < 0 ? 0 : 1); /* Don't return 1 on errors */
|
||||||
|
}
|
||||||
|
DBUG_RETURN(fds.revents & POLLIN ? 0 : 1);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* HAVE_VIO */
|
#endif /* HAVE_VIO */
|
||||||
|
@ -31,12 +31,12 @@ strstr:
|
|||||||
! if (*str++ == *search) {
|
! if (*str++ == *search) {
|
||||||
! i=(char*) str; j=(char*) search+1;
|
! i=(char*) str; j=(char*) search+1;
|
||||||
|
|
||||||
ldsb [%o1],%g6 ! g6= First char of search
|
ldsb [%o1],%o2 ! o2= First char of search
|
||||||
.top:
|
.top:
|
||||||
ldsb [%o0],%g3 ! g3= First char of rest of str
|
ldsb [%o0],%g3 ! g3= First char of rest of str
|
||||||
cmp %g3,0
|
cmp %g3,0
|
||||||
be .abort ! Found end null ;
|
be .abort ! Found end null ;
|
||||||
cmp %g3,%g6
|
cmp %g3,%o2
|
||||||
bne .top
|
bne .top
|
||||||
add %o0,1,%o0
|
add %o0,1,%o0
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user