DISTINCT optimization

Fixes when using column privileges
Manual updates


Docs/manual.texi:
  Comments from MySQL training + distinct optimization
extra/my_print_defaults.c:
  Added --defaults-extra-file
include/my_sys.h:
  Added --defaults-extra-file
mysys/default.c:
  Added --defaults-extra-file
sql/sql_acl.cc:
  Tables with only column privileges didn't show up in SHOW GRANTS or SHOW TABLES
sql/sql_select.cc:
  DISTINCT optimization
sql/sql_select.h:
  DISTINCT optimization
BitKeeper/etc/logging_ok:
  Logging to logging@openlogging.org accepted
This commit is contained in:
unknown 2000-10-06 21:15:03 +03:00
commit 6991b70c87
8 changed files with 277 additions and 125 deletions

View file

@ -29,8 +29,9 @@
** The following arguments are handled automaticly; If used, they must be
** first argument on the command line!
** --no-defaults ; no options are read.
** --print-defaults ; Print the modified command line and exit
** --defaults-file=full-path-to-default-file ; Only this file will be read.
** --defaults-extra-file=full-path-to-default-file ; Read this file before ~/
** --print-defaults ; Print the modified command line and exit
****************************************************************************/
#undef SAFEMALLOC /* safe_malloc is not yet initailized */
@ -39,6 +40,8 @@
#include "m_string.h"
#include "m_ctype.h"
char *defaults_extra_file=0;
/* Which directories are searched for options (and in which order) */
const char *default_directories[]= {
@ -50,6 +53,7 @@ const char *default_directories[]= {
#ifdef DATADIR
DATADIR,
#endif
"", /* Place for defaults_extra_dir */
#ifndef __WIN__
"~/",
#endif
@ -71,9 +75,10 @@ void load_defaults(const char *conf_file, const char **groups,
int *argc, char ***argv)
{
DYNAMIC_ARRAY args;
const char **dirs, *extra_default_file;
const char **dirs, *forced_default_file;
TYPELIB group;
my_bool found_print_defaults=0;
uint args_used=0;
MEM_ROOT alloc;
char *ptr,**res;
DBUG_ENTER("load_defaults");
@ -97,9 +102,20 @@ void load_defaults(const char *conf_file, const char **groups,
}
/* Check if we want to force the use a specific default file */
extra_default_file=0;
if (*argc >= 2 && is_prefix(argv[0][1],"--defaults-file="))
extra_default_file=strchr(argv[0][1],'=')+1;
forced_default_file=0;
if (*argc >= 2)
{
if (is_prefix(argv[0][1],"--defaults-file="))
{
forced_default_file=strchr(argv[0][1],'=')+1;
args_used++;
}
else if (is_prefix(argv[0][1],"--defaults-extra-file="))
{
defaults_extra_file=strchr(argv[0][1],'=')+1;
args_used++;
}
}
group.count=0;
group.name= "defaults";
@ -109,9 +125,9 @@ void load_defaults(const char *conf_file, const char **groups,
if (init_dynamic_array(&args, sizeof(char*),*argc, 32))
goto err;
if (extra_default_file)
if (forced_default_file)
{
if (search_default_file(&args, &alloc, "", extra_default_file, "",
if (search_default_file(&args, &alloc, "", forced_default_file, "",
&group))
goto err;
}
@ -132,8 +148,14 @@ void load_defaults(const char *conf_file, const char **groups,
#endif
for (dirs=default_directories ; *dirs; dirs++)
{
if (search_default_file(&args, &alloc, *dirs, conf_file, default_ext,
&group))
int error;
if (**dirs)
error=search_default_file(&args, &alloc, *dirs, conf_file,
default_ext, &group);
else if (defaults_extra_file)
error=search_default_file(&args, &alloc, NullS, defaults_extra_file,
default_ext, &group);
if (error)
goto err;
}
}
@ -145,11 +167,9 @@ void load_defaults(const char *conf_file, const char **groups,
/* copy name + found arguments + command line arguments to new array */
res[0]=argv[0][0];
memcpy((gptr) (res+1), args.buffer, args.elements*sizeof(char*));
if (extra_default_file)
{
--*argc; /* Skipp --defaults-file */
++*argv;
}
/* Skipp --defaults-file and --defaults-extra-file */
(*argc)-= args_used;
(*argv)+= args_used;
/* Check if we wan't to see the new argument list */
if (*argc >= 2 && !strcmp(argv[0][1],"--print-defaults"))