~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.cc

Big merge.

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;
1692
1696
}
1693
1697
 
1694
1698
 
1695
 
bool Session::set_db(const char *new_db, size_t length)
 
1699
bool Session::set_db(const NormalisedDatabaseName &new_db)
1696
1700
{
1697
 
  /* Do not reallocate memory if current chunk is big enough. */
1698
 
  if (length)
1699
 
    db= new_db;
1700
 
  else
1701
 
    db.clear();
 
1701
  db= new_db.to_string();
1702
1702
 
1703
1703
  return false;
1704
1704
}
1705
1705
 
 
1706
void Session::clear_db()
 
1707
{
 
1708
  db.clear();
 
1709
}
 
1710
 
1706
1711
 
1707
1712
/**
1708
1713
  Check the killed state of a user thread