Commit c6590081 authored by unknown's avatar unknown
Browse files

Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  mysql.com:/usr/home/bar/mysql-5.1-new.b16319

parents 7280f8be 28980e7c
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				AdditionalIncludeDirectories="../include,../libmysqld,../sql,../regex,../extra/yassl/include,../storage/bdb/build_win32,../zlib"
				AdditionalIncludeDirectories="../include,../libmysqld,../sql,../regex,../extra/yassl/include,../storage/bdb/build_win32,../zlib,."
				PreprocessorDefinitions="WIN32;_WINDOWS;_MBCS;_DEBUG;SAFEMALLOC;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;USE_TLS;__WIN__"
				BasicRuntimeChecks="3"
				RuntimeLibrary="1"
@@ -89,7 +89,7 @@
				Optimization="2"
				InlineFunctionExpansion="1"
				OptimizeForProcessor="2"
				AdditionalIncludeDirectories="../include,../regex,../extra/yassl/include,../libmysqld,../sql,../zlib"
				AdditionalIncludeDirectories="../include,../regex,../extra/yassl/include,../libmysqld,../sql,../zlib,."
				PreprocessorDefinitions="WIN32;_WINDOWS;_MBCS;NDEBUG;DBUG_OFF;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;USE_TLS;__WIN__;LICENSE=Commercial"
				StringPooling="TRUE"
				RuntimeLibrary="0"
@@ -155,7 +155,7 @@
				Optimization="2"
				InlineFunctionExpansion="1"
				OptimizeForProcessor="2"
				AdditionalIncludeDirectories="../include,../libmysqld,../sql,../regex,../extra/yassl/include,../storage/bdb/build_win32,../zlib"
				AdditionalIncludeDirectories="../include,../libmysqld,../sql,../regex,../extra/yassl/include,../storage/bdb/build_win32,../zlib,."
				PreprocessorDefinitions="WIN32;_WINDOWS;_MBCS;NDEBUG;DBUG_OFF;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;USE_TLS;__WIN__"
				StringPooling="TRUE"
				RuntimeLibrary="0"
@@ -221,7 +221,7 @@
				Optimization="2"
				InlineFunctionExpansion="1"
				OptimizeForProcessor="2"
				AdditionalIncludeDirectories="../include,../regex,../extra/yassl/include,../libmysqld,../sql,../zlib"
				AdditionalIncludeDirectories="../include,../regex,../extra/yassl/include,../libmysqld,../sql,../zlib,."
				PreprocessorDefinitions="WIN32;_WINDOWS;_MBCS;NDEBUG;DBUG_OFF;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;USE_TLS;__WIN__;LICENSE=Commercial"
				StringPooling="TRUE"
				RuntimeLibrary="0"
+9 −9
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@
				Optimization="2"
				InlineFunctionExpansion="1"
				OptimizeForProcessor="2"
				AdditionalIncludeDirectories="../include,../regex,../zlib,../extra/yassl/include"
				AdditionalIncludeDirectories="../include,../regex,../zlib,../extra/yassl/include,."
				PreprocessorDefinitions="__NT__;DBUG_OFF;NDEBUG;MYSQL_SERVER;_WINDOWS;_CONSOLE;HAVE_DLOPEN;LICENSE=Commercial;HAVE_ROW_BASED_REPLICATION"
				StringPooling="TRUE"
				RuntimeLibrary="0"
@@ -84,7 +84,7 @@
				Optimization="2"
				InlineFunctionExpansion="1"
				OptimizeForProcessor="2"
				AdditionalIncludeDirectories="../storage/bdb/build_win32,../include,../regex,../extra/yassl/include,../zlib"
				AdditionalIncludeDirectories="../storage/bdb/build_win32,../include,../regex,../extra/yassl/include,../zlib,."
				PreprocessorDefinitions="NDEBUG;DBUG_OFF;HAVE_INNOBASE_DB;HAVE_BERKELEY_DB;HAVE_ARCHIVE_DB;HAVE_BLACKHOLE_DB;HAVE_EXAMPLE_DB;HAVE_FEDERATED_DB;MYSQL_SERVER;_WINDOWS;_CONSOLE;HAVE_DLOPEN;WITH_INNOBASE_STORAGE_ENGINE;WITH_BERKELEY_STORAGE_ENGINE;WITH_ARCHIVE_STORAGE_ENGINE;WITH_BLACKHOLE_STORAGE_ENGINE;WITH_EXAMPLE_STORAGE_ENGINE;WITH_FEDERATED_STORAGE_ENGINE;WITH_PARTITION_STORAGE_ENGINE;HAVE_ROW_BASED_REPLICATION"
				StringPooling="TRUE"
				RuntimeLibrary="0"
@@ -144,7 +144,7 @@
				Optimization="2"
				InlineFunctionExpansion="1"
				OptimizeForProcessor="2"
				AdditionalIncludeDirectories="../storage/bdb/build_win32,../include,../regex,../extra/yassl/include,../zlib"
				AdditionalIncludeDirectories="../storage/bdb/build_win32,../include,../regex,../extra/yassl/include,../zlib,."
				PreprocessorDefinitions="__NT__;NDEBUG;DBUG_OFF;HAVE_INNOBASE_DB;HAVE_BERKELEY_DB;HAVE_ARCHIVE_DB;HAVE_BLACKHOLE_DB;HAVE_EXAMPLE_DB;HAVE_FEDERATED_DB;MYSQL_SERVER;_WINDOWS;_CONSOLE;HAVE_DLOPEN;WITH_INNOBASE_STORAGE_ENGINE;WITH_BERKELEY_STORAGE_ENGINE;WITH_ARCHIVE_STORAGE_ENGINE;WITH_BLACKHOLE_STORAGE_ENGINE;WITH_EXAMPLE_STORAGE_ENGINE;WITH_FEDERATED_STORAGE_ENGINE;WITH_PARTITION_STORAGE_ENGINE;HAVE_ROW_BASED_REPLICATION"
				StringPooling="TRUE"
				RuntimeLibrary="0"
@@ -207,7 +207,7 @@
				Optimization="2"
				InlineFunctionExpansion="1"
				OptimizeForProcessor="2"
				AdditionalIncludeDirectories="../include,../regex,../zlib,../extra/yassl/include"
				AdditionalIncludeDirectories="../include,../regex,../zlib,../extra/yassl/include,."
				PreprocessorDefinitions="__NT__;NDEBUG;DBUG_OFF;HAVE_INNOBASE_DB;HAVE_ARCHIVE_DB;HAVE_BLACKHOLE_DB;HAVE_EXAMPLE_DB;HAVE_FEDERATED_DB;MYSQL_SERVER;_WINDOWS;_CONSOLE;HAVE_DLOPEN;WITH_INNOBASE_STORAGE_ENGINE;WITH_ARCHIVE_STORAGE_ENGINE;WITH_BLACKHOLE_STORAGE_ENGINE;WITH_EXAMPLE_STORAGE_ENGINE;WITH_FEDERATED_STORAGE_ENGINE;WITH_PARTITION_STORAGE_ENGINE;HAVE_ROW_BASED_REPLICATION"
				StringPooling="TRUE"
				RuntimeLibrary="0"
@@ -270,7 +270,7 @@
				Optimization="2"
				InlineFunctionExpansion="1"
				OptimizeForProcessor="2"
				AdditionalIncludeDirectories="../include,../regex,../zlib,../extra/yassl/include"
				AdditionalIncludeDirectories="../include,../regex,../zlib,../extra/yassl/include,."
				PreprocessorDefinitions="__NT__;DBUG_OFF;NDEBUG;HAVE_INNOBASE_DB;HAVE_ARCHIVE_DB;MYSQL_SERVER;LICENSE=Commercial;_WINDOWS;_CONSOLE;HAVE_DLOPEN;WITH_INNOBASE_STORAGE_ENGINE;HAVE_ROW_BASED_REPLICATION"
				StringPooling="TRUE"
				RuntimeLibrary="0"
@@ -330,7 +330,7 @@
				Name="VCCLCompilerTool"
				Optimization="0"
				OptimizeForProcessor="2"
				AdditionalIncludeDirectories="../storage/bdb/build_win32,../include,../regex,../extra/yassl/include,../zlib"
				AdditionalIncludeDirectories="../storage/bdb/build_win32,../include,../regex,../extra/yassl/include,../zlib,."
				PreprocessorDefinitions="_DEBUG;SAFEMALLOC;SAFE_MUTEX;HAVE_INNOBASE_DB;HAVE_ARCHIVE_DB;HAVE_BLACKHOLE_DB;HAVE_EXAMPLE_DB;HAVE_FEDERATED_DB;MYSQL_SERVER;_WINDOWS;_CONSOLE;HAVE_DLOPEN;WITH_INNOBASE_STORAGE_ENGINE;WITH_ARCHIVE_STORAGE_ENGINE;WITH_BLACKHOLE_STORAGE_ENGINE;WITH_EXAMPLE_STORAGE_ENGINE;WITH_FEDERATED_STORAGE_ENGINE;WITH_PARTITION_STORAGE_ENGINE;HAVE_ROW_BASED_REPLICATION"
				RuntimeLibrary="1"
				PrecompiledHeaderFile=".\debug/mysqld.pch"
@@ -391,7 +391,7 @@
				Optimization="2"
				InlineFunctionExpansion="1"
				OptimizeForProcessor="2"
				AdditionalIncludeDirectories="../include,../regex,../zlib,../extra/yassl/include"
				AdditionalIncludeDirectories="../include,../regex,../zlib,../extra/yassl/include,."
				PreprocessorDefinitions="MYSQL_SERVER;LICENSE=Commercial;HAVE_DLOPEN;HAVE_INNOBASE_DB;HAVE_ARCHIVE_DB;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;WITH_INNOBASE_STORAGE_ENGINE;WITH_ARCHIVE_STORAGE_ENGINE;HAVE_ROW_BASED_REPLICATION"
				StringPooling="TRUE"
				RuntimeLibrary="0"
@@ -452,7 +452,7 @@
				Optimization="2"
				InlineFunctionExpansion="1"
				OptimizeForProcessor="2"
				AdditionalIncludeDirectories="../include,../regex,../zlib,../extra/yassl/include"
				AdditionalIncludeDirectories="../include,../regex,../zlib,../extra/yassl/include,."
				PreprocessorDefinitions="LICENSE=Commercial;MYSQL_SERVER;_WINDOWS;_CONSOLE;HAVE_DLOPEN;DBUG_OFF;NDEBUG;HAVE_ROW_BASED_REPLICATION"
				StringPooling="TRUE"
				RuntimeLibrary="0"
@@ -513,7 +513,7 @@
				Optimization="2"
				InlineFunctionExpansion="1"
				OptimizeForProcessor="2"
				AdditionalIncludeDirectories="../zlib,../include,../regex,../extra/yassl/include"
				AdditionalIncludeDirectories="../zlib,../include,../regex,../extra/yassl/include,."
				PreprocessorDefinitions="NDEBUG;DBUG_OFF;HAVE_INNOBASE_DB;HAVE_ARCHIVE_DB;HAVE_BLACKHOLE_DB;HAVE_EXAMPLE_DB;HAVE_FEDERATED_DB;MYSQL_SERVER;_WINDOWS;_CONSOLE;HAVE_DLOPEN;WITH_INNOBASE_STORAGE_ENGINE;WITH_ARCHIVE_STORAGE_ENGINE;WITH_BLACKHOLE_STORAGE_ENGINE;WITH_EXAMPLE_STORAGE_ENGINE;WITH_FEDERATED_STORAGE_ENGINE;WITH_PARTITION_STORAGE_ENGINE;HAVE_ROW_BASED_REPLICATION"
				StringPooling="TRUE"
				RuntimeLibrary="0"
+0 −2
Original line number Diff line number Diff line
@@ -24,8 +24,6 @@
#include <errmsg.h>
#include <my_getopt.h>

/* We have to define 'enum options' identical in all files to keep OS2 happy */

enum options_client
{
  OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET,
+61 −79
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ extern "C" {
#endif

#undef bcmp				// Fix problem with new readline
#if defined( __WIN__) || defined(OS2)
#if defined( __WIN__)
#include <conio.h>
#elif !defined(__NETWARE__)
#include <readline/readline.h>
@@ -101,7 +101,7 @@ extern "C" {
#define cmp_database(cs,A,B) strcmp((A),(B))
#endif

#if !defined( __WIN__) && !defined( OS2) && !defined(__NETWARE__) && (!defined(HAVE_mit_thread) || !defined(THREAD))
#if !defined( __WIN__) && !defined(__NETWARE__) && !defined(THREAD)
#define USE_POPEN
#endif

@@ -185,7 +185,7 @@ void tee_fprintf(FILE *file, const char *fmt, ...);
void tee_fputs(const char *s, FILE *file);
void tee_puts(const char *s, FILE *file);
void tee_putc(int c, FILE *file);
static void tee_print_sized_data(const char *data, unsigned int length, unsigned int width);
static void tee_print_sized_data(const char *, unsigned int, unsigned int, bool);
/* The names of functions that actually do the manipulation. */
static int get_options(int argc,char **argv);
static int com_quit(String *str,char*),
@@ -653,7 +653,7 @@ static struct my_option my_long_options[] =
   "Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name, 
   0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
  {"socket", 'S', "Socket file to use for connection. (This will override --port unless --protocol=TCP is specified.)",
  {"socket", 'S', "Socket file to use for connection.",
   (gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STR_ALLOC,
   REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include "sslopt-longopts.h"
@@ -940,13 +940,6 @@ static int get_options(int argc, char **argv)
    connect_flag= 0; /* Not in interactive mode */
  }
  
  if (opt_mysql_port && (!opt_protocol) && (!opt_mysql_unix_port))
  {
    /* Not checking return type since we are using a constant value */
    /* straight from the initialization of sql_protocol_typelib.    */
    opt_protocol= find_type("TCP", &sql_protocol_typelib, 0);
  }

  if (strcmp(default_charset, charset_info->csname) &&
      !(charset_info= get_charset_by_csname(default_charset, 
					    MY_CS_PRIMARY, MYF(MY_WME))))
@@ -969,7 +962,7 @@ static int get_options(int argc, char **argv)

static int read_and_execute(bool interactive)
{
#if defined(OS2) || defined(__NETWARE__)
#if defined(__NETWARE__)
  char linebuffer[254];
  String buffer;
#endif
@@ -1006,7 +999,7 @@ static int read_and_execute(bool interactive)
      if (opt_outfile && glob_buffer.is_empty())
	fflush(OUTFILE);

#if defined( __WIN__) || defined(OS2) || defined(__NETWARE__)
#if defined( __WIN__) || defined(__NETWARE__)
      tee_fputs(prompt, stdout);
#if defined(__NETWARE__)
      line=fgets(linebuffer, sizeof(linebuffer)-1, stdin);
@@ -1017,7 +1010,7 @@ static int read_and_execute(bool interactive)
        if (p != NULL)
          *p = '\0';
      }
#elif defined(__WIN__)
#else defined(__WIN__)
      if (!tmpbuf.is_alloced())
        tmpbuf.alloc(65535);
      tmpbuf.length(0);
@@ -1033,32 +1026,12 @@ static int read_and_execute(bool interactive)
        */
      } while (tmpbuf.alloced_length() <= clen);
      line= buffer.c_ptr();
#else /* OS2 */
      buffer.length(0);
      /* _cgets() expects the buffer size - 3 as the first byte */
      linebuffer[0]= (char) sizeof(linebuffer) - 3;
      do
      {
        line= _cgets(linebuffer);
        buffer.append(line, (unsigned char)linebuffer[1]);
      /*
        If _cgets() gets an input line that is linebuffer[0] bytes
        long, the next call to _cgets() will return immediately with
        linebuffer[1] == 0, and it does the same thing for input that
        is linebuffer[0]-1 bytes long. So it appears that even though
        _cgets() replaces the newline (which is two bytes on Window) with
        a nil, it still needs the space in the linebuffer for it. This is,
        naturally, undocumented.
       */
      } while ((unsigned char)linebuffer[0] <=
               (unsigned char)linebuffer[1] + 1);
      line= buffer.c_ptr();
#endif /* __NETWARE__ */
#else
      if (opt_outfile)
	fputs(prompt, OUTFILE);
      line= readline(prompt);
#endif /* defined( __WIN__) || defined(OS2) || defined(__NETWARE__) */
#endif /* defined( __WIN__) || defined(__NETWARE__) */

      /*
        When Ctrl+d or Ctrl+z is pressed, the line may be NULL on some OS
@@ -1110,7 +1083,7 @@ static int read_and_execute(bool interactive)
    }
  }

#if defined( __WIN__) || defined(OS2) || defined(__NETWARE__)
#if defined( __WIN__) || defined(__NETWARE__)
  buffer.free();
#endif
#if defined( __WIN__)
@@ -2315,31 +2288,48 @@ print_table_data(MYSQL_RES *result)
    mysql_field_seek(result, 0);
    for (uint off= 0; off < mysql_num_fields(result); off++)
    {
      const char *str= cur[off] ? cur[off] : "NULL";
      uint currlength;
      uint maxlength;
      uint numcells;
      const char *buffer;
      uint data_length;
      uint field_max_length;
      bool right_justified;
      uint visible_length;
      uint extra_padding;

      field= mysql_fetch_field(result);
      maxlength= field->max_length;
      currlength= (uint) lengths[off];
      numcells= charset_info->cset->numcells(charset_info, 
                                                    str, str + currlength);
      if (maxlength > MAX_COLUMN_LENGTH)
      if (lengths[off] == 0) 
      {
        tee_print_sized_data(str, currlength, maxlength);
        tee_fputs(" |", PAGER);
        buffer= "NULL";
        data_length= 4;
      } 
      else 
      {
        if (num_flag[off] != 0)
          tee_fprintf(PAGER, " %-*s|", maxlength + currlength - numcells, str);
        buffer= cur[off];
        data_length= (uint) lengths[off];
      }

      field= mysql_fetch_field(result);
      field_max_length= field->max_length;

      /* 
       How many text cells on the screen will this string span?  If it contains
       multibyte characters, then the number of characters we occupy on screen
       will be fewer than the number of bytes we occupy in memory.

       We need to find how much screen real-estate we will occupy to know how 
       many extra padding-characters we should send with the printing function.
      */
      visible_length= charset_info->cset->numcells(charset_info, buffer, buffer + data_length);
      extra_padding= data_length - visible_length;

      if (field_max_length > MAX_COLUMN_LENGTH)
        tee_print_sized_data(buffer, data_length, MAX_COLUMN_LENGTH+extra_padding, FALSE);
      else
      {
          tee_print_sized_data(str, currlength, maxlength);
          tee_fputs(" |", PAGER);
        }
        if (num_flag[off] != 0) /* if it is numeric, we right-justify it */
          tee_print_sized_data(buffer, data_length, field_max_length+extra_padding, TRUE);
        else 
          tee_print_sized_data(buffer, data_length, field_max_length+extra_padding, FALSE);
      }
      tee_fputs(" | ", PAGER);
    }
    (void) tee_fputs("\n", PAGER);
  }
@@ -2349,10 +2339,9 @@ print_table_data(MYSQL_RES *result)


static void
tee_print_sized_data(const char *data, unsigned int length, unsigned int width)
tee_print_sized_data(const char *data, unsigned int data_length, unsigned int total_bytes_to_send, bool right_justified)
{
  /* 
    It is not a number, so print each character justified to the left.
    For '\0's print ASCII spaces instead, as '\0' is eaten by (at
    least my) console driver, and that messes up the pretty table
    grid.  (The \0 is also the reason we can't use fprintf() .) 
@@ -2360,9 +2349,14 @@ tee_print_sized_data(const char *data, unsigned int length, unsigned int width)
  unsigned int i;
  const char *p;

  tee_putc(' ', PAGER);
  total_bytes_to_send -= 1;  
  /* Off by one, perhaps mistakenly accounting for a terminating NUL. */

  if (right_justified) 
    for (i= 0; i < (total_bytes_to_send - data_length); i++)
      tee_putc((int)' ', PAGER);

  for (i= 0, p= data; i < length; i+= 1, p+= 1)
  for (i= 0, p= data; i < data_length; i+= 1, p+= 1)
  {
    if (*p == '\0')
      tee_putc((int)' ', PAGER);
@@ -2370,8 +2364,8 @@ tee_print_sized_data(const char *data, unsigned int length, unsigned int width)
      tee_putc((int)*p, PAGER);
  }

  i+= 1; 
  for (   ; i < width; i+= 1)
  if (! right_justified) 
    for (i= 0; i < (total_bytes_to_send - data_length); i++)
      tee_putc((int)' ', PAGER);
}

@@ -3360,7 +3354,7 @@ put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate)
    if (info_type == INFO_ERROR)
    {
      if (!opt_nobeep)
	putchar('\007');		      	/* This should make a bell */
        putchar('\a');		      	/* This should make a bell */
      vidattr(A_STANDOUT);
      if (error)
      {
@@ -3408,9 +3402,6 @@ void tee_fprintf(FILE *file, const char *fmt, ...)
  NETWARE_YIELD;
  va_start(args, fmt);
  (void) vfprintf(file, fmt, args);
#ifdef OS2
  fflush( file);
#endif
  va_end(args);

  if (opt_outfile)
@@ -3426,9 +3417,6 @@ void tee_fputs(const char *s, FILE *file)
{
  NETWARE_YIELD;
  fputs(s, file);
#ifdef OS2
  fflush( file);
#endif
  if (opt_outfile)
    fputs(s, OUTFILE);
}
@@ -3439,9 +3427,6 @@ void tee_puts(const char *s, FILE *file)
  NETWARE_YIELD;
  fputs(s, file);
  fputs("\n", file);
#ifdef OS2
  fflush( file);
#endif
  if (opt_outfile)
  {
    fputs(s, OUTFILE);
@@ -3452,14 +3437,11 @@ void tee_puts(const char *s, FILE *file)
void tee_putc(int c, FILE *file)
{
  putc(c, file);
#ifdef OS2
  fflush( file);
#endif
  if (opt_outfile)
    putc(c, OUTFILE);
}

#if defined( __WIN__) || defined( OS2) || defined(__NETWARE__)
#if defined( __WIN__) || defined(__NETWARE__)
#include <time.h>
#else
#include <sys/times.h>
@@ -3471,7 +3453,7 @@ void tee_putc(int c, FILE *file)

static ulong start_timer(void)
{
#if defined( __WIN__) || defined( OS2) || defined(__NETWARE__)
#if defined( __WIN__) || defined(__NETWARE__)
 return clock();
#else
  struct tms tms_tmp;
+1 −1
Original line number Diff line number Diff line
@@ -2215,7 +2215,7 @@ static unsigned long Clock()
    return ru.ru_utime.tv_sec*1000 + ru.ru_utime.tv_usec/1000;
}

#elif defined(MSDOS) || defined(__WIN__) || defined(OS2)
#elif defined(MSDOS) || defined(__WIN__)

static ulong Clock()
{
Loading