~drizzle-developers/pkg-drizzle/trunk

« back to all changes in this revision

Viewing changes to client/drizzledump.cc

  • Committer: Hudson
  • Date: 2010-09-10 22:49:08 UTC
  • mfrom: (1273.485.36 staging)
  • Revision ID: hudson@orisndriz03-20100910224908-cb0fq7vjdg87sag5
* Non-maintainer upload.
* Merged from trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
83
83
static bool  verbose= false;
84
84
static bool opt_no_create_info;
85
85
static bool opt_no_data= false;
86
 
static bool opt_mysql= false;
 
86
static bool use_drizzle_protocol= false;
87
87
static bool quick= true;
88
88
static bool extended_insert= true;
89
89
static bool ignore_errors= false;
137
137
  lines_terminated,
138
138
  current_user,
139
139
  opt_password,
 
140
  opt_protocol,
140
141
  where;
141
142
 
142
143
static const CHARSET_INFO *charset_info= &my_charset_utf8_general_ci;
501
502
{
502
503
  drizzle_return_t ret;
503
504
 
504
 
  verbose_msg(_("-- Connecting to %s...\n"), ! host.empty() ? (char *)host.c_str() : "localhost");
 
505
  verbose_msg(_("-- Connecting to %s, using protocol %s...\n"), ! host.empty() ? (char *)host.c_str() : "localhost", opt_protocol.c_str());
505
506
  drizzle_create(&drizzle);
506
507
  drizzle_con_create(&drizzle, &dcon);
507
508
  drizzle_con_set_tcp(&dcon, (char *)host.c_str(), opt_drizzle_port);
508
509
  drizzle_con_set_auth(&dcon, (char *)user.c_str(), (char *)passwd.c_str());
509
 
  if (opt_mysql)
510
 
    drizzle_con_add_options(&dcon, DRIZZLE_CON_MYSQL);
 
510
  drizzle_con_add_options(&dcon, use_drizzle_protocol ? DRIZZLE_CON_EXPERIMENTAL : DRIZZLE_CON_MYSQL);
511
511
  ret= drizzle_con_connect(&dcon);
512
512
  if (ret != DRIZZLE_RETURN_OK)
513
513
  {
2500
2500
  client_options.add_options()
2501
2501
  ("host,h", po::value<string>(&current_host)->default_value("localhost"),
2502
2502
  N_("Connect to host."))
2503
 
  ("mysql,m", po::value<bool>(&opt_mysql)->default_value(true)->zero_tokens(),
2504
 
  N_("Use MySQL Protocol."))
2505
2503
  ("password,P", po::value<string>(&password)->default_value(PASSWORD_SENTINEL),
2506
2504
  N_("Password to use when connecting to server. If password is not given it's solicited on the tty."))
2507
2505
  ("port,p", po::value<uint32_t>(&opt_drizzle_port)->default_value(0),
2508
2506
  N_("Port number to use for connection."))
2509
2507
  ("user,u", po::value<string>(&current_user)->default_value(""),
2510
2508
  N_("User for login if not current user."))
2511
 
  ("protocol",po::value<string>(),
2512
 
  N_("The protocol of connection (tcp,socket,pipe,memory)."))
 
2509
  ("protocol",po::value<string>(&opt_protocol)->default_value("mysql"),
 
2510
  N_("The protocol of connection (mysql or drizzle)."))
2513
2511
  ;
2514
2512
 
2515
2513
  po::options_description hidden_options(N_("Hidden Options"));
2588
2586
      exit(1);
2589
2587
  }
2590
2588
 
 
2589
  if (vm.count("protocol"))
 
2590
  {
 
2591
    std::transform(opt_protocol.begin(), opt_protocol.end(),
 
2592
      opt_protocol.begin(), ::tolower);
 
2593
 
 
2594
    if (not opt_protocol.compare("mysql"))
 
2595
      use_drizzle_protocol=false;
 
2596
    else if (not opt_protocol.compare("drizzle"))
 
2597
      use_drizzle_protocol=true;
 
2598
    else
 
2599
    {
 
2600
      cout << _("Error: Unknown protocol") << " '" << opt_protocol << "'" << endl;
 
2601
      exit(-1);
 
2602
    }
 
2603
  }
 
2604
 
2591
2605
  if (vm.count("port"))
2592
2606
  {
2593
2607
    /* If the port number is > 65535 it is not a valid port