~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.cc

  • Committer: Brian Aker
  • Date: 2010-12-07 09:12:12 UTC
  • mto: This revision was merged to the branch mainline in revision 1985.
  • Revision ID: brian@tangent.org-20101207091212-1m0w20tck6z7632m
This is a fix for bug lp:686197

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
{
87
87
  return length == other.length &&
88
88
         field_name.length == other.field_name.length &&
89
 
    !my_strcasecmp(system_charset_info, field_name.str, other.field_name.str);
 
89
         !strcmp(field_name.str, other.field_name.str);
90
90
}
91
91
 
92
92
Open_tables_state::Open_tables_state(uint64_t version_arg) :
165
165
  xa_id(0),
166
166
  lex(&main_lex),
167
167
  query(new std::string),
168
 
  _schema(new std::string("")),
169
168
  catalog("LOCAL"),
170
169
  client(client_arg),
171
170
  scheduler(NULL),
422
421
 
423
422
void Session::awake(Session::killed_state_t state_to_set)
424
423
{
425
 
  if ((state_to_set == Session::KILL_QUERY) and (command == COM_SLEEP))
426
 
    return;
427
 
 
428
424
  this->checkSentry();
429
425
 
430
426
  setKilled(state_to_set);
729
725
  }
730
726
 
731
727
  std::string *new_query= new std::string(in_packet, in_packet + in_packet_length);
732
 
  // We can not be entirely sure _schema has a value
733
 
  if (_schema)
734
 
  {
735
 
    plugin::QueryRewriter::rewriteQuery(*_schema, *new_query);
736
 
  }
 
728
  plugin::QueryRewriter::rewriteQuery(getSchema(), *new_query);
737
729
  query.reset(new_query);
738
 
  _state.reset(new State(in_packet, in_packet_length));
739
730
 
740
731
  return true;
741
732
}
1046
1037
  if (not to_file.has_root_directory())
1047
1038
  {
1048
1039
    target_path= fs::system_complete(getDataHomeCatalog());
1049
 
    util::string::const_shared_ptr schema(session->schema());
1050
 
    if (schema and not schema->empty())
 
1040
    if (not session->db.empty())
1051
1041
    {
1052
1042
      int count_elements= 0;
1053
1043
      for (fs::path::iterator iter= to_file.begin();
1057
1047
 
1058
1048
      if (count_elements == 1)
1059
1049
      {
1060
 
        target_path /= *schema;
 
1050
        target_path /= session->db;
1061
1051
      }
1062
1052
    }
1063
1053
    target_path /= to_file;
1115
1105
    {
1116
1106
      if (item->max_length >= MAX_BLOB_WIDTH)
1117
1107
      {
1118
 
        blob_flag=1;
1119
 
        break;
 
1108
        blob_flag=1;
 
1109
        break;
1120
1110
      }
1121
 
 
1122
1111
      if (item->result_type() == STRING_RESULT)
1123
1112
        string_results= true;
1124
1113
      else
1561
1550
 
1562
1551
bool Session::copy_db_to(char **p_db, size_t *p_db_length)
1563
1552
{
1564
 
  assert(_schema);
1565
 
  if (_schema and _schema->empty())
1566
 
  {
1567
 
    my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0));
1568
 
    return true;
1569
 
  }
1570
 
  else if (not _schema)
1571
 
  {
1572
 
    my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0));
1573
 
    return true;
1574
 
  }
1575
 
  assert(_schema);
1576
 
 
1577
 
  *p_db= strmake(_schema->c_str(), _schema->size());
1578
 
  *p_db_length= _schema->size();
1579
 
 
 
1553
  if (db.empty())
 
1554
  {
 
1555
    my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0));
 
1556
    return true;
 
1557
  }
 
1558
  *p_db= strmake(db.c_str(), db.length());
 
1559
  *p_db_length= db.length();
1580
1560
  return false;
1581
1561
}
1582
1562
 
1616
1596
}
1617
1597
 
1618
1598
 
1619
 
void Session::set_db(const std::string &new_db)
 
1599
bool Session::set_db(const std::string &new_db)
1620
1600
{
1621
1601
  /* Do not reallocate memory if current chunk is big enough. */
1622
1602
  if (new_db.length())
1623
 
  {
1624
 
    _schema.reset(new std::string(new_db));
1625
 
  }
 
1603
    db= new_db;
1626
1604
  else
1627
 
  {
1628
 
    _schema.reset(new std::string(""));
1629
 
  }
 
1605
    db.clear();
 
1606
 
 
1607
  return false;
1630
1608
}
1631
1609
 
1632
1610
 
1664
1642
 
1665
1643
      errmsg_printf(ERRMSG_LVL_WARN, ER(ER_NEW_ABORTING_CONNECTION)
1666
1644
                  , thread_id
1667
 
                  , (_schema->empty() ? "unconnected" : _schema->c_str())
 
1645
                  , (db.empty() ? "unconnected" : db.c_str())
1668
1646
                  , sctx->getUser().empty() == false ? sctx->getUser().c_str() : "unauthenticated"
1669
1647
                  , sctx->getIp().c_str()
1670
1648
                  , (main_da.is_error() ? main_da.message() : ER(ER_UNKNOWN_ERROR)));
2037
2015
      cerr << "\t\t Proto " << proto->schema() << " " << proto->name() << "\n";
2038
2016
    }
2039
2017
    else
2040
 
    {
2041
2018
      cerr << "\tTabl;e Name " << table->getShare()->getSchemaName() << "." << table->getShare()->getTableName() << " : " << answer << "\n";
2042
 
    }
2043
2019
  }
2044
2020
}
2045
2021