~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to drizzled/session.cc

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-12-09 06:02:39 UTC
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: james.westby@ubuntu.com-20101209060239-t0ujftvcvd558yno
Tags: upstream-2010.12.05
ImportĀ upstreamĀ versionĀ 2010.12.05

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
#include "config.h"
25
25
#include "drizzled/session.h"
26
 
#include "drizzled/session_list.h"
 
26
#include "drizzled/session/cache.h"
27
27
#include <sys/stat.h>
28
28
#include "drizzled/error.h"
29
29
#include "drizzled/gettext.h"
41
41
#include "drizzled/plugin/authentication.h"
42
42
#include "drizzled/plugin/logging.h"
43
43
#include "drizzled/plugin/transactional_storage_engine.h"
 
44
#include "drizzled/plugin/query_rewrite.h"
44
45
#include "drizzled/probes.h"
45
46
#include "drizzled/table_proto.h"
46
47
#include "drizzled/db.h"
410
411
    delete (*iter).second;
411
412
  }
412
413
  life_properties.clear();
413
 
 
414
 
#if 0
415
 
  drizzled::util::custom_backtrace();
416
 
#endif
417
414
}
418
415
 
419
416
void Session::setClient(plugin::Client *client_arg)
427
424
  this->checkSentry();
428
425
 
429
426
  setKilled(state_to_set);
 
427
  scheduler->killSession(this);
 
428
 
430
429
  if (state_to_set != Session::KILL_QUERY)
431
430
  {
432
 
    scheduler->killSession(this);
433
431
    DRIZZLE_CONNECTION_DONE(thread_id);
434
432
  }
435
433
 
436
 
  assert(_thread);
437
 
  _thread->interrupt();
438
 
 
439
434
  if (mysys_var)
440
435
  {
441
436
    boost_unique_lock_t scopedLock(mysys_var->mutex);
729
724
    in_packet_length--;
730
725
  }
731
726
 
732
 
  query.reset(new std::string(in_packet, in_packet + in_packet_length));
 
727
  std::string *new_query= new std::string(in_packet, in_packet + in_packet_length);
 
728
  plugin::QueryRewriter::rewriteQuery(getSchema(), *new_query);
 
729
  query.reset(new_query);
733
730
 
734
731
  return true;
735
732
}
1955
1952
  might be an issue (lame engines).
1956
1953
*/
1957
1954
 
1958
 
bool Open_tables_state::rm_temporary_table(TableIdentifier &identifier, bool best_effort)
 
1955
bool Open_tables_state::rm_temporary_table(const TableIdentifier &identifier, bool best_effort)
1959
1956
{
1960
1957
  if (plugin::StorageEngine::dropTable(*static_cast<Session *>(this), identifier))
1961
1958
  {
1962
1959
    if (not best_effort)
1963
1960
    {
 
1961
      std::string path;
 
1962
      identifier.getSQLPath(path);
1964
1963
      errmsg_printf(ERRMSG_LVL_WARN, _("Could not remove temporary table: '%s', error: %d"),
1965
 
                    identifier.getSQLPath().c_str(), errno);
 
1964
                    path.c_str(), errno);
1966
1965
    }
1967
1966
 
1968
1967
    return true;
1971
1970
  return false;
1972
1971
}
1973
1972
 
1974
 
bool Open_tables_state::rm_temporary_table(plugin::StorageEngine *base, TableIdentifier &identifier)
 
1973
bool Open_tables_state::rm_temporary_table(plugin::StorageEngine *base, const TableIdentifier &identifier)
1975
1974
{
1976
1975
  assert(base);
1977
1976
 
1978
1977
  if (plugin::StorageEngine::dropTable(*static_cast<Session *>(this), *base, identifier))
1979
1978
  {
 
1979
    std::string path;
 
1980
    identifier.getSQLPath(path);
1980
1981
    errmsg_printf(ERRMSG_LVL_WARN, _("Could not remove temporary table: '%s', error: %d"),
1981
 
                  identifier.getSQLPath().c_str(), errno);
 
1982
                  path.c_str(), errno);
1982
1983
 
1983
1984
    return true;
1984
1985
  }
2127
2128
  return tmp_share;
2128
2129
}
2129
2130
 
 
2131
namespace display  {
 
2132
 
 
2133
static const std::string NONE= "NONE";
 
2134
static const std::string GOT_GLOBAL_READ_LOCK= "HAS GLOBAL READ LOCK";
 
2135
static const std::string MADE_GLOBAL_READ_LOCK_BLOCK_COMMIT= "HAS GLOBAL READ LOCK WITH BLOCKING COMMIT";
 
2136
 
 
2137
const std::string &type(drizzled::Session::global_read_lock_t type)
 
2138
{
 
2139
  switch (type) {
 
2140
    default:
 
2141
    case Session::NONE:
 
2142
      return NONE;
 
2143
    case Session::GOT_GLOBAL_READ_LOCK:
 
2144
      return GOT_GLOBAL_READ_LOCK;
 
2145
    case Session::MADE_GLOBAL_READ_LOCK_BLOCK_COMMIT:
 
2146
      return MADE_GLOBAL_READ_LOCK_BLOCK_COMMIT;
 
2147
  }
 
2148
}
 
2149
 
 
2150
size_t max_string_length(drizzled::Session::global_read_lock_t)
 
2151
{
 
2152
  return MADE_GLOBAL_READ_LOCK_BLOCK_COMMIT.size();
 
2153
}
 
2154
 
 
2155
} /* namespace display */
 
2156
 
2130
2157
} /* namespace drizzled */