~ubuntu-branches/ubuntu/utopic/mysql-workbench/utopic

« back to all changes in this revision

Viewing changes to backend/wbprivate/workbench/wb_context.cpp

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2014-05-31 12:03:58 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20140531120358-cjik5ofkmj0fxsn8
Tags: 6.1.6+dfsg-1
* New upstream release [May 2014].
* Dropped "prtcl.patch".
* "debian/clean": better clean-up.

Show diffs side-by-side

added added

removed removed

Lines of Context:
789
789
 
790
790
//--------------------------------------------------------------------------------------------------
791
791
 
792
 
void *WBContext::do_request_password(const std::string &title, const std::string &service, std::string &account, 
793
 
                                    bool force_asking, std::string* ret_password)
 
792
/**
 
793
 * Actually triggers the password find or user querying process for the given service. The given account
 
794
 * can be empty if the connection has no user set so we must be able to return it like the password.
 
795
 * Both, account as well as password must be allocated by the caller and passed on via references as
 
796
 * this function is called via the dispatcher.
 
797
 * For the same reason is the return value passed back as pointer, even though it's a bool.
 
798
 */
 
799
void* WBContext::do_request_password(const std::string &title, const std::string &service, 
 
800
  bool force_asking, std::string *account, std::string *password)
794
801
{
795
802
  bool ret = false;
796
803
 
797
 
  // ret_password must be passed as a pointer, because passing by reference
798
 
  // will not work through the dispatcher
799
 
  
800
804
  try
801
805
  {
802
 
    ret = mforms::Utilities::find_or_ask_for_password(title, service, account, force_asking, *ret_password);
 
806
    ret = mforms::Utilities::credentials_for_service(title, service, *account, force_asking, *password);
803
807
  }
804
808
  catch (const std::exception &e)
805
809
  {
850
854
{
851
855
  std::string password_tmp;
852
856
  std::string user_tmp = conn->parameterValues().get_string("userName");
853
 
  /*
854
 
  ret = execute_in_main_thread<bool>("request connection password",
855
 
                                     boost::bind(&WBContext::do_request_password, this,
856
 
                                                _("Connect to MySQL Server"),
857
 
                                                conn->hostIdentifier(),
858
 
                                                user_tmp,
859
 
                                                reset_password,
860
 
                                                &password_tmp));
861
 
                                                */
 
857
  bool need_user_name = user_tmp.empty();
862
858
  void *ret = mforms::Utilities::perform_from_main_thread(
863
859
                      boost::bind(&WBContext::do_request_password, this,
864
860
                                  _("Connect to MySQL Server"),
865
861
                                  conn->hostIdentifier(),
866
 
                                  user_tmp,
867
862
                                  reset_password,
 
863
                                  &user_tmp,
868
864
                                  &password_tmp));
 
865
  if (need_user_name && !user_tmp.empty())
 
866
    conn->parameterValues().gset("userName", user_tmp);
869
867
  if (ret)
870
868
    return password_tmp;
871
869
  throw grt::user_cancelled("Canceled by user");
1677
1675
  set_default(options, "DbSqlEditor:ReadTimeOut", 600); // in seconds
1678
1676
  set_default(options, "DbSqlEditor:MaxQuerySizeToHistory", 65536);
1679
1677
  set_default(options, "DbSqlEditor:ContinueOnError", 0); // continue running sql script bypassing failed statements
1680
 
  set_default(options, "DbSqlEditor:AutocommitMode", 1); // when enabled, each statement will be commited immediately
 
1678
  set_default(options, "DbSqlEditor:AutocommitMode", 1); // when enabled, each statement will be committed immediately
1681
1679
  set_default(options, "DbSqlEditor:IsDataChangesCommitWizardEnabled", 1);
1682
1680
  set_default(options, "DbSqlEditor:ShowSchemaTreeSchemaContents", 1);
1683
1681
  set_default(options, "DbSqlEditor:SafeUpdates", 1);