~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.cc

  • Committer: patrick crews
  • Date: 2011-02-04 02:13:52 UTC
  • mto: This revision was merged to the branch mainline in revision 2142.
  • Revision ID: gleebix@gmail.com-20110204021352-pbc6v6hyb2ak1hlg
Revert patch for lp:709653.  The patch causes the help menu to be displayed every time the program is run.  Need to reopen the bug / determine if we want to fix this

Show diffs side-by-side

added added

removed removed

Lines of Context:
176
176
  lock_id(&main_lock_id),
177
177
  thread_stack(NULL),
178
178
  security_ctx(identifier::User::make_shared()),
179
 
  where(Session::DEFAULT_WHERE),
 
179
  _where(Session::DEFAULT_WHERE),
180
180
  dbug_sentry(Session_SENTRY_MAGIC),
181
181
  mysys_var(0),
182
182
  command(COM_CONNECT),
355
355
#endif
356
356
  {
357
357
    TransactionServices &transaction_services= TransactionServices::singleton();
358
 
    transaction_services.rollbackTransaction(this, true);
 
358
    transaction_services.rollbackTransaction(*this, true);
359
359
    xid_cache_delete(&transaction.xid_state);
360
360
  }
361
361
 
388
388
    assert(security_ctx);
389
389
    if (global_system_variables.log_warnings)
390
390
    {
391
 
      errmsg_printf(ERRMSG_LVL_WARN, ER(ER_FORCING_CLOSE),
 
391
      errmsg_printf(error::WARN, ER(ER_FORCING_CLOSE),
392
392
                    internal::my_progname,
393
393
                    thread_id,
394
394
                    security_ctx->username().c_str());
773
773
       * (Which of course should never happen...)
774
774
       */
775
775
      server_status&= ~SERVER_STATUS_IN_TRANS;
776
 
      if (transaction_services.commitTransaction(this, true))
 
776
      if (transaction_services.commitTransaction(*this, true))
777
777
        result= false;
778
778
      options&= ~(OPTION_BEGIN);
779
779
      break;
790
790
    case ROLLBACK_AND_CHAIN:
791
791
    {
792
792
      server_status&= ~SERVER_STATUS_IN_TRANS;
793
 
      if (transaction_services.rollbackTransaction(this, true))
 
793
      if (transaction_services.rollbackTransaction(*this, true))
794
794
        result= false;
795
795
      options&= ~(OPTION_BEGIN);
796
796
      if (result == true && (completion == ROLLBACK_AND_CHAIN))
827
827
  if (options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
828
828
  {
829
829
    server_status&= ~SERVER_STATUS_IN_TRANS;
830
 
    if (transaction_services.commitTransaction(this, true))
 
830
    if (transaction_services.commitTransaction(*this, true))
831
831
      result= false;
832
832
  }
833
833
  options&= ~(OPTION_BEGIN);
873
873
    first_successful_insert_id_in_cur_stmt= 0;
874
874
    substitute_null_with_insert_id= true;
875
875
  }
 
876
 
876
877
  arg_of_last_insert_id_function= false;
 
878
 
877
879
  /* Free Items that were created during this execution */
878
880
  free_items();
879
 
  /* Reset where. */
880
 
  where= Session::DEFAULT_WHERE;
 
881
 
 
882
  /* Reset _where. */
 
883
  _where= Session::DEFAULT_WHERE;
881
884
 
882
885
  /* Reset the temporary shares we built */
883
886
  for_each(temporary_shares.begin(),
1673
1676
  {
1674
1677
    if (not getKilled() && variables.log_warnings > 1)
1675
1678
    {
1676
 
      errmsg_printf(ERRMSG_LVL_WARN, ER(ER_NEW_ABORTING_CONNECTION)
 
1679
      errmsg_printf(error::WARN, ER(ER_NEW_ABORTING_CONNECTION)
1677
1680
                  , thread_id
1678
1681
                  , (_schema->empty() ? "unconnected" : _schema->c_str())
1679
1682
                  , security_ctx->username().empty() == false ? security_ctx->username().c_str() : "unauthenticated"
1811
1814
 
1812
1815
user_var_entry *Session::getVariable(const std::string  &name, bool create_if_not_exists)
1813
1816
{
1814
 
  UserVarsRange ppp= user_vars.equal_range(name);
 
1817
  if (cleanup_done)
 
1818
    return NULL;
1815
1819
 
1816
 
  for (UserVars::iterator iter= ppp.first;
1817
 
       iter != ppp.second; ++iter)
1818
 
  {
 
1820
  UserVars::iterator iter= user_vars.find(name);
 
1821
  if (iter != user_vars.end())
1819
1822
    return (*iter).second;
1820
 
  }
1821
1823
 
1822
1824
  if (not create_if_not_exists)
1823
1825
    return NULL;
1841
1843
void Session::setVariable(const std::string &name, const std::string &value)
1842
1844
{
1843
1845
  user_var_entry *updateable_var= getVariable(name.c_str(), true);
1844
 
 
1845
 
  updateable_var->update_hash(false,
1846
 
                              (void*)value.c_str(),
1847
 
                              static_cast<uint32_t>(value.length()), STRING_RESULT,
1848
 
                              &my_charset_bin,
1849
 
                              DERIVATION_IMPLICIT, false);
 
1846
  if (updateable_var)
 
1847
  {
 
1848
    updateable_var->update_hash(false,
 
1849
                                (void*)value.c_str(),
 
1850
                                static_cast<uint32_t>(value.length()), STRING_RESULT,
 
1851
                                &my_charset_bin,
 
1852
                                DERIVATION_IMPLICIT, false);
 
1853
  }
1850
1854
}
1851
1855
 
1852
1856
void Open_tables_state::mark_temp_tables_as_free_for_reuse()
1901
1905
  {
1902
1906
    TransactionServices &transaction_services= TransactionServices::singleton();
1903
1907
    main_da.can_overwrite_status= true;
1904
 
    transaction_services.autocommitOrRollback(this, is_error());
 
1908
    transaction_services.autocommitOrRollback(*this, is_error());
1905
1909
    main_da.can_overwrite_status= false;
1906
1910
    transaction.stmt.reset();
1907
1911
  }
1984
1988
    {
1985
1989
      std::string path;
1986
1990
      identifier.getSQLPath(path);
1987
 
      errmsg_printf(ERRMSG_LVL_WARN, _("Could not remove temporary table: '%s', error: %d"),
 
1991
      errmsg_printf(error::WARN, _("Could not remove temporary table: '%s', error: %d"),
1988
1992
                    path.c_str(), errno);
1989
1993
    }
1990
1994
 
2003
2007
  {
2004
2008
    std::string path;
2005
2009
    identifier.getSQLPath(path);
2006
 
    errmsg_printf(ERRMSG_LVL_WARN, _("Could not remove temporary table: '%s', error: %d"),
 
2010
    errmsg_printf(error::WARN, _("Could not remove temporary table: '%s', error: %d"),
2007
2011
                  path.c_str(), error);
2008
2012
 
2009
2013
    return true;