~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzledump.cc

Added code necessary for building plugins dynamically.
Merged in changes from lifeless to allow autoreconf to work.
Touching plugin.ini files now triggers a rebuid - so config/autorun.sh is no
longer required to be run after touching those.
Removed the duplicate plugin names - also removed the issue that getting them
different would silently fail weirdly later.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
#include <mysys/my_sys.h>
36
36
#include <mystrings/m_string.h>
37
37
#include <mystrings/m_ctype.h>
38
 
#include <mysys/hash.h>
 
38
#include "drizzled/hash.h"
39
39
#include <stdarg.h>
40
40
#include <algorithm>
41
41
 
154
154
static TYPELIB compatible_mode_typelib= {array_elements(compatible_mode_names) - 1,
155
155
                                  "", compatible_mode_names, NULL};
156
156
 
157
 
HASH ignore_table;
 
157
drizzled::hash_set<string> ignore_table;
158
158
 
159
159
static struct my_option my_long_options[] =
160
160
{
518
518
} /* write_footer */
519
519
 
520
520
 
521
 
static void free_table_ent(char *key)
522
 
{
523
 
  free(key);
524
 
}
525
 
 
526
 
 
527
 
static unsigned char* get_table_key(const char *entry, size_t *length, bool)
528
 
{
529
 
  *length= strlen(entry);
530
 
  return (unsigned char*) entry;
531
 
}
532
 
 
533
 
 
534
521
extern "C" bool get_one_option(int optid, const struct my_option *, char *argument);
535
522
 
536
523
extern "C" bool get_one_option(int optid, const struct my_option *, char *argument)
646
633
      fprintf(stderr, _("Illegal use of option --ignore-table=<database>.<table>\n"));
647
634
      exit(1);
648
635
    }
649
 
    char * tmpptr= strdup(argument);
650
 
    if (!(tmpptr) || my_hash_insert(&ignore_table, (unsigned char*)tmpptr))
651
 
      exit(EX_EOM);
 
636
    string tmpptr(argument);
 
637
    ignore_table.insert(tmpptr); 
652
638
    break;
653
639
  }
654
640
  case (int) OPT_COMPATIBLE:
696
682
  load_defaults("drizzle",load_default_groups,argc,argv);
697
683
  defaults_argv= *argv;
698
684
 
699
 
  if (hash_init(&ignore_table, charset_info, 16, 0, 0,
700
 
                (hash_get_key) get_table_key,
701
 
                (hash_free_key) free_table_ent, 0))
702
 
    return(EX_EOM);
703
 
 
704
685
  if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option)))
705
686
    return(ho_error);
706
687
 
914
895
  if (md_result_file && md_result_file != stdout)
915
896
    fclose(md_result_file);
916
897
  free(opt_password);
917
 
  if (hash_inited(&ignore_table))
918
 
    hash_free(&ignore_table);
919
898
  if (defaults_argv)
920
899
    free_defaults(defaults_argv);
921
900
  my_end(my_end_arg);
2372
2351
 
2373
2352
/* Return 1 if we should copy the table */
2374
2353
 
2375
 
static bool include_table(const unsigned char *hash_key, size_t len)
 
2354
static bool include_table(const char *hash_key, size_t key_size)
2376
2355
{
2377
 
  return !hash_search(&ignore_table, hash_key, len);
 
2356
  string match(hash_key, key_size);
 
2357
  drizzled::hash_set<string>::iterator iter= ignore_table.find(match);
 
2358
  return (iter == ignore_table.end());
2378
2359
}
2379
2360
 
2380
2361
 
2386
2367
  drizzle_result_st result;
2387
2368
  drizzle_return_t ret;
2388
2369
 
 
2370
  memset(hash_key, 0, DRIZZLE_MAX_DB_SIZE+DRIZZLE_MAX_TABLE_SIZE+2);
2389
2371
  afterdot= strcpy(hash_key, database) + strlen(database);
2390
2372
  *afterdot++= '.';
2391
2373
 
2407
2389
  while ((table= getTableName(0)))
2408
2390
  {
2409
2391
    char *end= strcpy(afterdot, table) + strlen(table);
2410
 
    if (include_table((unsigned char*) hash_key, end - hash_key))
 
2392
    if (include_table(hash_key, end - hash_key))
2411
2393
    {
2412
2394
      dump_table(table,database);
2413
2395
      free(order_by);
2851
2833
  drizzle_result_st result;
2852
2834
 
2853
2835
  compatible_mode_normal_str[0]= 0;
2854
 
  memset(&ignore_table, 0, sizeof(ignore_table));
2855
2836
 
2856
2837
  exit_code= get_options(&argc, &argv);
2857
2838
  if (exit_code)