Commit e2a11641 authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi
Browse files

Portability fixes for SCO and HPUX

Change TRUNCATE(number) to truncate towards zero for negative numbers
Fix NULL handling for DESCRIBE table_name
parent a2ec51ce
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -31150,6 +31150,17 @@ mysql> select TRUNCATE(1.999,1);
        -> 1.9
mysql> select TRUNCATE(1.999,0);
        -> 1
mysql> select TRUNCATE(-1,999,1);
        -> -1.9
@end example
Starting from MySQL 3.23.51 all numbers are rounded towards zero.
If @code{D} is negative, then the whole part of the number is zeroed out:
@example
mysql> select truncate(122,-2);
       -> 100
@end example
Note that as decimal numbers are normally not stored as exact numbers in
@@ -46916,6 +46927,11 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.51
@itemize @bullet
@item
Cleaned up @code{NULL} handling for default values in @code{DESCRIBE
table_name}.
@item
Fixed @code{truncate()} to round up negative values to the nearest integer.
@item
Remove end space from @code{enum} values. (This fixed a problem with
@code{SHOW CREATE TABLE}).
@item
+4 −4
Original line number Diff line number Diff line
@@ -1552,7 +1552,7 @@ then
fi
AC_TRY_COMPILE(
[#undef inline
#if !defined(SCO) && !defined(__osf__)
#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
#define _REENTRANT
#endif
#include <pthread.h>
@@ -1585,7 +1585,7 @@ then
fi
AC_TRY_COMPILE(
[#undef inline
#if !defined(SCO) && !defined(__osf__)
#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
#define _REENTRANT
#endif
#include <pthread.h>
@@ -1617,7 +1617,7 @@ then
fi
AC_TRY_COMPILE(
[#undef inline
#if !defined(SCO) && !defined(__osf__)
#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
#define _REENTRANT
#endif
#include <pthread.h>
@@ -1643,7 +1643,7 @@ then
  # Check definition of pthread_getspecific
  AC_CACHE_CHECK("args to pthread_getspecific", mysql_cv_getspecific_args,
  AC_TRY_COMPILE(
[#if !defined(SCO) && !defined(__osf__)
[#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
#define _REENTRANT
#endif
#define _POSIX_PTHREAD_SEMANTICS 
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@

#include <my_global.h>
#include <m_ctype.h>
#include <my_net.h>
#include <my_sys.h>
#include <m_string.h>
#include <sys/types.h>
@@ -30,6 +29,7 @@
#endif
#include <arpa/inet.h>
#include <netdb.h>
#include <my_net.h>
#include <getopt.h>

#if !defined(_AIX) && !defined(HAVE_UNIXWARE7_THREADS) && !defined(HAVE_UNIXWARE7_POSIX) && !defined(h_errno)
+1 −1
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ struct hostent *my_gethostbyname_r(const char *name,
				   struct hostent *result, char *buffer,
				   int buflen, int *h_errnop);
#define my_gethostbyname_r_free()
#if !defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
#if !defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) && !defined(HPUX)
#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data)
#endif /* !defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */

+5 −0
Original line number Diff line number Diff line
@@ -180,8 +180,13 @@ static int connect2(my_socket s, const struct sockaddr *name, uint namelen,
  {
    tv.tv_sec = (long) timeout;
    tv.tv_usec = 0;
#if defined(HPUX) && defined(THREAD)
    if ((res = select(s+1, NULL, (int*) &sfds, NULL, &tv)) >= 0)
      break;
#else
    if ((res = select(s+1, NULL, &sfds, NULL, &tv)) >= 0)
      break;
#endif
    now_time=time(NULL);
    timeout-= (uint) (now_time - start_time);
    if (errno != EINTR || (int) timeout <= 0)
Loading