~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.cc

  • Committer: Lee Bieber
  • Date: 2011-03-23 00:09:31 UTC
  • mfrom: (2241.3.9 refactor3)
  • mto: This revision was merged to the branch mainline in revision 2246.
  • Revision ID: kalebral@gmail.com-20110323000931-t13v9s8a91en53de
Merge Olaf - more code refactoring

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
#include <drizzled/session/property_map.h>
69
69
#include <drizzled/session/state.h>
70
70
#include <drizzled/session/table_messages.h>
 
71
#include <drizzled/session/transactions.h>
71
72
#include <drizzled/show.h>
72
73
#include <drizzled/sql_base.h>
73
74
#include <drizzled/sql_lex.h>
 
75
#include <drizzled/system_variables.h>
74
76
#include <drizzled/statement.h>
 
77
#include <drizzled/statistics_variables.h>
75
78
#include <drizzled/table/singular.h>
76
79
#include <drizzled/table_proto.h>
77
80
#include <drizzled/tmp_table_param.h>
157
160
  */
158
161
  LEX lex;
159
162
  properties_t properties;
 
163
  system_status_var status_var;
160
164
  session::TableMessages table_message_cache;
 
165
  std::vector<table::Singular*> temporary_shares;
 
166
        session::Transactions transaction;
 
167
  drizzle_system_variables variables;
161
168
};
162
169
 
163
170
Session::Session(plugin::Client *client_arg, catalog::Instance::shared_ptr catalog_arg) :
164
171
  Open_tables_state(refresh_version),
 
172
  impl_(new impl_c),
165
173
  mem_root(&main_mem_root),
166
174
  query(new std::string),
167
 
  _schema(new std::string),
168
175
  scheduler(NULL),
169
176
  scheduler_arg(NULL),
 
177
  variables(impl_->variables),
 
178
  status_var(impl_->status_var),
170
179
  lock_id(&main_lock_id),
171
180
  thread_stack(NULL),
172
181
  _where(Session::DEFAULT_WHERE),
179
188
  ha_data(plugin::num_trx_monitored_objects),
180
189
  query_id(0),
181
190
  warn_query_id(0),
 
191
        transaction(impl_->transaction),
182
192
  first_successful_insert_id_in_prev_stmt(0),
183
193
  first_successful_insert_id_in_cur_stmt(0),
184
194
  limit_found_rows(0),
188
198
  examined_row_count(0),
189
199
  used_tables(0),
190
200
  total_warn_count(0),
191
 
  col_access(0),
192
 
  statement_id_counter(0),
193
201
  row_count(0),
194
202
  thread_id(0),
195
203
  tmp_table(0),
204
212
  is_fatal_sub_stmt_error(0),
205
213
  derived_tables_processing(false),
206
214
  m_lip(NULL),
207
 
  cached_table(0),
208
215
  arg_of_last_insert_id_function(false),
209
 
  impl_(new impl_c),
210
216
  _catalog(catalog_arg),
211
217
  transaction_message(NULL),
212
218
  statement_message(NULL),
474
480
 
475
481
  plugin::Logging::postEndDo(this);
476
482
  plugin::EventObserver::deregisterSessionEvents(session_event_observers); 
477
 
 
478
 
  // Free all schema event observer lists.
479
 
  for (std::map<std::string, plugin::EventObserverList *>::iterator it=schema_event_observers.begin() ; it != schema_event_observers.end(); it++ )
480
 
    plugin::EventObserver::deregisterSchemaEvents(it->second);
481
483
 
 
484
        BOOST_FOREACH(schema_event_observers_t::reference it, schema_event_observers)
 
485
    plugin::EventObserver::deregisterSchemaEvents(it.second);
482
486
}
483
487
 
484
488
void Session::setClient(plugin::Client *client_arg)
924
928
  _where= Session::DEFAULT_WHERE;
925
929
 
926
930
  /* Reset the temporary shares we built */
927
 
  for_each(temporary_shares.begin(),
928
 
           temporary_shares.end(),
929
 
           DeletePtr());
930
 
  temporary_shares.clear();
 
931
  for_each(impl_->temporary_shares.begin(), impl_->temporary_shares.end(), DeletePtr());
 
932
  impl_->temporary_shares.clear();
931
933
}
932
934
 
933
935
/**
2079
2081
  }
2080
2082
}
2081
2083
 
2082
 
table::Singular *Session::getInstanceTable()
 
2084
table::Singular& Session::getInstanceTable()
2083
2085
{
2084
 
  temporary_shares.push_back(new table::Singular()); // This will not go into the tableshare cache, so no key is used.
2085
 
 
2086
 
  table::Singular *tmp_share= temporary_shares.back();
2087
 
 
2088
 
  assert(tmp_share);
2089
 
 
2090
 
  return tmp_share;
 
2086
  impl_->temporary_shares.push_back(new table::Singular); // This will not go into the tableshare cache, so no key is used.
 
2087
  return *impl_->temporary_shares.back();
2091
2088
}
2092
2089
 
2093
2090
 
2109
2106
  @return
2110
2107
    0 if out of memory, Table object in case of success
2111
2108
*/
2112
 
table::Singular *Session::getInstanceTable(List<CreateField> &field_list)
 
2109
table::Singular& Session::getInstanceTable(std::list<CreateField>& field_list)
2113
2110
{
2114
 
  temporary_shares.push_back(new table::Singular(this, field_list)); // This will not go into the tableshare cache, so no key is used.
2115
 
  return temporary_shares.back();
 
2111
  impl_->temporary_shares.push_back(new table::Singular(this, field_list)); // This will not go into the tableshare cache, so no key is used.
 
2112
  return *impl_->temporary_shares.back();
2116
2113
}
2117
2114
 
2118
2115
void Session::clear_error(bool full)
2199
2196
  impl_->properties.setProperty(arg, value);
2200
2197
}
2201
2198
 
 
2199
my_xid Session::getTransactionId()
 
2200
{
 
2201
  return transaction.xid_state.xid.quick_get_my_xid();
 
2202
}
 
2203
 
2202
2204
const std::string& display::type(drizzled::Session::global_read_lock_t type)
2203
2205
{
2204
2206
  static const std::string NONE= "NONE";