~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.cc

  • Committer: Monty Taylor
  • Date: 2009-12-08 22:43:58 UTC
  • mfrom: (1240.1.5 build)
  • mto: (1240.1.6 build)
  • mto: This revision was merged to the branch mainline in revision 1241.
  • Revision ID: mordred@inaugust.com-20091208224358-u1pazjsnn4n932cu
MergedĀ upĀ build.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
#include "drizzled/plugin/authentication.h"
42
42
#include "drizzled/probes.h"
43
43
#include "drizzled/table_proto.h"
 
44
#include "drizzled/db.h"
44
45
 
45
46
#include <algorithm>
46
47
 
646
647
 
647
648
bool Session::checkUser(const char *passwd, uint32_t passwd_len, const char *in_db)
648
649
{
649
 
  LEX_STRING db_str= { (char *) in_db, in_db ? strlen(in_db) : 0 };
650
650
  bool is_authenticated;
651
651
 
652
652
  if (passwd_len != 0 && passwd_len != SCRAMBLE_LENGTH)
672
672
  /* Change database if necessary */
673
673
  if (in_db && in_db[0])
674
674
  {
675
 
    if (mysql_change_db(this, &db_str, false))
 
675
    const string database_name_string(in_db);
 
676
    NonNormalisedDatabaseName database_name(database_name_string);
 
677
    NormalisedDatabaseName normalised_database_name(database_name);
 
678
 
 
679
    if (mysql_change_db(this, normalised_database_name, false))
676
680
    {
677
681
      /* mysql_change_db() has pushed the error message. */
678
682
      return false;
1688
1692
}
1689
1693
 
1690
1694
 
1691
 
bool Session::set_db(const char *new_db, size_t length)
 
1695
bool Session::set_db(const NormalisedDatabaseName &new_db)
1692
1696
{
1693
 
  /* Do not reallocate memory if current chunk is big enough. */
1694
 
  if (length)
1695
 
    db= new_db;
1696
 
  else
1697
 
    db.clear();
 
1697
  db= new_db.to_string();
1698
1698
 
1699
1699
  return false;
1700
1700
}
1701
1701
 
 
1702
void Session::clear_db()
 
1703
{
 
1704
  db.clear();
 
1705
}
 
1706
 
1702
1707
 
1703
1708
/**
1704
1709
  Check the killed state of a user thread