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

Fixes for OS2.

Fix bug in isamlog
Add argument types to function declarations.
parent 063a1a65
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -46155,6 +46155,8 @@ incredible help we got in managing the MySQL mailing lists.
@item Igor Romanenko @email{igor@@frog.kiev.ua}
@code{mysqldump} (previously @code{msqldump}, but ported and enhanced by
Monty).
@item Yuri Dario
For keeping up and extending the MySQL OS/2 port.
@item Tim Bunce, Alligator Descartes
For the @code{DBD} (Perl) interface.
@item Tim Bunce
@@ -46282,6 +46284,8 @@ MySQL server.
@item Albert Chin-A-Young.
Configure updates for Tru64, large file support and better TCP wrappers
support.
@item John Birrell
Emulation of pthread_mutex() for OS/2.
@end table
Other contributors, bugfinders, and testers: James H. Thompson, Maurizio
@@ -46543,6 +46547,8 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.42
@itemize @bullet
@item
Applied large patch for OS/2 from Yuri Dario.
@item
Fixed problem with InnoDB when one could get the error @code{Can't
execute the given command...} even when one didn't have an active
transaction.
+30 −8
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ extern "C" {

#undef bcmp				// Fix problem with new readline
#undef bzero
#ifdef __WIN__
#if defined( __WIN__) || defined(OS2)
#include <conio.h>
#else
#include <readline/readline.h>
@@ -569,7 +569,7 @@ static int get_options(int argc, char **argv)

  set_all_changeable_vars(changeable_vars);
  while ((c=getopt_long(argc,argv,
			"?ABCD:LfgGHinNoqrstTU::vVw::WEe:h:O:P:S:u:#::p::",
			(char*) "?ABCD:LfgGHinNoqrstTU::vVw::WEe:h:O:P:S:u:#::p::",
			long_options, &option_index)) != EOF)
  {
    switch(c) {
@@ -767,10 +767,20 @@ static int get_options(int argc, char **argv)
  return(0);
}

#if  defined(OS2)
static char* readline( char* prompt)
{
#if defined(OS2)
   static char linebuffer[254];
#endif
   puts( prompt);
   return gets( linebuffer);
}
#endif

static int read_lines(bool execute_commands)
{
#ifdef __WIN__
#if defined( __WIN__) || defined(OS2)
  char linebuffer[254];
#endif
  char	*line;
@@ -790,7 +800,7 @@ static int read_lines(bool execute_commands)
    }
    else
    {
#ifdef __WIN__
#if defined( __WIN__) || defined(OS2)
      if (opt_outfile && glob_buffer.is_empty())
	fflush(OUTFILE);
      tee_fputs(glob_buffer.is_empty() ? "mysql> " :
@@ -1483,7 +1493,7 @@ com_go(String *buffer,char *line __attribute__((unused)))

static void init_pager()
{
#ifndef __WIN__
#if !defined( __WIN__) && !defined( OS2)
  if (!opt_nopager)
  {
    if (!(PAGER= popen(pager, "w")))
@@ -1499,7 +1509,7 @@ static void init_pager()

static void end_pager()
{
#ifndef __WIN__
#if !defined( __WIN__) && !defined( OS2)
  if (!opt_nopager)
    pclose(PAGER);
#endif
@@ -2337,6 +2347,9 @@ void tee_fprintf(FILE *file, const char *fmt, ...)

  va_start(args, fmt);
  (void) vfprintf(file, fmt, args);
#ifdef OS2
  fflush( file);
#endif
  if (opt_outfile)
    (void) vfprintf(OUTFILE, fmt, args);
  va_end(args);
@@ -2346,6 +2359,9 @@ void tee_fprintf(FILE *file, const char *fmt, ...)
void tee_fputs(const char *s, FILE *file)
{
  fputs(s, file);
#ifdef OS2
  fflush( file);
#endif
  if (opt_outfile)
    fputs(s, OUTFILE);
}
@@ -2355,6 +2371,9 @@ void tee_puts(const char *s, FILE *file)
{
  fputs(s, file);
  fputs("\n", file);
#ifdef OS2
  fflush( file);
#endif
  if (opt_outfile)
  {
    fputs(s, OUTFILE);
@@ -2365,11 +2384,14 @@ 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);
}

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

static ulong start_timer(void)
{
#ifdef __WIN__
#if defined( __WIN__) || defined( OS2)
 return clock();
#else
  struct tms tms_tmp;
+7 −5
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@ static struct option long_options[] = {
  {0, 0, 0, 0}
};

CHANGEABLE_VAR changeable_vars[] = {
static CHANGEABLE_VAR changeable_vars[] = {
  { "connect_timeout", (long*) &opt_connect_timeout, 0, 0, 3600*12, 0, 1},
  { "shutdown_timeout", (long*) &opt_shutdown_timeout, SHUTDOWN_DEF_TIMEOUT, 0,
    3600*12, 0, 1},
@@ -152,7 +152,8 @@ int main(int argc,char *argv[])
  load_defaults("my",load_default_groups,&argc,&argv);
  set_all_changeable_vars( changeable_vars );

  while ((c=getopt_long(argc,argv,"h:i:p::u:#::P:sS:Ct:fq?vVw::WrEO:",
  while ((c=getopt_long(argc,argv,
			(char*) "h:i:p::u:#::P:sS:Ct:fq?vVw::WrEO:",
			long_options, &option_index)) != EOF)
  {
    switch(c) {
@@ -1121,14 +1122,15 @@ static void wait_pidfile(char *pidfile)
  uint count=0;

  system_filename(buff,pidfile);
  while ((fd = open(buff, O_RDONLY)) >= 0 && count++ < opt_shutdown_timeout)
  while ((fd = my_open(buff, O_RDONLY, MYF(0))) >= 0 &&
	 count++ < opt_shutdown_timeout)
  {
    close(fd);
    my_close(fd,MYF(0));
    sleep(1);
  }
  if (fd >= 0)
  {
    close(fd);
    my_close(fd,MYF(0));
    fprintf(stderr,
	    "Warning;  Aborted waiting on pid file: '%s' after %d seconds\n",
	    buff, count-1);
+42 −42
Original line number Diff line number Diff line
@@ -85,11 +85,11 @@ static int first_error=0;
extern ulong net_buffer_length;
static DYNAMIC_STRING extended_row;
#include "sslopt-vars.h"
FILE  *result_file;
FILE  *md_result_file;

enum options {OPT_FTB=256, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC, OPT_KEYWORDS,
	      OPT_LOCKS, OPT_DROP, OPT_OPTIMIZE, OPT_DELAYED, OPT_TABLES,
              OPT_CHARSETS_DIR, OPT_DEFAULT_CHARSET};
enum md_options {OPT_FTB=256, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC,
		 OPT_KEYWORDS, OPT_LOCKS, OPT_DROP, OPT_OPTIMIZE, OPT_DELAYED,
		 OPT_TABLES, MD_OPT_CHARSETS_DIR, MD_OPT_DEFAULT_CHARSET};

static struct option long_options[] =
{
@@ -98,12 +98,12 @@ static struct option long_options[] =
  {"add-drop-table",	no_argument,    0, 	OPT_DROP},
  {"add-locks",    	no_argument,    0,	OPT_LOCKS},
  {"allow-keywords",	no_argument,    0, 	OPT_KEYWORDS},
  {"character-sets-dir",required_argument,0,    OPT_CHARSETS_DIR},
  {"character-sets-dir",required_argument,0,    MD_OPT_CHARSETS_DIR},
  {"complete-insert",	no_argument,    0, 	'c'},
  {"compress",          no_argument,    0, 	'C'},
  {"databases",         no_argument,    0,      'B'},
  {"debug",		optional_argument, 	0, '#'},
  {"default-character-set", required_argument,  0, OPT_DEFAULT_CHARSET},
  {"default-character-set", required_argument,  0, MD_OPT_DEFAULT_CHARSET},
  {"delayed-insert",	no_argument,    0, 	OPT_DELAYED},
  {"extended-insert",   no_argument,    0, 	'e'},
  {"fields-terminated-by", required_argument,   0, (int) OPT_FTB},
@@ -145,7 +145,7 @@ static struct option long_options[] =

static const char *load_default_groups[]= { "mysqldump","client",0 };

CHANGEABLE_VAR changeable_vars[] = {
CHANGEABLE_VAR md_changeable_vars[] = {
  { "max_allowed_packet", (long*) &max_allowed_packet,24*1024*1024,4096,
    24*1024L*1024L,MALLOC_OVERHEAD,1024},
  { "net_buffer_length", (long*) &net_buffer_length,1024*1024L-1025,4096,
@@ -265,10 +265,10 @@ puts("\
  print_defaults("my",load_default_groups);

  printf("\nPossible variables for option --set-variable (-O) are:\n");
  for (i=0 ; changeable_vars[i].name ; i++)
  for (i=0 ; md_changeable_vars[i].name ; i++)
    printf("%-20s  current value: %lu\n",
     changeable_vars[i].name,
     (ulong) *changeable_vars[i].varptr);
     md_changeable_vars[i].name,
     (ulong) *md_changeable_vars[i].varptr);
} /* usage */


@@ -290,9 +290,9 @@ static int get_options(int *argc,char ***argv)
  int c,option_index;
  my_bool tty_password=0;

  result_file=stdout;
  md_result_file=stdout;
  load_defaults("my",load_default_groups,argc,argv);
  set_all_changeable_vars(changeable_vars);
  set_all_changeable_vars(md_changeable_vars);
  while ((c=getopt_long(*argc,*argv,
			"#::p::h:u:O:P:r:S:T:EBaAcCdefFlnqtvVw:?Ix",
			long_options, &option_index)) != EOF)
@@ -307,10 +307,10 @@ static int get_options(int *argc,char ***argv)
    case 'A':
      opt_alldbs=1;
      break;
    case OPT_DEFAULT_CHARSET:
    case MD_OPT_DEFAULT_CHARSET:
      default_charset= optarg;
      break;
    case OPT_CHARSETS_DIR:
    case MD_OPT_CHARSETS_DIR:
      charsets_dir= optarg;
      break;
    case 'f':
@@ -332,7 +332,7 @@ static int get_options(int *argc,char ***argv)
      break;
#endif
    case 'O':
      if (set_changeable_var(optarg, changeable_vars))
      if (set_changeable_var(optarg, md_changeable_vars))
      {
	usage();
	return(1);
@@ -355,7 +355,7 @@ static int get_options(int *argc,char ***argv)
      opt_mysql_port= (unsigned int) atoi(optarg);
      break;
    case 'r':
      if (!(result_file = my_fopen(optarg, O_WRONLY | O_BINARY,
      if (!(md_result_file = my_fopen(optarg, O_WRONLY | O_BINARY,
				   MYF(MY_WME))))
	exit(1);
      break;
@@ -602,7 +602,7 @@ static uint getTableStructure(char *table, char* db)
  char 	     *strpos, *table_name;
  const char *delayed;
  char 	     name_buff[NAME_LEN+3],table_buff[NAME_LEN+3];
  FILE       *sql_file = result_file;
  FILE       *sql_file = md_result_file;
  DBUG_ENTER("getTableStructure");

  delayed= opt_delayed ? " DELAYED " : "";
@@ -973,14 +973,14 @@ static void dumpTable(uint numFields, char *table)
  }
  else
  {
    fprintf(result_file,"\n#\n# Dumping data for table '%s'\n", table);
    fprintf(md_result_file,"\n#\n# Dumping data for table '%s'\n", table);
    sprintf(query, "SELECT * FROM %s", quote_name(table,table_buff));
    if (where)
    {
      fprintf(result_file,"# WHERE:  %s\n",where);
      fprintf(md_result_file,"# WHERE:  %s\n",where);
      strxmov(strend(query), " WHERE ",where,NullS);
    }
    fputs("#\n\n", result_file);
    fputs("#\n\n", md_result_file);

    if (mysql_query(sock, query))
    {
@@ -1007,7 +1007,7 @@ static void dumpTable(uint numFields, char *table)
    }

    if (opt_lock)
      fprintf(result_file,"LOCK TABLES %s WRITE;\n",
      fprintf(md_result_file,"LOCK TABLES %s WRITE;\n",
	      quote_name(table,table_buff));

    total_length=net_buffer_length;		/* Force row break */
@@ -1021,7 +1021,7 @@ static void dumpTable(uint numFields, char *table)
      ulong *lengths=mysql_fetch_lengths(res);
      rownr++;
      if (!extended_insert)
	fputs(insert_pat,result_file);
	fputs(insert_pat,md_result_file);
      mysql_field_seek(res,0);

      for (i = 0; i < mysql_num_fields(res); i++)
@@ -1075,17 +1075,17 @@ static void dumpTable(uint numFields, char *table)
	else
	{
	  if (i)
	    fputc(',',result_file);
	    fputc(',',md_result_file);
	  if (row[i])
	  {
	    if (!IS_NUM_FIELD(field))
	      unescape(result_file, row[i], lengths[i]);
	      unescape(md_result_file, row[i], lengths[i]);
	    else
	      fputs(row[i],result_file);
	      fputs(row[i],md_result_file);
	  }
	  else
	  {
	    fputs("NULL",result_file);
	    fputs("NULL",md_result_file);
	  }
	}
      }
@@ -1098,25 +1098,25 @@ static void dumpTable(uint numFields, char *table)
        if (total_length + row_length < net_buffer_length)
        {
	  total_length += row_length;
	  fputc(',',result_file);		/* Always row break */
	  fputs(extended_row.str,result_file);
	  fputc(',',md_result_file);		/* Always row break */
	  fputs(extended_row.str,md_result_file);
	}
        else
        {
	  if (row_break)
	    fputs(";\n", result_file);
	    fputs(";\n", md_result_file);
	  row_break=1;				/* This is first row */
	  fputs(insert_pat,result_file);
	  fputs(extended_row.str,result_file);
	  fputs(insert_pat,md_result_file);
	  fputs(extended_row.str,md_result_file);
	  total_length = row_length+init_length;
        }
      }
      else
	fputs(");\n", result_file);
	fputs(");\n", md_result_file);
    }
    if (extended_insert && row_break)
      fputs(";\n", result_file);		/* If not empty table */
    fflush(result_file);
      fputs(";\n", md_result_file);		/* If not empty table */
    fflush(md_result_file);
    if (mysql_errno(sock))
    {
      sprintf(query,"%s: Error %d: %s when dumping table '%s' at row: %ld\n",
@@ -1130,7 +1130,7 @@ static void dumpTable(uint numFields, char *table)
      return;
    }
    if (opt_lock)
      fputs("UNLOCK TABLES;\n", result_file);
      fputs("UNLOCK TABLES;\n", md_result_file);
    mysql_free_result(res);
  }
} /* dumpTable */
@@ -1206,11 +1206,11 @@ static int init_dumping(char *database)
  {
    if (opt_databases || opt_alldbs)
    {
      fprintf(result_file,"\n#\n# Current Database: %s\n#\n", database);
      fprintf(md_result_file,"\n#\n# Current Database: %s\n#\n", database);
      if (!opt_create_db)
	fprintf(result_file,"\nCREATE DATABASE /*!32312 IF NOT EXISTS*/ %s;\n",
	fprintf(md_result_file,"\nCREATE DATABASE /*!32312 IF NOT EXISTS*/ %s;\n",
		database);
      fprintf(result_file,"\nUSE %s;\n", database);
      fprintf(md_result_file,"\nUSE %s;\n", database);
    }
  }
  if (extended_insert)
@@ -1342,7 +1342,7 @@ int main(int argc, char **argv)
  if (dbConnect(current_host, current_user, opt_password))
    exit(EX_MYSQLERR);
  if (!path)
    write_heder(result_file, *argv);
    write_heder(md_result_file, *argv);

   if (opt_first_slave)
   {
@@ -1378,9 +1378,9 @@ int main(int argc, char **argv)
   }
  }
  dbDisconnect(current_host);
  fputs("\n", result_file);
  if (result_file != stdout)
    my_fclose(result_file, MYF(0));
  fputs("\n", md_result_file);
  if (md_result_file != stdout)
    my_fclose(md_result_file, MYF(0));
  my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
  if (extended_insert)
    dynstr_free(&extended_row);
+7 −6
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ static char *field_escape(char *to,const char *from,uint length);
static char *add_load_option(char *ptr,const char *object,
			     const char *statement);

static my_bool	verbose=0,lock_tables=0,ignore_errors=0,delete=0,
static my_bool	verbose=0,lock_tables=0,ignore_errors=0,opt_delete=0,
		replace=0,silent=0,ignore=0,opt_compress=0,opt_local_file=0;

static MYSQL	mysql_connection;
@@ -54,7 +54,7 @@ static uint opt_mysql_port=0;
static my_string opt_mysql_unix_port=0;
#include "sslopt-vars.h"

enum options {OPT_FTB=256, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC,
enum mi_options {OPT_FTB=256, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC,
		 OPT_LOW_PRIORITY, OPT_CHARSETS_DIR, OPT_DEFAULT_CHARSET};

static struct option long_options[] =
@@ -173,7 +173,8 @@ static int get_options(int *argc, char ***argv)
  int c, option_index;
  my_bool tty_password=0;

  while ((c=getopt_long(*argc,*argv,"#::p::c:h:u:P:S:CdfilLrsvV?IW",
  while ((c=getopt_long(*argc,*argv,
			(char*) "#::p::c:h:u:P:S:CdfilLrsvV?IW",
			long_options, &option_index)) != EOF)
  {
    switch(c) {
@@ -190,7 +191,7 @@ static int get_options(int *argc, char ***argv)
      charsets_dir= optarg;
      break;
    case 'd':
      delete= 1;
      opt_delete= 1;
      break;
    case 'f':
      ignore_errors= 1;
@@ -313,7 +314,7 @@ static int write_to_table(char *filename, MYSQL *sock)
  else
    my_load_path(hard_path, filename, NULL); /* filename includes the path */

  if (delete)
  if (opt_delete)
  {
    if (verbose)
      fprintf(stdout, "Deleting the old data from table %s\n", tablename);
Loading