~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzledump.cc

  • Committer: Olaf van der Spek
  • Date: 2011-04-05 12:26:58 UTC
  • mto: (2278.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2272.
  • Revision ID: olafvdspek@gmail.com-20110405122658-xxrvmobwwwwf3oct
Refactor Open_tables_state

Show diffs side-by-side

added added

removed removed

Lines of Context:
247
247
      cout << " (Drizzle server)";
248
248
    cout << endl << endl;
249
249
  }
 
250
 
250
251
} /* write_header */
251
252
 
252
253
 
430
431
  return 0;
431
432
}
432
433
 
433
 
static int do_unlock_tables()
434
 
{
435
 
  db_connection->queryNoResult("UNLOCK TABLES");
436
 
  return 0;
437
 
}
438
 
 
439
434
static int start_transaction()
440
435
{
441
436
  db_connection->queryNoResult("SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ");
442
437
  db_connection->queryNoResult("START TRANSACTION WITH CONSISTENT SNAPSHOT");
 
438
 
 
439
  if (db_connection->getServerType() == ServerDetect::SERVER_DRIZZLE_FOUND)
 
440
  {
 
441
    drizzle_result_st *result;
 
442
    drizzle_row_t row;
 
443
    std::string query("SELECT COMMIT_ID, ID FROM DATA_DICTIONARY.SYS_REPLICATION_LOG WHERE COMMIT_ID=(SELECT MAX(COMMIT_ID) FROM DATA_DICTIONARY.SYS_REPLICATION_LOG)");
 
444
    result= db_connection->query(query);
 
445
    if ((row= drizzle_row_next(result)))
 
446
    {
 
447
      cout << "-- SYS_REPLICATION_LOG: COMMIT_ID = " << row[0] << ", ID = " << row[1] << endl << endl;
 
448
    }
 
449
    db_connection->freeResult(result);
 
450
  }
 
451
 
443
452
  return 0;
444
453
}
445
454
 
524
533
  _("Do not make a UTF8 connection to MySQL, use if you have UTF8 data in a non-UTF8 table"))
525
534
  ;
526
535
 
 
536
  const char* unix_user= getlogin();
 
537
 
527
538
  po::options_description client_options(_("Options specific to the client"));
528
539
  client_options.add_options()
529
540
  ("host,h", po::value<string>(&current_host)->default_value("localhost"),
532
543
  _("Password to use when connecting to server. If password is not given it's solicited on the tty."))
533
544
  ("port,p", po::value<uint32_t>(&opt_drizzle_port)->default_value(0),
534
545
  _("Port number to use for connection."))
535
 
  ("user,u", po::value<string>(&current_user)->default_value(""),
 
546
  ("user,u", po::value<string>(&current_user)->default_value((unix_user ? unix_user : "")),
536
547
  _("User for login if not current user."))
537
548
  ("protocol",po::value<string>(&opt_protocol)->default_value("mysql"),
538
549
  _("The protocol of connection (mysql or drizzle)."))
769
780
    goto err;
770
781
  if (opt_lock_all_tables)
771
782
    db_connection->queryNoResult("FLUSH LOGS");
772
 
  if (opt_single_transaction && do_unlock_tables()) /* unlock but no commit! */
773
 
    goto err;
774
783
 
775
784
  if (opt_alldbs)
776
785
  {