~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzle.cc

  • Committer: Brian Aker
  • Date: 2011-02-27 04:21:54 UTC
  • mto: (2215.6.2 drizzle-trunk)
  • mto: This revision was merged to the branch mainline in revision 2231.
  • Revision ID: brian@tangent.org-20110227042154-mn2wtbd7rraphswo
First pass through in going over work for MySQL AUTH PLUGIN style support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
164
164
/* Buffer to hold 'version' and 'version_comment' */
165
165
const int MAX_SERVER_VERSION_LENGTH= 128;
166
166
 
 
167
/* Options used during connect */
 
168
drizzle_con_options_t global_con_options= DRIZZLE_CON_NONE;
 
169
 
167
170
#define PROMPT_CHAR '\\'
168
171
 
169
172
class Status
1486
1489
#endif
1487
1490
  _("User for login if not current user."))
1488
1491
  ("protocol",po::value<string>(&opt_protocol)->default_value("mysql"),
1489
 
  _("The protocol of connection (mysql or drizzle)."))
 
1492
  _("The protocol of connection (mysql, mysql-plugin-auth, or drizzle)."))
1490
1493
  ;
1491
1494
 
1492
1495
  po::options_description long_options(_("Allowed Options"));
1702
1705
      opt_protocol.begin(), ::tolower);
1703
1706
 
1704
1707
    if (not opt_protocol.compare("mysql"))
1705
 
      use_drizzle_protocol=false;
 
1708
    {
 
1709
 
 
1710
      global_con_options= (drizzle_con_options_t)(DRIZZLE_CON_MYSQL|DRIZZLE_CON_INTERACTIVE);
 
1711
      use_drizzle_protocol= false;
 
1712
    }
 
1713
    else if (not opt_protocol.compare("mysql-plugin-auth"))
 
1714
    {
 
1715
      global_con_options= (drizzle_con_options_t)(DRIZZLE_CON_MYSQL|DRIZZLE_CON_INTERACTIVE|DRIZZLE_CON_AUTH_PLUGIN);
 
1716
      use_drizzle_protocol= false;
 
1717
    }
1706
1718
    else if (not opt_protocol.compare("drizzle"))
1707
 
      use_drizzle_protocol=true;
 
1719
    {
 
1720
      global_con_options= (drizzle_con_options_t)(DRIZZLE_CON_EXPERIMENTAL);
 
1721
      use_drizzle_protocol= true;
 
1722
    }
1708
1723
    else
1709
1724
    {
1710
1725
      cout << _("Error: Unknown protocol") << " '" << opt_protocol << "'" << endl;
1948
1963
  drizzle_return_t ret;
1949
1964
 
1950
1965
  /* terminate if no query being executed, or we already tried interrupting */
1951
 
  if (!executing_query || interrupted_query) {
 
1966
  if (!executing_query || interrupted_query)
 
1967
  {
1952
1968
    goto err;
1953
1969
  }
1954
1970
 
4222
4238
  drizzle_create(&drizzle);
4223
4239
 
4224
4240
#ifdef DRIZZLE_ADMIN_TOOL
4225
 
  drizzle_con_options_t options= (drizzle_con_options_t) (DRIZZLE_CON_ADMIN | (use_drizzle_protocol ? DRIZZLE_CON_EXPERIMENTAL : DRIZZLE_CON_MYSQL|DRIZZLE_CON_INTERACTIVE));
4226
 
#else
4227
 
  drizzle_con_options_t options= (drizzle_con_options_t) (use_drizzle_protocol ? DRIZZLE_CON_EXPERIMENTAL : DRIZZLE_CON_MYSQL|DRIZZLE_CON_INTERACTIVE);
 
4241
  global_con_options= (drizzle_con_options_t) (DRIZZLE_CON_ADMIN | global_con_options);
4228
4242
#endif
4229
4243
 
4230
4244
  if (drizzle_con_add_tcp(&drizzle, &con, (char *)host.c_str(),
4231
4245
                          opt_drizzle_port, (char *)user.c_str(),
4232
4246
                          (char *)password.c_str(), (char *)database.c_str(),
4233
 
                          options) == NULL)
 
4247
                          global_con_options) == NULL)
4234
4248
  {
4235
4249
    (void) put_error(&con, NULL);
4236
4250
    (void) fflush(stdout);