~stewart/drizzle/remove-unused-row-type-in-table-message

« back to all changes in this revision

Viewing changes to client/drizzletest.cc

  • Committer: Monty Taylor
  • Date: 2010-06-19 21:25:32 UTC
  • mfrom: (1627.2.5 build)
  • Revision ID: mordred@inaugust.com-20100619212532-2e4bd11tm4plya7q
Rollup patch featuring: boost::program_options support for plugins, a
valgrind fix, a bugfix for password processing and a few build fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
103
103
static uint32_t opt_port= 0;
104
104
static uint32_t opt_max_connect_retries;
105
105
static bool silent= false, verbose= false;
106
 
static bool tty_password= false;
107
106
static bool opt_mark_progress= false;
108
107
static bool parsing_disabled= false;
109
108
static bool display_result_vertically= false,
115
114
static bool server_initialized= false;
116
115
static bool is_windows= false;
117
116
static bool opt_mysql= false;
118
 
const string PASSWORD_SENTINEL("\0\0\0\0\0", 5);
119
117
static char line_buffer[MAX_DELIMITER_LENGTH], *line_buffer_pos= line_buffer;
120
118
 
121
119
std::string opt_basedir,
5388
5386
  opt_sleep= in_opt_sleep;
5389
5387
}
5390
5388
 
5391
 
static pair<string, string> parse_password_arg(std::string s)
5392
 
{
5393
 
  if (s.find("--password") == 0)
5394
 
  {
5395
 
    if (s == "--password")
5396
 
    {
5397
 
      tty_password= true;
5398
 
      //check if no argument is passed.
5399
 
      return make_pair("password", PASSWORD_SENTINEL);
5400
 
    }
5401
 
 
5402
 
    if (s.substr(10,3) == "=\"\"" || s.substr(10,3) == "=''")
5403
 
    {
5404
 
      // Check if --password="" or --password=''
5405
 
      return make_pair("password", PASSWORD_SENTINEL);
5406
 
    }
5407
 
    
5408
 
    if(s.substr(10) == "=" && s.length() == 11)
5409
 
    {
5410
 
      // check if --password= and return a default value
5411
 
      return make_pair("password", PASSWORD_SENTINEL);
5412
 
    }
5413
 
 
5414
 
    if(s.length()>12 && (s[10] == '"' || s[10] == '\''))
5415
 
    {
5416
 
      // check if --password has quotes, remove quotes and return the value
5417
 
      return make_pair("password", s.substr(11,s.length()-1));
5418
 
    }
5419
 
 
5420
 
    // if all above are false, it implies that --password=value, return value.
5421
 
    return make_pair("password", s.substr(11));
5422
 
  }
5423
 
 
5424
 
  else
5425
 
  {
5426
 
    return make_pair(string(""), string(""));
5427
 
  } 
5428
 
}
5429
 
 
5430
5389
int main(int argc, char **argv)
5431
5390
{
5432
5391
try