diff options
41 files changed, 376 insertions, 265 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi index 963138ebc78..3b4e1ff5eaf 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -417,6 +417,7 @@ Functions for use in @code{SELECT} and @code{WHERE} clauses * SHOW VARIABLES:: * SHOW PROCESSLIST:: * SHOW GRANTS:: +* SHOW CREATE TABLE:: MySQL table types @@ -5004,12 +5005,11 @@ and that provides output about what is happening. @xref{Debugging server}. @item -If your client programs are using threads, you need to compile the -@strong{MySQL} client library to be thread safe with -@code{--with-thread-safe-client}; this forces the library to use thread -safe functions calls for some functions that are not thread safe by -default. You pay a very small performance penalty by doing this, but -generally it's quite safe to use this option. +If your client programs are using threads, you need to also compile a +thread safe version of the @strong{MySQL} client library with the +@code{--with-thread-safe-client} configure options. This will create a +@code{libmysqlclient_r} library with which you should link your threaded +applications. @xref{Thread-safe clients}. @item Options that pertain to particular systems can be found in the @@ -18295,6 +18295,7 @@ commands to examine and kill threads. @findex SHOW PROCESSLIST @findex SHOW TABLE STATUS @findex SHOW GRANTS +@findex SHOW CREATE TABLE @node SHOW, EXPLAIN, KILL, Reference @section @code{SHOW} syntax (Get information about tables, columns,...) @@ -18308,6 +18309,7 @@ or SHOW STATUS [LIKE wild] or SHOW VARIABLES [LIKE wild] or SHOW [FULL] PROCESSLIST or SHOW GRANTS FOR user +or SHOW CREATE TABLE table_name @end example @code{SHOW} provides information about databases, tables, columns or @@ -18328,6 +18330,7 @@ and @samp{_} wildcard characters. * SHOW VARIABLES:: * SHOW PROCESSLIST:: * SHOW GRANTS:: +* SHOW CREATE TABLE:: @end menu @node SHOW DATABASE INFO, SHOW TABLE STATUS, SHOW, SHOW @@ -18897,7 +18900,7 @@ threads. Otherwise, you can see only your own threads. @xref{KILL, , @code{KILL}}. If you don't use the the @code{FULL} option, then only the first 100 characters of each query will be shown. -@node SHOW GRANTS, , SHOW PROCESSLIST, SHOW +@node SHOW GRANTS,SHOW CREATE TABLE , SHOW PROCESSLIST, SHOW @subsection SHOW GRANTS (privileges) for a user @code{SHOW GRANTS FOR user} lists the grant commands that must be issued to @@ -18912,6 +18915,19 @@ mysql> SHOW GRANTS FOR root@@localhost; +---------------------------------------------------------------------+ @end example +@node SHOW CREATE TABLE,,SHOW GRANTS, SHOW +@subsection SHOW CREATE TABLE +Shows a @code{CREATE TABLE} statement that will create the given table +@example +mysql> show create table foo; ++-------+-------------------------------------------------------------------------------------+ +| Table | Create Table | ++-------+-------------------------------------------------------------------------------------+ +| foo | create table foo(n int(11) default NULL auto_increment,primary key (n)) type=MyISAM | ++-------+-------------------------------------------------------------------------------------+ + +@end example + @findex EXPLAIN @findex SELECT, optimizing @node EXPLAIN, DESCRIBE, SHOW, Reference @@ -19266,6 +19282,7 @@ The @code{SHOW} statement provides similar information. @xref{SHOW, , @code{SHOW}}. + @findex BEGIN @findex COMMIT @findex ROLLBACK @@ -23197,16 +23214,22 @@ Below is a quick HOWTO on how to set up replication on your current system: @itemize @bullet @item Upgrade both slave and master to 3.23.15 or higher. We recommend that -you use the latest 3.23 version on both the slave and the master. While +you always use the latest 3.23 version on both the slave and the master. While 3.23 is in beta, the versions may be not backwards compatible. In -addition, the newer version will fix some bugs and add new features. +addition, the newer version will fix some bugs and add new features. Please, do not report bugs until you have verified that the problem is present in +the latest release. @item Set up special replication user(s) on the master with the @code{FILE} privilege and permission to connect from all the slaves. If the user is only doing replication, you don't need to grant him other privileges. @item Take a snapshot of all the tables/databases on the master that could -possibly be involved in the update queries before taking the next step +possibly be involved in the update queries before taking the next step. +Starting in version 3.23.21, there is a command that allows you to +take a snapshot of a table on the master and copy it to the slave, called +@code{LOAD TABLE FROM MASTER}. Until 3.23.23, though, it has a serious +bug, and we recommend that you should not use it until you have upgraded . + @item In @code{my.cnf} on the master add @code{log-bin} and restart it. Make sure there are no important updates to the master between the time you @@ -23272,7 +23295,9 @@ specify this with @code{master-port} parameter in @code{my.cnf} . In 3.23.15,all of the tables and databases will be replicated. Starting in 3.23.16, you can restrict replication to a set of databases with @code{replicate-do-db} directives in @code{my.cnf} or just excluse a set -of databases with @code{replicate-ignore-db}. +of databases with @code{replicate-ignore-db}. Note that up until +3.23.23 there was a bug that did not properly deal with @code{LOAD DATA +INFILE} if you did it in a database that was excluded from replication. @item Starting in 3.23.16, @code{SET SQL_LOG_BIN = 0} will turn off replication (binary) logging on the master, and @code{SET SQL_LOG_BIN = @@ -23292,6 +23317,12 @@ and @code{FLUSH SLAVE} commands @item Starting in 3.23.21 you can use LOAD TABLE FROM MASTER for network backup and to set up replication initially. +@item +Starting in 3.23.23, you can change masters with @code{CHANGE MASTER +TO } +@item +Starting in 3.23.23, you tell the master that updates in certain +databases should not be logged to the binary log with @code{binlog-ignore-db} @end itemize @node Replication Options, Replication SQL, Replication Features, Replication @@ -23341,6 +23372,12 @@ automatically set @code{SQL_LOG_UPDATE} to the same value and vice versa. @tab Master @tab @code{sql-bin-update-same} @item @code{log-slave-updates} @tab Tells the slave to log the updates from the slave thread to the binary log. Off by default. You will need to turn it on if you plan to daisy-chain the slaves @tab Slave @tab @code{log-slave-updates} +@item @code{binlog-do-db} @tab Tells the master it should log updates +for the specified database, and exclude all others not explicitly +mentioned. @tab Master @tab @code{binlog-do-db=some_database} +@item @code{binlog-ignore-db} @tab Tells the master that updates to the given database +should not be logged to the binary log @tab Master @tab +@code{binlog-ignore-db=some_database} @end multitable @@ -23359,6 +23396,31 @@ summary of commands: @item @code{FLUSH MASTER} @tab Deletes all binary logs listed in the inded file, resetting the binlog index file to be empty. @tab Master @item @code{FLUSH SLAVE} @tab Makes the slave forget its replication position in the master logs @tab Slave @item @code{LOAD TABLE tblname FROM MASTER} @tab Downloads a copy of the table from master to the slave @tab Slave +@item @code{CHANGE MASTER TO master_def_list} @tab Changes the master parameters +to the values specified in @code{master_def_list} and restarts the slave thread. +@code{master_def_list} is a comma-separated list of @code{master_def} where +@code{master_def} is one of the following: @code{MASTER_HOST}, +@code{MASTER_USER}, @code{MASTER_PASSWORD}, @code{MASTER_PORT}, +@code{MASTER_CONNECT_RETRY}, @code{MASTER_LOG_FILE}, @code{MASTER_LOG_POS}. +Example: @code{CHANGE MASTER TO MASTER_HOST='master2.mycompany.com', +MASTER_USER='replication', MASTER_PASSWORD='bigs3cret', MASTER_PORT=3306;}. You +only need to speficy the values that need to be changed. The values that you +omit will stay the same with the exception of when you change the host or the +port. In that case, the slave will assume that since you are connecting to a +different host or a different port, the master is different, therefore, the old +values of log and position are not any more applicable, and will automatically +reset them to empty string and 0 respectively ( the start values). Note that +if you restart the slave, it will remember its last master. If this is not desirable, +you should delete @code{master.info} file before restarting, and the slave will read +its master from @code{my.cnf} or command line. + @tab Slave +@item @code{SHOW MASTER STATUS} @tab Provides status info on the binlog of the +master @tab Master +@item @code{SHOW SLAVE STATUS} @tab Provides status info on essential parameters +of the slave thread @tab Slave + + + @end multitable @cindex Performance @@ -30152,24 +30214,8 @@ The @strong{MySQL} server shrinks each communication buffer to the buffer associated with a connection is not decreased until the connection is closed, at which time client memory is reclaimed. -If you are programming with threads, you should compile the -@strong{MySQL} C API with @code{--with-thread-safe-client}. This will make -the C API thread safe per connection. You can let two threads share the same -connection as long as you do the following: - -@table @asis -@item -Two threads can't send a query to the @strong{MySQL} at the same time on -the same connection. In particular you have to ensure that between a -@code{mysql_query()} and @code{mysql_store_result()} no other thread is using -the same connection. -@item -Many threads can access different result sets that are retrieved with -@code{mysql_store_result()}. -@item -If you use @code{mysql_use_result}, you have to ensure that no other thread -is asking anything on the same connection until the result set is closed. -@end table +For programming with threads, consult the 'how to make a thread safe +client' chapter. @xref{Thread-safe clients}. @node C API datatypes, C API function overview, C, Clients @section C API datatypes @@ -32820,18 +32866,21 @@ have your own alarm that can break a long read to a server. If you install an interrupt handlers for the @code{SIGPIPE} interrupt, the socket handling should be thread safe. -In the standard binaries we distribute on our web site, the client libraries -are not normally compiled with the thread safe option. +In the older binaries we distribute on our web site, the client +libraries are not normally compiled with the thread safe option (the +windows binaries are however by default compiled to be thread safe). +Newer binary distributions should however have both a normal and a +threadsafe client library. To get a really thread-safe client where you can interrupt the client from other threads and set timeouts when talking with the MySQL server, you should use the @code{-lmysys}, @code{-lstring} and @code{-ldbug} libraries and the @code{net_serv.o} code that the server uses. -If you don't need interrupts or timeouts you can just compile the client -library @code{(mysqlclient)} to be thread safe and use this. In this -case you don't have to worry about the @code{net_serv.o} object file or -the other @strong{MySQL} libraries. +If you don't need interrupts or timeouts you can just compile a tread +safe client library @code{(mysqlclient_r)} and use this. @xref{C,, +MySQL C API}. In this case you don't have to worry about the +@code{net_serv.o} object file or the other @strong{MySQL} libraries. When using a threaded client and you want to use timeouts and interrupts, you can make great use of the routines in the @file{thr_alarm.c} file. @@ -32849,36 +32898,43 @@ To make @code{mysql_real_connect()} thread-safe, you must recompile the client library with this command: @example -shell> ./configure --enable-thread-safe-client +shell> ./configure --with-thread-safe-client @end example -This will ensure that the client library will use the header files required -for thread safe programs and also that @code{mysql_real_connect()} will use -a thread safe version of the @code{gethostbyname()} call. - -You may get some errors because of undefined symbols when linking the -standard client, because the pthread libraries are not included by -default. +This will create a thread safe client library @code{libmysqlclient_r}. +@code{--with-thread-safe-client}. This library is is thread safe per +connection. You can let two threads share the same connection as long +as you do the following: -The resulting @file{libmysqlclient.a} library is now thread-safe. What this -means is that client code is thread-safe as long as two threads don't query -the same connection handle returned by @code{mysql_real_connect()} at the -same time; the client/server protocol allows only one request at a time on a -given connection. If you want to use multiple threads on the same -connection, you must have a mutex lock around your @code{mysql_query()} and +@table @asis +@item +Two threads can't send a query to the @strong{MySQL} at the same time on +the same connection. In particular you have to ensure that between a +@code{mysql_query()} and @code{mysql_store_result()} no other thread is using +the same connection. +@item +Many threads can access different result sets that are retrieved with +@code{mysql_store_result()}. +@item +If you use @code{mysql_use_result}, you have to ensure that no other thread +is asking anything on the same connection until the result set is closed. +However, it really is best for threaded clients that share the same +connection to use @code{mysql_use_result()}. +@item +If you want to use multiple threads on the same connection, you must +have a mutex lock around your @code{mysql_query()} and @code{mysql_store_result()} call combination. Once @code{mysql_store_result()} is ready, the lock can be released and other -threads may query the same connection. (In other words, different threads -can use different @code{MYSQL_RES} pointers that were created with -@code{mysql_store_result()}, as long as they use the proper locking -protocol.) If you program with POSIX threads, you can use -@code{pthread_mutex_lock()} and @code{pthread_mutex_unlock()} to establish -and release a mutex lock. - -If you used @code{mysql_use_result()} rather than @code{mysql_store_result()}, -the lock would need to surround @code{mysql_use_result()} and the calls -to @code{mysql_fetch_row()}. However, it really is best for threaded -clients not to use @code{mysql_use_result()}. +threads may query the same connection. +@item +If you program with POSIX threads, you can use +@code{pthread_mutex_lock()} and @code{pthread_mutex_unlock()} to +establish and release a mutex lock. +@end table + +You may get some errors because of undefined symbols when linking your +client with @code{mysqlclient_r}; In most cases this is because you haven't +included the thread libraries on the link/compile line. @node Perl, Eiffel, C API functions, Clients @section MySQL Perl API @@ -34774,9 +34830,8 @@ The @strong{MySQL} GUI client homepage. By Sinisa at MySQL AB. An administration tool for the @strong{MySQL} server using QT / KDE. Tested only on Linux. -@item @uref{http://www.mysql.com/Downloads/Contrib/mysql-admin-using-java+swing.tar.gz, Java client -using Swing} By Fredy Fischer, @email{se-afs@@dial.eunet.ch}. You can -always find the latest version +@item @uref{http://www.mysql.com/Downloads/Contrib/mysql-admin-using-java+swing.tar.gz, Java client using Swing} By Fredy Fischer, @email{se-afs@@dial.eunet.ch}. +You can always find the latest version @uref{http://www.trash.net/~ffischer/admin/index.html, here}. @item @uref{http://www.mysql.com/Downloads/Contrib/mysqlwinadmn.zip, mysqlwinadmn.zip} @@ -34798,6 +34853,14 @@ URL @url{http://www.it-netservice.de/pages/software/index.html}. Home page for this can be found at: @uref{http://www.artronic.hr}. @item @uref{http://www.mysql.com/Downloads/Win32/W9xstop.zip,Utility from Artronic to stop MySQL on win9x} +@item @uref{http://dbtools.vila.bol.com.br/, Dbtools} +A tool to manage @strong{MySQL} databases. Currently only for Win32. +Some features: +@itemize @bullet +@item manage servers, databases, tables, columns, indexes and users +@item import wizard to import structure and data from a MS Access, MS Excel, Dbase, FoxPro, Paradox and ODBC Databases. +@end itemize + @item @uref{http://www.mysql.com/Downloads/Contrib/xmysqladmin-1.0.tar.gz, xmysqladmin-1.0.tar.gz} An X based front end to the @strong{MySQL} database engine. It allows reloads, status check, process control, myisamchk, grant/revoke privileges, @@ -35524,6 +35587,9 @@ though, so 3.23 is not released as a stable version yet. @appendixsubsec Changes in release 3.23.23 @itemize @bullet @item +Updated mysqlhotcopy to use the new @code{FLUSH TABLES table_list} syntax. Only +tables which are being backed up are flushed now. +@item Changed behavior of @code{--enable-thread-safe-client} so that both non-threaded (@code{-lmysqlclient}) and threaded (@code{-lmysqlclient_r}) libraries are built. Users who linked diff --git a/Docs/net_doc.txt b/Docs/net_doc.txt index e79ed9b5711..8a25ef41d06 100644 --- a/Docs/net_doc.txt +++ b/Docs/net_doc.txt @@ -1,6 +1,7 @@ MySQL Client - Server Protocol Ducumentation + Introduction ------------ diff --git a/client/sql_string.cc b/client/sql_string.cc index 5c3e1068649..67ce0f6ff54 100644 --- a/client/sql_string.cc +++ b/client/sql_string.cc @@ -1,6 +1,6 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - This library is free software; you can redistribute it and/or + This program file is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. @@ -127,7 +127,7 @@ bool String::set(double num,uint decimals) if (decimals >= NOT_FIXED_DEC) { sprintf(buff,"%.14g",num); // Enough for a DATETIME - return copy(buff,strlen(buff)); + return copy(buff, (uint32) strlen(buff)); } #ifdef HAVE_FCONVERT int decpt,sign; @@ -142,7 +142,7 @@ bool String::set(double num,uint decimals) buff[0]='-'; pos=buff; } - return copy(pos,strlen(pos)); + return copy(pos,(uint32) strlen(pos)); } if (alloc((uint32) ((uint32) decpt+3+decimals))) return TRUE; @@ -186,12 +186,13 @@ end: str_length=(uint32) (to-Ptr); return FALSE; #else -#ifdef HAVE_SNPRINTF_ - snprintf(buff,sizeof(buff), "%.*f",(int) decimals,num); +#ifdef HAVE_SNPRINTF + buff[sizeof(buff)-1]=0; // Safety + snprintf(buff,sizeof(buff)-1, "%.*f",(int) decimals,num); #else sprintf(buff,"%.*f",(int) decimals,num); #endif - return copy(buff,strlen(buff)); + return copy(buff,(uint32) strlen(buff)); #endif } @@ -260,7 +261,7 @@ bool String::append(const String &s) bool String::append(const char *s,uint32 arg_length) { if (!arg_length) // Default argument - arg_length=strlen(s); + arg_length= (uint32) strlen(s); if (realloc(str_length+arg_length)) return TRUE; memcpy(Ptr+str_length,s,arg_length); @@ -268,6 +269,19 @@ bool String::append(const char *s,uint32 arg_length) return FALSE; } +bool String::append(FILE* file, uint32 arg_length, myf my_flags) +{ + if (realloc(str_length+arg_length)) + return TRUE; + if (my_fread(file, (byte*) Ptr + str_length, arg_length, my_flags)) + { + shrink(str_length); + return TRUE; + } + str_length+=arg_length; + return FALSE; +} + uint32 String::numchars() { #ifdef USE_MB @@ -305,7 +319,7 @@ int String::charpos(int i,uint32 offset) if ( INT_MAX32-i <= (int) (mbstr-Ptr-offset)) return INT_MAX32; else - return (mbstr-Ptr-offset)+i; + return (int) ((mbstr-Ptr-offset)+i); } else #endif @@ -317,7 +331,7 @@ int String::strstr(const String &s,uint32 offset) if (s.length()+offset <= str_length) { if (!s.length()) - return offset; // Empty string is always found + return ((int) offset); // Empty string is always found register const char *str = Ptr+offset; register const char *search=s.ptr(); @@ -587,6 +601,7 @@ static int wild_case_compare(const char *str,const char *str_end, #ifdef USE_MB const char* mb = wildstr; int mblen; + LINT_INIT(mblen); if (use_mb_flag) mblen = my_ismbchar(default_charset_info, wildstr, wildend); #endif diff --git a/client/sql_string.h b/client/sql_string.h index 56a0a9b4eb2..8711cf314ad 100644 --- a/client/sql_string.h +++ b/client/sql_string.h @@ -36,7 +36,7 @@ public: String(uint32 length_arg) { alloced=0; Alloced_length=0; (void) real_alloc(length_arg); } String(const char *str) - { Ptr=(char*) str; str_length=strlen(str); Alloced_length=0; alloced=0;} + { Ptr=(char*) str; str_length=(uint) strlen(str); Alloced_length=0; alloced=0;} String(const char *str,uint32 len) { Ptr=(char*) str; str_length=len; Alloced_length=0; alloced=0;} String(char *str,uint32 len) @@ -45,7 +45,7 @@ public: { Ptr=str.Ptr ; str_length=str.str_length ; Alloced_length=str.Alloced_length; alloced=0; } - static void *operator new(size_t size) { return (void*) sql_alloc(size); } + static void *operator new(size_t size) { return (void*) sql_alloc((uint) size); } static void operator delete(void *ptr_arg,size_t size) /*lint -e715 */ { sql_element_free(ptr_arg); } ~String() { free(); } @@ -123,7 +123,7 @@ public: if (arg_length < Alloced_length) { char *new_ptr; - if (!(new_ptr=my_realloc(Ptr,arg_length,MYF(0)))) + if (!(new_ptr=(char*) my_realloc(Ptr,arg_length,MYF(0)))) { (void) my_free(Ptr,MYF(0)); real_alloc(arg_length); @@ -152,6 +152,7 @@ public: bool copy(const char *s,uint32 arg_length); // Allocate new string bool append(const String &s); bool append(const char *s,uint32 arg_length=0); + bool append(FILE* file, uint32 arg_length, myf my_flags); int strstr(const String &search,uint32 offset=0); // Returns offset to substring or -1 int strrstr(const String &search,uint32 offset=0); // Returns offset to substring or -1 bool replace(uint32 offset,uint32 arg_length,const String &to); diff --git a/configure.in b/configure.in index d2f7b0486ee..a65580c9699 100644 --- a/configure.in +++ b/configure.in @@ -1577,15 +1577,6 @@ do See the Installation chapter in the Reference Manual.]); fi done - -default_charset_has_source=0 -for cs in $COMPILED_CHARSETS -do - if test $cs = $default_charset - then - default_charset_has_source=1 - fi -done CHARSET_SRCS="" CHARSETS_NEED_SOURCE="" @@ -1600,8 +1591,10 @@ index_file="$srcdir/sql/share/charsets/Index" for c in $CHARSETS do # get the charset number from $index_file - subpat='^'"${c}"'[[\t ]]*#' - number=`$AWK 'sub("'"$subpat"'", "") { print }' $index_file` +changequote(,)dnl + subpat='^'"${c}"'[ ][ ]*\([0-9][0-9]*\)[^0-9]*$' + number=`sed -e "/$subpat/!d" -e 's//\1/' $index_file` +changequote([,])dnl # some sanity checking.... if test X"$number" = X then diff --git a/extra/replace.c b/extra/replace.c index 44f117c7969..ef3abda5cc5 100644 --- a/extra/replace.c +++ b/extra/replace.c @@ -272,7 +272,7 @@ int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name) pa->max_length=PS_MALLOC-MALLOC_OVERHEAD; pa->array_allocs=1; } - length=strlen(name)+1; + length=(uint) strlen(name)+1; if (pa->length+length >= pa->max_length) { if (!(new_pos= (byte*) my_realloc((gptr) pa->str, @@ -415,7 +415,7 @@ REPLACE *init_replace(my_string *from, my_string *to,uint count, DBUG_RETURN(0); } states+=len+1; - result_len+=strlen(to[i])+1; + result_len+=(uint) strlen(to[i])+1; if (len > max_length) max_length=len; } @@ -1021,7 +1021,7 @@ FILE *in,*out; end_of_line++; if (end_of_line == buffer+bufbytes) { - retain=end_of_line - start_of_line; + retain= (int) (end_of_line - start_of_line); break; /* No end of line, read more */ } save_char=end_of_line[0]; diff --git a/include/config-win.h b/include/config-win.h index eca0de680d8..dc54895a5d9 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -32,11 +32,17 @@ #define SYSTEM_TYPE "Win95/Win98" #endif -#ifdef _WIN32 -#define MACHINE_TYPE "i32" /* Define to machine type name */ -#else +#ifdef _WIN64 #define MACHINE_TYPE "i64" /* Define to machine type name */ +#else +#define MACHINE_TYPE "i32" /* Define to machine type name */ +#ifndef _WIN32 +#define _WIN32 /* Compatible with old source */ +#endif +#ifndef __WIN32__ +#define __WIN32__ #endif +#endif /* _WIN64 */ #ifndef __WIN__ #define __WIN__ /* To make it easier in VC++ */ #endif diff --git a/include/global.h b/include/global.h index 9cffcbf477b..27a7c54ede0 100644 --- a/include/global.h +++ b/include/global.h @@ -21,7 +21,7 @@ #ifndef _global_h #define _global_h -#if defined(_WIN32) || defined(_WIN64) +#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32) #include <config-win.h> #else #include <my_config.h> @@ -54,7 +54,9 @@ #endif #if defined(THREAD) && !defined(__WIN__) +#ifndef _POSIX_PTHREAD_SEMANTICS #define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */ +#endif /* was #if defined(HAVE_LINUXTHREADS) || defined(HAVE_DEC_THREADS) || defined(HPUX) */ #if !defined(SCO) #define _REENTRANT 1 /* Some thread libraries require this */ diff --git a/isam/create.c b/isam/create.c index 9b5e9eaece4..bcdd6b0892a 100644 --- a/isam/create.c +++ b/isam/create.c @@ -241,11 +241,12 @@ int nisam_create(const char *name,uint keys,N_KEYDEF *keyinfo, share.base.keystart = share.state.key_file_length=MY_ALIGN(info_length, nisam_block_size); share.base.max_block=max_block; - share.base.max_key_length=ALIGN_SIZE(max_key_length+4); + share.base.max_key_length=(uint) ALIGN_SIZE(max_key_length+4); share.base.records=records; share.base.reloc=reloc; share.base.reclength=reclength; - share.base.pack_reclength=reclength+packed-share.base.blobs*sizeof(char*); + share.base.pack_reclength= + (uint) (reclength+packed-share.base.blobs*sizeof(char*)); share.base.max_pack_length=pack_reclength; share.base.min_pack_length=min_pack_length; share.base.pack_bits=packed; diff --git a/isam/delete.c b/isam/delete.c index 9c66e241147..e50ad72c767 100644 --- a/isam/delete.c +++ b/isam/delete.c @@ -439,7 +439,7 @@ static int underflow(register N_INFO *info, register N_KEYDEF *keyinfo, t_length=(int) _nisam_get_pack_key_length(keyinfo,nod_flag,(uchar*) 0, (uchar*) 0, leaf_key,&s_temp); s_temp.n_length= *half_pos; /* For _nisam_store_key */ - length=(buff+getint(buff))-half_pos; + length=(uint) ((buff+getint(buff))-half_pos); bmove((byte*) buff+p_length+t_length,(byte*) half_pos,(size_t) length); _nisam_store_key(keyinfo,buff+p_length,&s_temp); putint(buff,length+t_length+p_length,nod_flag); @@ -566,7 +566,7 @@ static uint remove_key(N_KEYDEF *keyinfo, uint nod_flag, else { /* Let keypos point at next key */ VOID((*keyinfo->get_key)(keyinfo,nod_flag,&keypos,lastkey)); - s_length=(keypos-start); + s_length=(uint) (keypos-start); if (keyinfo->base.flag & HA_PACK_KEY) { diff_flag= (keyinfo->seg[0].base.flag & HA_SPACE_PACK); @@ -576,12 +576,12 @@ static uint remove_key(N_KEYDEF *keyinfo, uint nod_flag, if ((r_length= *keypos++ & 127) == 0) { /* Same key after */ if (first & 128) - start++; /* Skipp ref length */ + start++; /* Skip ref length */ if (diff_flag) - start+= *start+1; /* Skipp key length */ + start+= *start+1; /* Skip key length */ else start+=keyinfo->seg[0].base.length- (first & 127); - s_length=(keypos-start); /* Remove pointers and next-key-flag */ + s_length=(uint)(keypos-start); /* Remove pntrs and next-key-flag */ } else if (! (first & 128)) { /* Deleted key was not compressed */ @@ -589,12 +589,12 @@ static uint remove_key(N_KEYDEF *keyinfo, uint nod_flag, { *start= (uchar) (r_length+ *keypos); start+=r_length+1; /* Let ref-part remain */ - s_length=(keypos-start)+1; /* Skipp everything between */ + s_length=(uint) (keypos-start)+1; /* Skip everything between */ } else { start+=r_length+1; /* Let ref-part remain */ - s_length=(keypos-start); /* Skipp everything between */ + s_length=(uint) (keypos-start); /* Skip everything between */ } } else if ((first & 127) < r_length) @@ -604,7 +604,7 @@ static uint remove_key(N_KEYDEF *keyinfo, uint nod_flag, if (diff_flag) *start++= (uchar) (*keypos++ + r_length); start+= r_length; - s_length=(keypos-start); /* Skipp everything between */ + s_length=(uint) (keypos-start); /* Skip everything between */ } } } @@ -613,3 +613,5 @@ static uint remove_key(N_KEYDEF *keyinfo, uint nod_flag, (uint) (page_end-start-s_length)); DBUG_RETURN((uint) s_length); } /* remove_key */ + + diff --git a/isam/write.c b/isam/write.c index 110dc70fe53..49b0916afc4 100644 --- a/isam/write.c +++ b/isam/write.c @@ -247,7 +247,7 @@ int _nisam_insert(register N_INFO *info, register N_KEYDEF *keyinfo, s_temp.n_ref_length,s_temp.n_length,s_temp.key)); } #endif - key_offset = (endpos-key_pos); + key_offset = (uint)(endpos-key_pos); if((int) t_length < 0) key_offset += (int) t_length; if (key_offset < 0) diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared index 67c92413d8c..223518e99d7 100644 --- a/libmysql/Makefile.shared +++ b/libmysql/Makefile.shared @@ -53,6 +53,7 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \ mf_pack.lo my_messnc.lo mf_dirname.lo mf_fn_ext.lo\ mf_wcomp.lo typelib.lo safemalloc.lo my_alloc.lo \ mf_format.lo mf_path.lo mf_unixpath.lo my_fopen.lo \ + my_fstream.lo \ mf_loadpath.lo my_pthread.lo my_thr_init.lo \ thr_mutex.lo mulalloc.lo string.lo default.lo \ my_compress.lo array.lo my_once.lo list.lo my_net.lo \ diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index b81af161671..4049b1efa6d 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1269,7 +1269,8 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, host=LOCAL_HOST; sprintf(host_info=buff,ER(CR_TCP_CONNECTION),host); DBUG_PRINT("info",("Server name: '%s'. TCP sock: %d", host,port)); - if ((sock = socket(AF_INET,SOCK_STREAM,0)) == SOCKET_ERROR) + /* _WIN64 ; Assume that the (int) range is enough for socket() */ + if ((sock = (int) socket(AF_INET,SOCK_STREAM,0)) == SOCKET_ERROR) { net->last_errno=CR_IPSOCK_ERROR; sprintf(net->last_error,ER(net->last_errno),ERRNO); diff --git a/libmysql/net.c b/libmysql/net.c index 643b5e031cf..dac1fe0bd68 100644 --- a/libmysql/net.c +++ b/libmysql/net.c @@ -326,7 +326,7 @@ net_real_write(NET *net,const char *packet,ulong len) pos=(char*) packet; end=pos+len; while (pos != end) { - if ((int) (length=vio_write(net->vio,pos,(size_t) (end-pos))) <= 0) + if ((int) (length=vio_write(net->vio,pos,(int) (end-pos))) <= 0) { my_bool interrupted = vio_should_retry(net->vio); #if (!defined(__WIN__) && !defined(__EMX__)) diff --git a/myisam/mi_delete.c b/myisam/mi_delete.c index 4c5f3c79e17..d014c07bc96 100644 --- a/myisam/mi_delete.c +++ b/myisam/mi_delete.c @@ -527,7 +527,7 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo, (uchar*) 0, (uchar *) 0, leaf_key, &s_temp); /* t_length will always be > 0 for a new page !*/ - length=(buff+mi_getint(buff))-half_pos; + length=(uint) ((buff+mi_getint(buff))-half_pos); bmove((byte*) buff+p_length+t_length,(byte*) half_pos,(size_t) length); (*keyinfo->store_key)(keyinfo,buff+p_length,&s_temp); mi_putint(buff,length+t_length+p_length,nod_flag); @@ -683,7 +683,7 @@ static uint remove_key(MI_KEYDEF *keyinfo, uint nod_flag, DBUG_RETURN(0); /* Error */ if (next_block && nod_flag) *next_block= _mi_kpos(nod_flag,keypos); - s_length=(keypos-start); + s_length=(int) (keypos-start); if (keypos != page_end) { if (keyinfo->flag & HA_BINARY_PACK_KEY) @@ -699,7 +699,7 @@ static uint remove_key(MI_KEYDEF *keyinfo, uint nod_flag, (next_length-prev_length)); keypos-=(next_length-prev_length)+prev_pack_length; store_key_length(keypos,prev_length); - s_length=(keypos-start); + s_length=(int) (keypos-start); } } else @@ -746,7 +746,7 @@ static uint remove_key(MI_KEYDEF *keyinfo, uint nod_flag, rest_length+=tmp; pack_length= prev_length ? get_pack_length(rest_length): 0; keypos-=tmp+pack_length+prev_pack_length; - s_length=(keypos-start); + s_length=(int) (keypos-start); if (prev_length) /* Pack against prev key */ { *keypos++= start[0]; diff --git a/myisam/mi_search.c b/myisam/mi_search.c index e7a654c4da8..812982082af 100644 --- a/myisam/mi_search.c +++ b/myisam/mi_search.c @@ -1588,7 +1588,7 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key, key++; org_key++; } } - if ((new_ref_length= (key - start))) + if ((new_ref_length= (uint) (key - start))) new_ref_length+=pack_marker; } diff --git a/mysys/charset.c b/mysys/charset.c index bf51184589c..b989bf37c7b 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -21,9 +21,14 @@ #include <m_string.h> #include <my_dir.h> +typedef struct cs_id_st { + char *name; + uint number; +} CS_ID; + const char *charsets_dir = NULL; static DYNAMIC_ARRAY cs_info_table; -static TYPELIB available_charsets; +static CS_ID **available_charsets; static int charset_initialized=0; #define MAX_LINE 1024 @@ -46,6 +51,24 @@ uint compiled_charset_number(const char *name); const char *compiled_charset_name(uint charset_number); +static uint num_from_csname(CS_ID **cs, const char *name) +{ + CS_ID **c; + for (c = cs; *c; ++c) + if (!strcmp((*c)->name, name)) + return (*c)->number; + return 0; /* this mimics find_type() */ +} + +static char *name_from_csnum(CS_ID **cs, uint number) +{ + CS_ID **c; + for (c = cs; *c; ++c) + if ((*c)->number == number) + return (*c)->name; + return "?"; /* this mimics find_type() */ +} + static my_bool get_word(struct simpleconfig_buf_st *fb, char *buf) { char *endptr=fb->p; @@ -92,12 +115,12 @@ static char *get_charsets_dir(char *buf) } -static my_bool read_charset_index(TYPELIB *charsets, myf myflags) +static my_bool read_charset_index(CS_ID ***charsets, myf myflags) { struct simpleconfig_buf_st fb; - char buf[MAX_LINE]; + char buf[MAX_LINE], num_buf[MAX_LINE]; DYNAMIC_ARRAY cs; - my_string s; + CS_ID *csid; strmov(get_charsets_dir(buf), "Index"); @@ -106,36 +129,42 @@ static my_bool read_charset_index(TYPELIB *charsets, myf myflags) fb.buf[0] = '\0'; fb.p = fb.buf; - if (init_dynamic_array(&cs, sizeof(my_string), 32, 32)) + if (init_dynamic_array(&cs, sizeof(CS_ID *), 32, 32)) return TRUE; - while (!get_word(&fb, buf)) + while (!get_word(&fb, buf) && !get_word(&fb, num_buf)) { + uint csnum; uint length; - if (!(s= (char*) my_once_alloc(length= (uint) strlen(buf)+1, myflags))) + + if (!(csnum = atoi(num_buf))) { + /* corrupt Index file */ my_fclose(fb.f,myflags); return TRUE; } - memcpy(s,buf,length); - insert_dynamic(&cs, (gptr) &s); + + if (!(csid = (CS_ID*) my_once_alloc(sizeof(CS_ID), myflags)) || + !(csid->name= + (char*) my_once_alloc(length= (uint) strlen(buf)+1, myflags))) + { + my_fclose(fb.f,myflags); + return TRUE; + } + memcpy(csid->name,buf,length); + csid->number = csnum; + + insert_dynamic(&cs, (gptr) &csid); } my_fclose(fb.f,myflags); - /* I seriously doubt this is the best way to initialize this - * TYPELIB from the Index file. But it's the best way I could - * come up with right now. */ - charsets->count = cs.elements; - charsets->name = ""; - if (!(charsets->type_names = - (const char **) my_once_alloc((cs.elements + 1) * sizeof(const char *), - myflags))) + if (!(*charsets = + (CS_ID **) my_once_alloc((cs.elements + 1) * sizeof(CS_ID *), myflags))) return TRUE; /* unwarranted chumminess with dynamic_array implementation? */ - memcpy((char*) charsets->type_names, cs.buffer, - cs.elements * sizeof(my_string *)); - charsets->type_names[cs.elements] = NullS; + memcpy((byte *) *charsets, cs.buffer, cs.elements * sizeof(CS_ID *)); + (*charsets)[cs.elements] = NULL; delete_dynamic(&cs); return FALSE; @@ -164,7 +193,7 @@ static my_bool init_available_charsets(myf myflags) charset_initialized=1; pthread_mutex_unlock(&THR_LOCK_charset); } - return error || available_charsets.count == 0; + return error || !available_charsets[0]; } @@ -193,7 +222,7 @@ static my_bool fill_array(uchar *array, int sz, struct simpleconfig_buf_st *fb) static void get_charset_conf_name(uint cs_number, char *buf) { strxmov(get_charsets_dir(buf), - get_type(&available_charsets, cs_number - 1), ".conf", NullS); + name_from_csnum(available_charsets, cs_number), ".conf", NullS); } @@ -237,7 +266,7 @@ uint get_charset_number(const char *charset_name) if (error) return compiled_charset_number(charset_name); else - return find_type((char*)charset_name, &available_charsets, 1); + return num_from_csname(available_charsets, charset_name); } const char *get_charset_name(uint charset_number) @@ -247,7 +276,7 @@ const char *get_charset_name(uint charset_number) if (error) return compiled_charset_name(charset_number); else - return get_type(&available_charsets, charset_number - 1); + return name_from_csnum(available_charsets, charset_number); } @@ -452,29 +481,27 @@ char * list_charsets(myf want_flags) if (want_flags & MY_CONFIG_SETS) { - uint i; - const char *cs_name; + CS_ID **c; char buf[FN_REFLEN]; MY_STAT stat; - for (i = 0; i < available_charsets.count; i++) + for (c = available_charsets; *c; ++c) { - cs_name = get_type(&available_charsets, i); - if (charset_in_string(cs_name, &s)) + if (charset_in_string((*c)->name, &s)) continue; - get_charset_conf_name(i + 1, buf); + get_charset_conf_name((*c)->number, buf); if (!my_stat(buf, &stat, MYF(0))) continue; /* conf file doesn't exist */ - dynstr_append(&s, cs_name); + dynstr_append(&s, (*c)->name); dynstr_append(&s, " "); } } if (want_flags & MY_INDEX_SETS) { - uint i; - for (i = 0; i < available_charsets.count; i++) - charset_append(&s, get_type(&available_charsets, i)); + CS_ID **c; + for (c = available_charsets; *c; ++c) + charset_append(&s, (*c)->name); } if (want_flags & MY_LOADED_SETS) diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh index bc150ff61a5..2084a0b2c02 100755 --- a/scripts/mysqlhotcopy.sh +++ b/scripts/mysqlhotcopy.sh @@ -25,7 +25,7 @@ WARNING: THIS IS VERY MUCH A FIRST-CUT ALPHA. Comments/patches welcome. # Documentation continued at end of file -my $VERSION = "1.5"; +my $VERSION = "1.6"; my $OPTIONS = <<"_OPTIONS"; @@ -180,6 +180,7 @@ if ( defined $opt{regexp} ) { # --- get list of tables to hotcopy --- my $hc_locks = ""; +my $hc_tables = ""; my $num_tables = 0; my $num_files = 0; @@ -208,6 +209,7 @@ foreach my $rdb ( @db_desc ) { $hc_locks .= ", " if ( length $hc_locks && @hc_tables ); $hc_locks .= join ", ", map { "$_ READ" } @hc_tables; + $hc_tables .= join ", ", @hc_tables; $num_tables += scalar @hc_tables; $num_files += scalar @{$rdb->{files}}; @@ -286,7 +288,7 @@ my $hc_started = time; # count from time lock is granted if ( $opt{dryrun} ) { print "LOCK TABLES $hc_locks\n"; - print "FLUSH TABLES\n"; + print "FLUSH TABLES /*!32323 $hc_tables */\n"; print "FLUSH LOGS\n" if ( $opt{flushlog} ); } else { @@ -297,8 +299,8 @@ else { # flush tables to make on-disk copy uptodate $start = time; - $dbh->do("FLUSH TABLES"); - printf "Flushed tables in %d seconds.\n", time-$start unless $opt{quiet}; + $dbh->do("FLUSH TABLES /*!32323 $hc_tables */"); + printf "Flushed tables ($hc_tables) in %d seconds.\n", time-$start unless $opt{quiet}; $dbh->do( "FLUSH LOGS" ) if ( $opt{flushlog} ); } diff --git a/sql/Makefile.am b/sql/Makefile.am index 51a9c1e09fc..58ab8f69304 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -111,7 +111,7 @@ sql_yacc.cc: sql_yacc.yy sql_yacc.h: sql_yacc.yy sql_yacc.o: sql_yacc.cc sql_yacc.h - @echo "Note: The folloing compile may take a long time." + @echo "Note: The following compile may take a long time." @echo "If it fails, re-run configure with --with-low-memory" $(CXXCOMPILE) $(LM_CFLAGS) -c $< diff --git a/sql/field.cc b/sql/field.cc index 0ac2b0c841e..5afa314b835 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -799,7 +799,7 @@ String *Field_tiny::val_str(String *val_buffer, if (unsigned_flag) length= (uint) (int10_to_str((long) *((uchar*) ptr),to,10)-to); else - length=(int10_to_str((long) *((signed char*) ptr),to,-10)-to); + length= (uint) (int10_to_str((long) *((signed char*) ptr),to,-10)-to); val_buffer->length(length); if (zerofill) prepend_zeros(val_buffer); diff --git a/sql/field.h b/sql/field.h index 1d819231bd2..12a4a48562f 100644 --- a/sql/field.h +++ b/sql/field.h @@ -33,7 +33,7 @@ class Field { Field(const Item &); /* Prevent use of theese */ void operator=(Field &); public: - static void *operator new(size_t size) {return (void*) sql_alloc(size); } + static void *operator new(size_t size) {return (void*) sql_alloc((uint) size); } static void operator delete(void *ptr_arg, size_t size) {} /*lint -e715 */ enum utype { NONE,DATE,SHIELD,NOEMPTY,CASEUP,PNR,BGNR,PGNR,YES,NO,REL, diff --git a/sql/item.h b/sql/item.h index bce9c6600ef..f7cc296a4b3 100644 --- a/sql/item.h +++ b/sql/item.h @@ -26,7 +26,7 @@ class Item { Item(const Item &); /* Prevent use of theese */ void operator=(Item &); public: - static void *operator new(size_t size) {return (void*) sql_alloc(size); } + static void *operator new(size_t size) {return (void*) sql_alloc((uint) size); } static void operator delete(void *ptr,size_t size) {} /*lint -e715 */ enum Type {FIELD_ITEM,FUNC_ITEM,SUM_FUNC_ITEM,STRING_ITEM, @@ -167,7 +167,7 @@ public: Item_int(const char *str_arg) : value(str_arg[0] == '-' ? strtoll(str_arg,(char**) 0,10) : (longlong) strtoull(str_arg,(char**) 0,10)) - { max_length=strlen(str_arg); name=(char*) str_arg;} + { max_length= (uint) strlen(str_arg); name=(char*) str_arg;} enum Type type() const { return INT_ITEM; } virtual enum Item_result result_type () const { return INT_RESULT; } longlong val_int() { return value; } diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index c839065eb45..b3494f7c81d 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -418,7 +418,7 @@ redo: i=(char*) ptr+1; j=(char*) search+1; while (j != search_end) if (*i++ != *j++) goto skipp; - offset=ptr-res->ptr(); + offset= (int) (ptr-res->ptr()); if (res->length()-from_length + to_length > max_allowed_packet) goto null; if (!alloced) @@ -740,12 +740,12 @@ String *Item_func_substr_index::val_str(String *str) if (c) return res; /* Not found, return original string */ if (count>0) /* return left part */ { - tmp_value.set(*res,0,ptr-res->ptr()); + tmp_value.set(*res,0,(ulong) (ptr-res->ptr())); } else /* return right part */ { ptr+=delimeter_length; - tmp_value.set(*res,ptr-res->ptr(),strend-ptr); + tmp_value.set(*res,(ulong) (ptr-res->ptr()), (ulong) (strend-ptr)); } } } diff --git a/sql/lock.cc b/sql/lock.cc index 228dff6b058..a2e4daa4590 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -262,7 +262,7 @@ void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table) if (locked->locks[i]->type != TL_UNLOCK) *prev++ = locked->locks[i]; } - locked->lock_count=(prev - locked->locks); + locked->lock_count=(uint) (prev - locked->locks); } } diff --git a/sql/log.cc b/sql/log.cc index e73f0c802a5..29ca0247a1b 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -51,7 +51,7 @@ static int find_uniq_filename(char *name) length=dirname_part(buff,name); char *start=name+length,*end=strend(start); *end='.'; - length=end-start+1; + length= (uint) (end-start+1); if (!(dir_info = my_dir(buff,MYF(MY_DONT_SORT)))) { // This shouldn't happen diff --git a/sql/log_event.cc b/sql/log_event.cc index eae8d7c1e88..45a3e749e9e 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -23,9 +23,9 @@ #endif /* MYSQL_CLIENT */ #define LOG_EVENT_HEADER_LEN 9 -#define QUERY_HEADER_LEN (sizeof(uint) + sizeof(uint) + sizeof(uchar)) -#define LOAD_HEADER_LEN (sizeof(uint) + sizeof(uint) + \ - + sizeof(uint) + 2 + sizeof(uint)) +#define QUERY_HEADER_LEN (sizeof(uint32) + sizeof(uint32) + sizeof(uchar)) +#define LOAD_HEADER_LEN (sizeof(uint32) + sizeof(uint32) + \ + + sizeof(uint32) + 2 + sizeof(uint32)) #define EVENT_LEN_OFFSET 5 #define EVENT_TYPE_OFFSET 4 #define MAX_EVENT_LEN 4*1024*1024 @@ -71,11 +71,7 @@ int Log_event::write_header(FILE* file) int4store(pos, when); // timestamp pos += 4; *pos++ = get_type_code(); // event type code - int4store(pos, get_data_size() + - sizeof(time_t) // timestamp - + sizeof(char) // event code - + sizeof(uint) // event entry size - ); + int4store(pos, get_data_size() + LOG_EVENT_HEADER_LEN); pos += 4; return (my_fwrite(file, (byte*) buf, (uint) (pos - buf), MYF(MY_NABP | MY_WME))); diff --git a/sql/log_event.h b/sql/log_event.h index 13472938975..82ab462bdf5 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -85,10 +85,10 @@ protected: public: const char* query; const char* db; - uint q_len; // if we already know the length of the query string + uint32 q_len; // if we already know the length of the query string // we pass it here, so we would not have to call strlen() // otherwise, set it to 0, in which case, we compute it with strlen() - uint db_len; + uint32 db_len; int thread_id; #if !defined(MYSQL_CLIENT) THD* thd; @@ -99,9 +99,9 @@ public: { time_t end_time; time(&end_time); - exec_time = end_time - thd->start_time; + exec_time = (ulong) (end_time - thd->start_time); valid_exec_time = 1; - db_len = (db) ? (uint) strlen(db) : 0; + db_len = (db) ? (uint32) strlen(db) : 0; } #endif @@ -120,8 +120,8 @@ public: int get_data_size() { return q_len + db_len + 2 + - sizeof(uint) // thread_id - + sizeof(uint) // exec_time + sizeof(uint32) // thread_id + + sizeof(uint32) // exec_time ; } @@ -157,19 +157,19 @@ protected: char* data_buf; public: int thread_id; - uint table_name_len; - uint db_len; - uint fname_len; - uint num_fields; + uint32 table_name_len; + uint32 db_len; + uint32 fname_len; + uint32 num_fields; const char* fields; const uchar* field_lens; - uint field_block_len; + uint32 field_block_len; const char* table_name; const char* db; const char* fname; - uint skip_lines; + uint32 skip_lines; sql_ex_info sql_ex; #if !defined(MYSQL_CLIENT) @@ -187,10 +187,10 @@ public: { time_t end_time; time(&end_time); - exec_time = end_time - thd->start_time; + exec_time = (ulong) (end_time - thd->start_time); valid_exec_time = 1; - db_len = (db) ? (uint) strlen(db) : 0; - table_name_len = (table_name) ? (uint) strlen(table_name) : 0; + db_len = (db) ? (uint32) strlen(db) : 0; + table_name_len = (table_name) ? (uint32) strlen(table_name) : 0; fname_len = (fname) ? (uint) strlen(fname) : 0; sql_ex.field_term = (*ex->field_term)[0]; sql_ex.enclosed = (*ex->enclosed)[0]; diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 643b5e031cf..dac1fe0bd68 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -326,7 +326,7 @@ net_real_write(NET *net,const char *packet,ulong len) pos=(char*) packet; end=pos+len; while (pos != end) { - if ((int) (length=vio_write(net->vio,pos,(size_t) (end-pos))) <= 0) + if ((int) (length=vio_write(net->vio,pos,(int) (end-pos))) <= 0) { my_bool interrupted = vio_should_retry(net->vio); #if (!defined(__WIN__) && !defined(__EMX__)) diff --git a/sql/share/charsets/Index b/sql/share/charsets/Index index 8d5e7576d56..1d507f86e3e 100644 --- a/sql/share/charsets/Index +++ b/sql/share/charsets/Index @@ -2,36 +2,32 @@ # # This file lists all of the available character sets. -# THE ORDER IN WHICH CHARACTER SETS ARE LISTED IS IMPORTANT. See the -# README file in this directory for details. - -big5 # 1 -czech # 2 -dec8 # 3 -dos # 4 -german1 # 5 -hp8 # 6 -koi8_ru # 7 -latin1 # 8 -latin2 # 9 -swe7 # 10 -usa7 # 11 -ujis # 12 -sjis # 13 -cp1251 # 14 -danish # 15 -hebrew # 16 -win1251 # 17 -tis620 # 18 -euc_kr # 19 -estonia # 20 -hungarian # 21 -koi8_ukr # 22 -win1251ukr # 23 -gb2312 # 24 -greek # 25 -win1250 # 26 -croat # 27 -gbk # 28 -cp1257 # 29 +big5 1 +czech 2 +dec8 3 +dos 4 +german1 5 +hp8 6 +koi8_ru 7 +latin1 8 +latin2 9 +swe7 10 +usa7 11 +ujis 12 +sjis 13 +cp1251 14 +danish 15 +hebrew 16 +tis620 18 +euc_kr 19 +estonia 20 +hungarian 21 +koi8_ukr 22 +win1251ukr 23 +gb2312 24 +greek 25 +win1250 26 +croat 27 +gbk 28 +cp1257 29 diff --git a/sql/share/charsets/README b/sql/share/charsets/README index 80da6ba9665..172d1ee8e1e 100644 --- a/sql/share/charsets/README +++ b/sql/share/charsets/README @@ -9,10 +9,9 @@ different character sets. It contains: Index The Index file lists all of the available charset configurations. - THE ORDER OF THE CHARACTER SETS IN THIS FILE IS SIGNIFICANT. - The first character set is number 1, the second is number 2, etc. The - number is stored IN THE DATABASE TABLE FILES and must not be changed. - Always add new character sets to the end of the list, so that the + Each charset is paired with a number. The number is stored + IN THE DATABASE TABLE FILES and must not be changed. Always + add new character sets to the end of the list, so that the numbers of the other character sets will not be changed. Compiled in or configuration file? @@ -39,5 +38,3 @@ Syntax of configuration files number in hexadecimal format. The ctype array takes up the first 257 words; the to_lower, to_upper and sort_order arrays take up 256 words each after that. - - The Index file is simply a list of the available character sets. diff --git a/sql/share/charsets/german1.conf b/sql/share/charsets/german1.conf index dac77b1f08f..3090c921ebe 100644 --- a/sql/share/charsets/german1.conf +++ b/sql/share/charsets/german1.conf @@ -69,6 +69,6 @@ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF 41 41 41 41 41 41 41 43 45 45 45 45 49 49 49 49 - 44 4E 4F 4F 4F 4F 4F D7 D8 55 55 55 55 59 DE DF + D0 4E 4F 4F 4F 4F 4F D7 4F 55 55 55 55 59 DE 53 41 41 41 41 41 41 41 43 45 45 45 45 49 49 49 49 - 44 4E 4F 4F 4F 4F 4F F7 D8 55 55 55 55 59 DE FF + D0 4E 4F 4F 4F 4F 4F F7 4F 55 55 55 55 59 DE FF diff --git a/sql/share/charsets/latin1.conf b/sql/share/charsets/latin1.conf index cf974aefa14..515b8812d0f 100644 --- a/sql/share/charsets/latin1.conf +++ b/sql/share/charsets/latin1.conf @@ -68,7 +68,7 @@ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - 41 41 41 41 5C 5B 5C 43 45 45 45 45 49 49 49 49 - 44 4E 4F 4F 4F 4F 5D D7 D8 55 55 55 59 59 DE DF - 41 41 41 41 5C 5B 5C 43 45 45 45 45 49 49 49 49 - 44 4E 4F 4F 4F 4F 5D F7 D8 55 55 55 59 59 DE FF + 41 41 41 41 41 41 C6 43 45 45 45 45 49 49 49 49 + D0 4E 4F 4F 4F 4F 4F D7 4F 55 55 55 55 59 DE 53 + 41 41 41 41 41 41 C6 43 45 45 45 45 49 49 49 49 + D0 4E 4F 4F 4F 4F 4F F7 4F 55 55 55 55 59 DE 59 diff --git a/sql/slave.cc b/sql/slave.cc index 500c29480bc..2f4f7c10714 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -372,9 +372,11 @@ int show_master_info(THD* thd) int flush_master_info(MASTER_INFO* mi) { FILE* file = mi->file; + char lbuf[22]; + if(my_fseek(file, 0L, MY_SEEK_SET, MYF(MY_WME)) == MY_FILEPOS_ERROR || - fprintf(file, "%s\n%ld\n%s\n%s\n%s\n%d\n%d\n", - mi->log_file_name, mi->pos, mi->host, mi->user, mi->password, + fprintf(file, "%s\n%s\n%s\n%s\n%s\n%d\n%d\n", + mi->log_file_name, llstr(mi->pos, lbuf), mi->host, mi->user, mi->password, mi->port, mi->connect_retry) < 0 || fflush(file)) { diff --git a/sql/sql_list.h b/sql/sql_list.h index 725d506e62a..965d1ff9308 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -25,7 +25,7 @@ class Sql_alloc { public: - static void *operator new(size_t size) {return (void*) sql_alloc(size); } + static void *operator new(size_t size) {return (void*) sql_alloc((uint) size); } static void operator delete(void *ptr, size_t size) {} /*lint -e715 */ inline Sql_alloc() {}; inline ~Sql_alloc() {}; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index b4f16bbe201..8b7e16709c0 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -323,7 +323,7 @@ pthread_handler_decl(handle_one_connection,arg) { THD *thd=(THD*) arg; uint launch_time = - (thd->thr_create_time = time(NULL)) - thd->connect_time; + (uint) ((thd->thr_create_time = time(NULL)) - thd->connect_time); if (launch_time >= slow_launch_time) statistic_increment(slow_launch_threads,&LOCK_status ); diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc index ee6771d4b25..e1be78ada1c 100644 --- a/sql/sql_rename.cc +++ b/sql/sql_rename.cc @@ -32,8 +32,7 @@ static TABLE_LIST *rename_tables(THD *thd, TABLE_LIST *table_list, bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list) { bool error=1,got_all_locks=1; - db_type table_type; - TABLE_LIST *lock_table,*ren_table=0,*new_table; + TABLE_LIST *lock_table,*ren_table=0; DBUG_ENTER("mysql_rename_tables"); /* Avoid problems with a rename on a table that we have locked or diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 9c509484b3c..c779b9f555a 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2606,7 +2606,7 @@ static void clear_tables(JOIN *join) class COND_CMP :public ilink { public: - static void *operator new(size_t size) {return (void*) sql_alloc(size); } + static void *operator new(size_t size) {return (void*) sql_alloc((uint) size); } static void operator delete(void *ptr __attribute__((unused)), size_t size __attribute__((unused))) {} /*lint -e715 */ @@ -3229,7 +3229,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, *(reg_field++) =new_field; } } - field_count=reg_field - table->field; + field_count= (uint) (reg_field - table->field); /* If result table is small; use a heap */ if (blob_count || using_unique_constraint || diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 695c815a500..66141a8591c 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -818,11 +818,12 @@ store_create_info(THD *thd, TABLE *table, String* packet) class thread_info :public ilink { public: - static void *operator new(size_t size) {return (void*) sql_alloc(size); } + static void *operator new(size_t size) {return (void*) sql_alloc((uint) size); } static void operator delete(void *ptr __attribute__((unused)), size_t size __attribute__((unused))) {} /*lint -e715 */ - ulong thread_id,start_time; + ulong thread_id; + time_t start_time; uint command; const char *user,*host,*db,*proc_info,*state_info; char *query; diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 83b21af87f5..67ce0f6ff54 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -1,18 +1,19 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + This program file is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ /* This file is originally from the mysql distribution. Coded by monty */ @@ -126,7 +127,7 @@ bool String::set(double num,uint decimals) if (decimals >= NOT_FIXED_DEC) { sprintf(buff,"%.14g",num); // Enough for a DATETIME - return copy(buff,(uint) strlen(buff)); + return copy(buff, (uint32) strlen(buff)); } #ifdef HAVE_FCONVERT int decpt,sign; @@ -141,7 +142,7 @@ bool String::set(double num,uint decimals) buff[0]='-'; pos=buff; } - return copy(pos,(uint) strlen(pos)); + return copy(pos,(uint32) strlen(pos)); } if (alloc((uint32) ((uint32) decpt+3+decimals))) return TRUE; @@ -191,7 +192,7 @@ end: #else sprintf(buff,"%.*f",(int) decimals,num); #endif - return copy(buff,(uint) strlen(buff)); + return copy(buff,(uint32) strlen(buff)); #endif } @@ -260,7 +261,7 @@ bool String::append(const String &s) bool String::append(const char *s,uint32 arg_length) { if (!arg_length) // Default argument - arg_length=(uint) strlen(s); + arg_length= (uint32) strlen(s); if (realloc(str_length+arg_length)) return TRUE; memcpy(Ptr+str_length,s,arg_length); @@ -318,7 +319,7 @@ int String::charpos(int i,uint32 offset) if ( INT_MAX32-i <= (int) (mbstr-Ptr-offset)) return INT_MAX32; else - return (mbstr-Ptr-offset)+i; + return (int) ((mbstr-Ptr-offset)+i); } else #endif @@ -330,7 +331,7 @@ int String::strstr(const String &s,uint32 offset) if (s.length()+offset <= str_length) { if (!s.length()) - return offset; // Empty string is always found + return ((int) offset); // Empty string is always found register const char *str = Ptr+offset; register const char *search=s.ptr(); diff --git a/sql/sql_string.h b/sql/sql_string.h index d421261f9e4..8711cf314ad 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -1,18 +1,19 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ /* This file is originally from the mysql distribution. Coded by monty */ @@ -44,7 +45,7 @@ public: { Ptr=str.Ptr ; str_length=str.str_length ; Alloced_length=str.Alloced_length; alloced=0; } - static void *operator new(size_t size) { return (void*) sql_alloc(size); } + static void *operator new(size_t size) { return (void*) sql_alloc((uint) size); } static void operator delete(void *ptr_arg,size_t size) /*lint -e715 */ { sql_element_free(ptr_arg); } ~String() { free(); } diff --git a/sql/time.cc b/sql/time.cc index 5cf7d0ee074..17603d93dd4 100644 --- a/sql/time.cc +++ b/sql/time.cc @@ -113,7 +113,7 @@ long my_gmt_sec(TIME *t) if ((my_time_zone >=0 ? my_time_zone: -my_time_zone) > 3600L*12) my_time_zone=0; /* Wrong date */ pthread_mutex_unlock(&LOCK_timezone); - return tmp; + return (long) tmp; } /* my_gmt_sec */ |