~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzletest.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:
114
114
static bool abort_on_error= true;
115
115
static bool server_initialized= false;
116
116
static bool is_windows= false;
117
 
static bool opt_mysql= false;
 
117
static bool use_drizzle_protocol= false;
118
118
static char line_buffer[MAX_DELIMITER_LENGTH], *line_buffer_pos= line_buffer;
119
119
 
120
120
std::string opt_basedir,
127
127
  password,
128
128
  opt_password,
129
129
  result_file_name,
130
 
  opt_user;
 
130
  opt_user,
 
131
  opt_protocol;
131
132
 
132
133
static uint32_t start_lineno= 0; /* Start line of current command */
133
134
 
3938
3939
    die("Failed on drizzle_create()");
3939
3940
  if (!drizzle_con_create(con_slot->drizzle, &con_slot->con))
3940
3941
    die("Failed on drizzle_con_create()");
3941
 
  if (opt_mysql)
3942
 
    drizzle_con_add_options(&con_slot->con, DRIZZLE_CON_MYSQL);
 
3942
  drizzle_con_add_options(&con_slot->con, use_drizzle_protocol ? DRIZZLE_CON_EXPERIMENTAL : DRIZZLE_CON_MYSQL);
3943
3943
 
3944
3944
  /* Use default db name */
3945
3945
  if (ds_database.length() == 0)
5453
5453
 
5454
5454
  ("host,h", po::value<string>(&opt_host)->default_value("localhost"),
5455
5455
  "Connect to host.")
5456
 
  ("mysql,m", po::value<bool>(&opt_mysql)->default_value(true)->zero_tokens(),
5457
 
  N_("Use MySQL Protocol."))
5458
5456
  ("password,P", po::value<string>(&password)->default_value("PASSWORD_SENTINEL"),
5459
5457
  "Password to use when connecting to server.")
5460
5458
  ("port,p", po::value<uint32_t>(&opt_port)->default_value(0),
5461
5459
  "Port number to use for connection or 0 for default")
5462
 
  ("protocol", po::value<string>(),
5463
 
  "The protocol of connection (tcp,socket,pipe,memory).")
 
5460
  ("protocol", po::value<string>(&opt_protocol),
 
5461
  "The protocol of connection (mysql or drizzle).")
5464
5462
  ("user,u", po::value<string>(&opt_user)->default_value(""),
5465
5463
  "User for login.")
5466
5464
  ;
5587
5585
    unlink(timer_file);       /* Ignore error, may not exist */
5588
5586
  }
5589
5587
 
 
5588
  if (vm.count("protocol"))
 
5589
  {
 
5590
    std::transform(opt_protocol.begin(), opt_protocol.end(),
 
5591
      opt_protocol.begin(), ::tolower);
 
5592
 
 
5593
    if (not opt_protocol.compare("mysql"))
 
5594
      use_drizzle_protocol=false;
 
5595
    else if (not opt_protocol.compare("drizzle"))
 
5596
      use_drizzle_protocol=true;
 
5597
    else
 
5598
    {
 
5599
      cout << _("Error: Unknown protocol") << " '" << opt_protocol << "'" << endl;
 
5600
      exit(-1);
 
5601
    }
 
5602
  }
 
5603
 
5590
5604
  if (vm.count("port"))
5591
5605
  {
5592
5606
    /* If the port number is > 65535 it is not a valid port
5661
5675
    die("Failed in drizzle_create()");
5662
5676
  if (!( drizzle_con_create(cur_con->drizzle, &cur_con->con)))
5663
5677
    die("Failed in drizzle_con_create()");
5664
 
  if (opt_mysql)
5665
 
    drizzle_con_add_options(&cur_con->con, DRIZZLE_CON_MYSQL);
 
5678
  drizzle_con_add_options(&cur_con->con, use_drizzle_protocol ? DRIZZLE_CON_EXPERIMENTAL : DRIZZLE_CON_MYSQL);
5666
5679
 
5667
5680
  if (!(cur_con->name = strdup("default")))
5668
5681
    die("Out of memory");