~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.cc

  • Committer: Olaf van der Spek
  • Date: 2011-03-22 12:01:19 UTC
  • mto: (2245.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2246.
  • Revision ID: olafvdspek@gmail.com-20110322120119-ph5bp07qqsmzh23j
Refactor Session

Show diffs side-by-side

added added

removed removed

Lines of Context:
208
208
  _killed(NOT_KILLED),
209
209
  some_tables_deleted(false),
210
210
  no_errors(false),
211
 
  password(false),
212
211
  is_fatal_error(false),
213
212
  transaction_rollback_request(false),
214
213
  is_fatal_sub_stmt_error(0),
716
715
  return true;
717
716
}
718
717
 
719
 
bool Session::checkUser(const std::string &passwd_str,
720
 
                        const std::string &in_db)
 
718
bool Session::checkUser(const std::string &passwd_str, const std::string &in_db)
721
719
{
722
 
  bool is_authenticated=
723
 
    plugin::Authentication::isAuthenticated(*user(), passwd_str);
724
 
 
725
 
  if (is_authenticated != true)
 
720
  if (not plugin::Authentication::isAuthenticated(*user(), passwd_str))
726
721
  {
727
722
    status_var.access_denied++;
728
723
    /* isAuthenticated has pushed the error message */
730
725
  }
731
726
 
732
727
  /* Change database if necessary */
733
 
  if (not in_db.empty())
734
 
  {
735
 
    identifier::Schema identifier(in_db);
736
 
    if (schema::change(*this, identifier))
737
 
    {
738
 
      /* change_db() has pushed the error message. */
739
 
      return false;
740
 
    }
741
 
  }
 
728
  if (not in_db.empty() && schema::change(*this, identifier::Schema(in_db)))
 
729
    return false; // change() has pushed the error message
742
730
  my_ok();
743
 
  password= not passwd_str.empty();
744
731
 
745
732
  /* Ready to handle queries */
746
733
  return true;
748
735
 
749
736
bool Session::executeStatement()
750
737
{
 
738
  /*
 
739
    indicator of uninitialized lex => normal flow of errors handling
 
740
    (see my_message_sql)
 
741
  */
 
742
  lex().current_select= 0;
 
743
  clear_error();
 
744
  main_da().reset_diagnostics_area();
751
745
  char *l_packet= 0;
752
746
  uint32_t packet_length;
753
 
 
754
 
  enum enum_server_command l_command;
755
 
 
756
 
  /*
757
 
    indicator of uninitialized lex => normal flow of errors handling
758
 
    (see my_message_sql)
759
 
  */
760
 
  lex().current_select= 0;
761
 
  clear_error();
762
 
  main_da().reset_diagnostics_area();
763
 
 
764
 
  if (client->readCommand(&l_packet, &packet_length) == false)
765
 
  {
 
747
  if (not client->readCommand(&l_packet, &packet_length))
766
748
    return false;
767
 
  }
768
749
 
769
750
  if (getKilled() == KILL_CONNECTION)
770
751
    return false;
772
753
  if (packet_length == 0)
773
754
    return true;
774
755
 
775
 
  l_command= static_cast<enum_server_command>(l_packet[0]);
 
756
  enum_server_command l_command= static_cast<enum_server_command>(l_packet[0]);
776
757
 
777
758
  if (command >= COM_END)
778
759
    command= COM_END;                           // Wrong command