~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.cc

merge READ COMMITTED bug fix

Show diffs side-by-side

added added

removed removed

Lines of Context:
626
626
  return true;
627
627
}
628
628
 
629
 
bool Session::checkUser(const char *passwd, uint32_t passwd_len, const char *in_db)
 
629
bool Session::checkUser(const std::string &passwd_str,
 
630
                        const std::string &in_db)
630
631
{
631
 
  const string passwd_str(passwd, passwd_len);
632
632
  bool is_authenticated=
633
633
    plugin::Authentication::isAuthenticated(getSecurityContext(),
634
634
                                            passwd_str);
641
641
  }
642
642
 
643
643
  /* Change database if necessary */
644
 
  if (in_db && in_db[0])
 
644
  if (not in_db.empty())
645
645
  {
646
646
    SchemaIdentifier identifier(in_db);
647
647
    if (mysql_change_db(this, identifier))
651
651
    }
652
652
  }
653
653
  my_ok();
654
 
  password= test(passwd_len);          // remember for error messages
 
654
  password= not passwd_str.empty();
655
655
 
656
656
  /* Ready to handle queries */
657
657
  return true;
1771
1771
 
1772
1772
user_var_entry *Session::getVariable(LEX_STRING &name, bool create_if_not_exists)
1773
1773
{
 
1774
  return getVariable(std::string(name.str, name.length), create_if_not_exists);
 
1775
}
 
1776
 
 
1777
user_var_entry *Session::getVariable(const std::string  &name, bool create_if_not_exists)
 
1778
{
1774
1779
  user_var_entry *entry= NULL;
1775
 
  UserVarsRange ppp= user_vars.equal_range(std::string(name.str, name.length));
 
1780
  UserVarsRange ppp= user_vars.equal_range(name);
1776
1781
 
1777
1782
  for (UserVars::iterator iter= ppp.first;
1778
1783
         iter != ppp.second; ++iter)
1782
1787
 
1783
1788
  if ((entry == NULL) && create_if_not_exists)
1784
1789
  {
1785
 
    entry= new (nothrow) user_var_entry(name.str, query_id);
 
1790
    entry= new (nothrow) user_var_entry(name.c_str(), query_id);
1786
1791
 
1787
1792
    if (entry == NULL)
1788
1793
      return NULL;
1789
1794
 
1790
 
    std::pair<UserVars::iterator, bool> returnable= user_vars.insert(make_pair(std::string(name.str, name.length), entry));
 
1795
    std::pair<UserVars::iterator, bool> returnable= user_vars.insert(make_pair(name, entry));
1791
1796
 
1792
1797
    if (not returnable.second)
1793
1798
    {
1799
1804
  return entry;
1800
1805
}
1801
1806
 
 
1807
void Session::setVariable(const std::string &name, const std::string &value)
 
1808
{
 
1809
  user_var_entry *updateable_var= getVariable(name.c_str(), true);
 
1810
 
 
1811
  updateable_var->update_hash(false,
 
1812
                              (void*)value.c_str(),
 
1813
                              static_cast<uint32_t>(value.length()), STRING_RESULT,
 
1814
                              &my_charset_bin,
 
1815
                              DERIVATION_IMPLICIT, false);
 
1816
}
 
1817
 
1802
1818
void Session::mark_temp_tables_as_free_for_reuse()
1803
1819
{
1804
1820
  for (Table *table= temporary_tables ; table ; table= table->getNext())