~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzleimport.cc

  • Committer: LinuxJedi
  • Date: 2010-09-03 17:08:15 UTC
  • mto: (1747.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1748.
  • Revision ID: linuxjedi@linuxjedi-laptop-20100903170815-1p8d7tmq5zuyokw8
Remove the --mysql option and convert the --protocol option to do something similar.

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
static bool verbose= false, ignore_errors= false,
56
56
            opt_delete= false, opt_replace= false, silent= false,
57
57
            ignore_unique= false, opt_low_priority= false,
58
 
            opt_mysql= false, opt_local_file;
 
58
            use_drizzle_protocol= false, opt_local_file;
59
59
 
60
60
static uint32_t opt_use_threads;
61
61
static uint32_t opt_drizzle_port= 0;
71
71
  opt_password,
72
72
  enclosed,  
73
73
  current_host,
74
 
  fields_terminated;
 
74
  fields_terminated,
 
75
  opt_protocol;
75
76
 
76
77
 
77
78
static int get_options(void)
196
197
  drizzle_return_t ret;
197
198
 
198
199
  if (verbose)
199
 
    fprintf(stdout, "Connecting to %s\n", ! host.empty() ? host.c_str() : "localhost");
 
200
    fprintf(stdout, "Connecting to %s, using protocol %s...\n", ! host.empty() ? host.c_str() : "localhost", opt_protocol.c_str());
200
201
  if (!(drizzle= drizzle_create(NULL)))
201
202
    return 0;
202
203
  if (!(con= drizzle_con_add_tcp(drizzle,NULL,(char *)host.c_str(),opt_drizzle_port,(char *)user.c_str(),(char *)passwd.c_str(),
203
 
                                 (char *)database.c_str(), opt_mysql ? DRIZZLE_CON_MYSQL : DRIZZLE_CON_NONE)))
 
204
                                 (char *)database.c_str(), use_drizzle_protocol ? DRIZZLE_CON_EXPERIMENTAL : DRIZZLE_CON_MYSQL)))
204
205
  {
205
206
    return 0;
206
207
  }
400
401
  client_options.add_options()
401
402
  ("host,h", po::value<string>(&current_host)->default_value("localhost"),
402
403
  "Connect to host.")
403
 
  ("mysql,m", po::value<bool>(&opt_mysql)->default_value(true)->zero_tokens(),
404
 
  N_("Use MySQL Protocol."))
405
404
  ("password,P", po::value<string>(&password),
406
405
  "Password to use when connecting to server. If password is not given it's asked from the tty." )
407
406
  ("port,p", po::value<uint32_t>(&opt_drizzle_port)->default_value(0),
408
407
  "Port number to use for connection") 
409
 
  ("protocol", po::value<string>(),
410
 
  "The protocol of connection (tcp,socket,pipe,memory).")
 
408
  ("protocol", po::value<string>(&opt_protocol)->default_value("mysql"),
 
409
  "The protocol of connection (mysql or drizzle).")
411
410
  ("user,u", po::value<string>(&current_user)->default_value(""),
412
411
  "User for login if not current user.")
413
412
  ;
447
446
  po::store(parse_config_file(system_client_ifs, client_options), vm);
448
447
 
449
448
  po::notify(vm);
 
449
  if (vm.count("protocol"))
 
450
  {
 
451
    std::transform(opt_protocol.begin(), opt_protocol.end(),
 
452
      opt_protocol.begin(), ::tolower);
 
453
 
 
454
    if (not opt_protocol.compare("mysql"))
 
455
      use_drizzle_protocol=false;
 
456
    else if (not opt_protocol.compare("drizzle"))
 
457
      use_drizzle_protocol=true;
 
458
    else
 
459
    {
 
460
      cout << _("Error: Unknown protocol") << " '" << opt_protocol << "'" << endl;
 
461
      exit(-1);
 
462
    }
 
463
  }
450
464
 
451
465
  if (vm.count("port"))
452
466
  {