Commit 0c7ea54c authored by jani@rhols221.arenanet.fi's avatar jani@rhols221.arenanet.fi
Browse files

Merge work:/home/bk/mysql-4.0

into rhols221.arenanet.fi:/home/my/bk/mysql-4.0
parents dfd27660 16e3b892
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -13,9 +13,11 @@ davida@isil.mysql.com
heikki@donna.mysql.fi
heikki@hundin.mysql.fi
jani@dsl-jkl1657.dial.inet.fi
jani@hynda.(none)
jani@hynda.mysql.fi
jani@janikt.pp.saunalahti.fi
jani@rhols221.adsl.netsonic.fi
jani@rhols221.arenanet.fi
jcole@abel.spaceapes.com
jcole@main.burghcom.com
jcole@mugatu.spaceapes.com
@@ -59,7 +61,6 @@ tonu@volk.internalnet
tonu@x153.internalnet
tonu@x3.internalnet
venu@work.mysql.com
worm@altair.is.lan
zak@balfor.local
zak@linux.local
jani@hynda.(none)
worm@altair.is.lan
+4 −3
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@
#include <signal.h>
#include <violite.h>

const char *VER= "12.6";
const char *VER= "12.7";

/* Don't try to make a nice table if the data is too big */
#define MAX_COLUMN_LENGTH	     1024
@@ -467,10 +467,11 @@ static struct my_option my_long_options[] =
  {"force", 'f', "Continue even if we get an sql error.",
   (gptr*) &ignore_errors, (gptr*) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
   0, 0, 0, 0},
  {"no-named-commands", 'g', "Named commands are disabled. Use \\* form only, or use named commands only in the beginning of a line ending with a semicolon (;) Since version 10.9 the client now starts with this option ENABLED by default! Disable with '-G'. Long format commands still work from the first line. WARNING: option depricated; use --disable-named-commands instead.",
  {"no-named-commands", 'g',
   "Named commands are disabled. Use \\* form only, or use named commands only in the beginning of a line ending with a semicolon (;) Since version 10.9 the client now starts with this option ENABLED by default! Disable with '-G'. Long format commands still work from the first line. WARNING: option depricated; use --disable-named-commands instead.",
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
  {"named-commands", 'G',
   "Enable named commands. Disable with --disable-named-commands. This option is disabled by default.",
   "Enable named commands. Named commands mean this program's internal commands; see mysql> help . When enabled, the named commands can be used from any line of the query, otherwise only from the first line, before an enter. Disable with --disable-named-commands. This option is disabled by default.",
   (gptr*) &named_cmds, (gptr*) &named_cmds, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
   0, 0},
  {"ignore-space", 'i', "Ignore space after function names.", 0, 0, 0,
+71 −32
Original line number Diff line number Diff line
@@ -14,22 +14,46 @@
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

/* Written by Sergei A. Golubchik, who has a shared copyright to this code */
/* Written by Sergei A. Golubchik, who has a shared copyright to this code
   added support for long options (my_getopt) 22.5.2002 by Jani Tolonen */

#include "ftdefs.h"
#include <getopt.h>
#include <my_getopt.h>

static void get_options(int argc,char *argv[]);
static void usage(char *argv[]);
static void usage();
static void complain(int val);

static int count=0, stats=0, dump=0, verbose=0, lstats=0;
static int count=0, stats=0, dump=0, lstats=0;
static my_bool verbose;
static char *query=NULL;
static uint lengths[256];

#define MAX_LEN (HA_FT_MAXLEN+10)
#define HOW_OFTEN_TO_WRITE 10000

static struct my_option my_long_options[] =
{
  {"dump", 'd', "Dump index (incl. data offsets and word weights)",
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
  {"stats", 's', "Report global stats",
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
  {"verbose", 'v', "Be verbose",
   (gptr*) &verbose, (gptr*) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
  {"count", 'c', "Calculate per-word stats (counts and global weights)",
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
  {"length", 'l', "Report length distribution",
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
  {"execute", 'e', "Execute given query", (gptr*) &query, (gptr*) &query, 0,
   GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
  {"help", 'h', "Display help and exit",
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
  {"help", '?', "Synonym for -h",
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
  { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};


int main(int argc,char *argv[])
{
  int error=0;
@@ -52,7 +76,7 @@ int main(int argc,char *argv[])
    setbuf(stdout,NULL);

  if (argc-optind < 2)
    usage(argv);
    usage();

  if (!(info=mi_open(argv[optind],2,HA_OPEN_ABORT_IF_LOCKED)))
    goto err;
@@ -184,45 +208,60 @@ int main(int argc,char *argv[])
  return 0;
}

const char *options="dslcvh";

static void get_options(int argc, char *argv[])
{
  int c;

  while ((c=getopt(argc,argv,options)) != -1)
static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
	       char *argument __attribute__((unused)))
{
    switch(c) {
    case 'd': dump=1; complain(count || query); break;
    case 's': stats=1; complain(query!=0); break;
    case 'v': verbose=1; break;
    case 'c': count=1; complain(dump || query); break;
    case 'l': lstats=1; complain(query!=0); break;
    case 'e': query=my_strdup(optarg,MYF(MY_FAE)); complain(dump || count || stats); break;
  switch(optid) {
  case 'd':
    dump=1; 
    complain(count || query);
    break;
  case 's': 
    stats=1; 
    complain(query!=0);
    break;
  case 'c': 
    count= 1;
    complain(dump || query);
    break;
  case 'l': 
    lstats=1;
    complain(query!=0);
    break;
  case 'e':
    complain(dump || count || stats);
    break;
  case '?':
  case 'h':
    default:
      usage(argv);
    usage();
  }
  return 0;
}

static void get_options(int argc, char *argv[])
{
  int ho_error;

  if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
  {
    printf("%s: handle_options() failed with error %d\n", my_progname,
	   ho_error);
    exit(1);
  }
  return;
} /* get options */

static void usage(char *argv[])
{
  printf("\n\
Use: %s [-%s] <table_name> <index_no>\n\
\n\
-d      Dump index (incl. data offsets and word weights)\n\
-s      Report global stats\n\
-c      Calculate per-word stats (counts and global weights)\n\
-l      Report length distribution\n\
-v      Be verbose\n\
-h      This text\n\
", *argv, options);

static void usage()
{
  printf("Use: ft_dump <table_name> <index_no>\n");
  my_print_help(my_long_options);
  my_print_variables(my_long_options);
  exit(1);
}


static void complain(int val) /* Kinda assert :-)  */
{
  if (val)
+81 −47
Original line number Diff line number Diff line
@@ -11,16 +11,30 @@
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

/* Written by Sergei A. Golubchik, who has a shared copyright to this code */
/* Written by Sergei A. Golubchik, who has a shared copyright to this code
   added support for long options (my_getopt) 22.5.2002 by Jani Tolonen */

#include "ftdefs.h"
#include "ft_eval.h"
#include <stdarg.h>
#include <getopt.h>
#include <my_getopt.h>

static void print_error(int exit_code, const char *fmt,...);
static void get_options(int argc, char *argv[]);
static int create_record(char *pos, FILE *file);
static void usage();

static struct my_option my_long_options[] =
{
  {"", 's', "", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
  {"", 'q', "", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
  {"", 'S', "", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
  {"", '#', "", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
  {"", 'V', "", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
  {"", '?', "", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
  {"", 'h', "", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
  { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};

int main(int argc, char *argv[])
{
@@ -81,7 +95,9 @@ int main(int argc,char *argv[])
  if (!silent)
    printf("- Reading rows with key\n");
  for(i=1;create_record(record,qf);i++) {
    FT_DOCLIST *result; double w; int t,err;
    FT_DOCLIST *result;
    double w;
    int t, err;

    result=ft_nlq_init_search(file,0,blob_record,(uint) strlen(blob_record),1);
    if(!result) {
@@ -106,20 +122,19 @@ int main(int argc,char *argv[])
  my_end(MY_CHECK_ERROR);

  return (0);

 err:
  printf("got error: %3d when using myisam-database\n",my_errno);
  return 1;			/* skipp warning */
  return 1;			/* skip warning */

}

static void get_options(int argc,char *argv[])
{
  int c;
  char *options=(char*) "Vh#:qSs:";

  while ((c=getopt(argc,argv,options)) != -1)
static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
	       char *argument)
{
    switch(c) {
  switch(optid) {
  case 's':
    if(stopwordlist && stopwordlist!=ft_precompiled_stopwords) break;
    {
@@ -127,11 +142,11 @@ static void get_options(int argc,char *argv[])

      if(!(stopwordlist=(const char**) malloc(n*sizeof(char *))))
	print_error(1,"malloc(%d)",n*sizeof(char *));
	if(!(f=fopen(optarg,"r")))
	  print_error(1,"fopen(%s)",optarg);
      if(!(f=fopen(argument,"r")))
	print_error(1,"fopen(%s)",argument);
      while(!feof(f)) {
	if(!(fgets(s,HA_FT_MAXLEN,f)))
	    print_error(1,"fgets(s,%d,%s)",HA_FT_MAXLEN,optarg);
	  print_error(1,"fgets(s,%d,%s)",HA_FT_MAXLEN,argument);
	if(!(stopwordlist[i++]=strdup(s)))
	  print_error(1,"strdup(%s)",s);
	if(i>=n) {
@@ -148,15 +163,26 @@ static void get_options(int argc,char *argv[])
  case 'S': if(stopwordlist==ft_precompiled_stopwords) stopwordlist=NULL; break;
  case '#':
    DEBUGGER_ON;
      DBUG_PUSH (optarg);
    DBUG_PUSH (argument);
    break;
  case 'V':
  case '?':
  case 'h':
    default:
      printf("%s -[%s] <d_file> <q_file>\n", argv[0], options);
      exit(0);
    usage();
    exit(1);
  }
  return 0;
}

static void get_options(int argc, char *argv[])
{
  int ho_error;

  if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
  {
    printf("%s: handle_options() failed with error %d\n", my_progname,
	   ho_error);
    exit(1);
  }
  if(!(d_file=argv[optind])) print_error(1,"No d_file");
  if(!(df=fopen(d_file,"r")))
@@ -206,3 +232,11 @@ static void print_error(int exit_code, const char *fmt,...)
  va_end(args);
  exit(exit_code);
}


static void usage()
{
  printf("%s [options]\n", my_progname);
  my_print_help(my_long_options);
  my_print_variables(my_long_options);
}
+62 −26
Original line number Diff line number Diff line
@@ -14,11 +14,12 @@
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

/* Written by Sergei A. Golubchik, who has a shared copyright to this code */
/* Written by Sergei A. Golubchik, who has a shared copyright to this code
   added support for long options (my_getopt) 22.5.2002 by Jani Tolonen */

#include "ftdefs.h"
#include "ft_test1.h"
#include <getopt.h>
#include <my_getopt.h>

static int key_field=FIELD_VARCHAR,extra_field=FIELD_SKIP_ENDSPACE;
static uint key_length=200,extra_length=50;
@@ -33,6 +34,24 @@ static char record[MAX_REC_LENGTH],read_record[MAX_REC_LENGTH];
static int run_test(const char *filename);
static void get_options(int argc, char *argv[]);
static void create_record(char *, int);
static void usage();

static struct my_option my_long_options[] =
{
  {"", 'v', "", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
  {"", '?', "", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
  {"", 'h', "", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
  {"", 'V', "", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
  {"", 'v', "", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
  {"", 's', "", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
  {"", 'N', "", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
  {"", 'S', "", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
  {"", 'K', "", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
  {"", 'F', "", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
  {"", 'U', "", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
  {"", '#', "", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
  { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};

int main(int argc, char *argv[])
{
@@ -173,7 +192,7 @@ static int run_test(const char *filename)
  return (0);
err:
  printf("got error: %3d when using myisam-database\n",my_errno);
  return 1;			/* skipp warning */
  return 1;			/* skip warning */
}

static char blob_key[MAX_REC_LENGTH];
@@ -232,16 +251,12 @@ void create_record(char *pos, int n)
  }
}

/* Read options */

static void get_options(int argc,char *argv[])
static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
	       char *argument)
{
  int c;
  const char *options="hVvsNSKFU#:";

  while ((c=getopt(argc,argv,options)) != -1)
  {
    switch(c) {
  switch(optid) {
  case 'v': verbose=1; break;
  case 's': silent=1; break;
  case 'F': no_fulltext=1; no_search=1;
@@ -251,15 +266,36 @@ static void get_options(int argc,char *argv[])
  case 'S': no_stopwords=1; break;
  case '#':
    DEBUGGER_ON;
      DBUG_PUSH (optarg);
    DBUG_PUSH (argument);
    break;
  case 'V':
  case '?':
  case 'h':
    default:
      printf("%s -[%s]\n", argv[0], options);
      exit(0);
    usage();
    exit(1);
  }
  return 0;
}

/* Read options */

static void get_options(int argc,char *argv[])
{
  int ho_error;

  if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
  {
    printf("%s: handle_options() failed with error %d\n", my_progname,
	   ho_error);
    exit(1);
  }
  return;
} /* get options */


static void usage()
{
  printf("%s [options]\n", my_progname);
  my_print_help(my_long_options);
  my_print_variables(my_long_options);
}
Loading