Commit 3d25ec2c authored by tim@localhost.polyesthetic.msg's avatar tim@localhost.polyesthetic.msg
Browse files

Merge tim@work:/home/bk/mysql

into localhost.polyesthetic.msg:/usr/local/src/my/work
parents b2ece770 8f2f778d
Loading
Loading
Loading
Loading
+61 −58
Original line number Diff line number Diff line
@@ -5004,12 +5004,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
@@ -30101,24 +30100,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
@@ -32769,18 +32752,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.
@@ -32798,36 +32784,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.
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:
You may get some errors because of undefined symbols when linking the
standard client, because the pthread libraries are not included by
default.
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
@@ -34652,9 +34645,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}
@@ -34676,6 +34668,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,
@@ -35402,6 +35402,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
+24 −9
Original line number Diff line number Diff line
/* 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 @@ bool String::set(double num,uint decimals)
  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
+4 −3
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ class String
  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 @@ class String
  { 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 @@ class String
    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 @@ class String
  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);
+3 −3
Original line number Diff line number Diff line
@@ -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];
+9 −3
Original line number Diff line number Diff line
@@ -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
Loading