~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/alter_table.cc

  • Committer: Lee Bieber
  • Date: 2011-03-13 16:37:38 UTC
  • mfrom: (2227.4.18 session2)
  • Revision ID: kalebral@gmail.com-20110313163738-7ti21zk40o2xi3ew
Merge Olaf - Refactor Session

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
  if (is_engine_set)
100
100
  {
101
101
    create_info().db_type=
102
 
      plugin::StorageEngine::findByName(*getSession(), createTableMessage().engine().name());
 
102
      plugin::StorageEngine::findByName(session(), createTableMessage().engine().name());
103
103
 
104
104
    if (create_info().db_type == NULL)
105
105
    {
116
116
  message::table::shared_ptr original_table_message;
117
117
  {
118
118
    identifier::Table identifier(first_table->getSchemaName(), first_table->getTableName());
119
 
    if (not (original_table_message= plugin::StorageEngine::getTableMessage(*getSession(), identifier)))
 
119
    if (not (original_table_message= plugin::StorageEngine::getTableMessage(session(), identifier)))
120
120
    {
121
121
      my_error(ER_BAD_TABLE_ERROR, identifier);
122
122
      return true;
125
125
    if (not  create_info().db_type)
126
126
    {
127
127
      create_info().db_type=
128
 
        plugin::StorageEngine::findByName(*getSession(), original_table_message->engine().name());
 
128
        plugin::StorageEngine::findByName(session(), original_table_message->engine().name());
129
129
 
130
130
      if (not create_info().db_type)
131
131
      {
138
138
  if (not validateCreateTableOption())
139
139
    return true;
140
140
 
141
 
  if (getSession()->inTransaction())
 
141
  if (session().inTransaction())
142
142
  {
143
143
    my_error(ER_TRANSACTIONAL_DDL_NOT_SUPPORTED, MYF(0));
144
144
    return true;
145
145
  }
146
146
 
147
 
  if (not (need_start_waiting= not getSession()->wait_if_global_read_lock(0, 1)))
 
147
  if (not (need_start_waiting= not session().wait_if_global_read_lock(0, 1)))
148
148
    return true;
149
149
 
150
150
  bool res;
154
154
    identifier::Table new_identifier(select_lex->db ? select_lex->db : first_table->getSchemaName(),
155
155
                                   lex().name.str ? lex().name.str : first_table->getTableName());
156
156
 
157
 
    res= alter_table(getSession(),
 
157
    res= alter_table(&session(),
158
158
                     identifier,
159
159
                     new_identifier,
160
160
                     &create_info(),
169
169
  else
170
170
  {
171
171
    identifier::Table catch22(first_table->getSchemaName(), first_table->getTableName());
172
 
    Table *table= getSession()->find_temporary_table(catch22);
 
172
    Table *table= session().find_temporary_table(catch22);
173
173
    assert(table);
174
174
    {
175
175
      identifier::Table identifier(first_table->getSchemaName(), first_table->getTableName(), table->getMutableShare()->getPath());
177
177
                                       lex().name.str ? lex().name.str : first_table->getTableName(),
178
178
                                       table->getMutableShare()->getPath());
179
179
 
180
 
      res= alter_table(getSession(),
 
180
      res= alter_table(&session(),
181
181
                       identifier,
182
182
                       new_identifier,
183
183
                       &create_info(),
195
195
     Release the protection against the global read lock and wake
196
196
     everyone, who might want to set a global read lock.
197
197
   */
198
 
  getSession()->startWaitingGlobalReadLock();
 
198
  session().startWaitingGlobalReadLock();
199
199
 
200
200
  return res;
201
201
}
1506
1506
        tables.setSchemaName(const_cast<char *>(from->getMutableShare()->getSchemaName()));
1507
1507
        error= 1;
1508
1508
 
1509
 
        if (session->getLex()->select_lex.setup_ref_array(session, order_num) ||
1510
 
            setup_order(session, session->getLex()->select_lex.ref_pointer_array,
 
1509
        if (session->lex().select_lex.setup_ref_array(session, order_num) ||
 
1510
            setup_order(session, session->lex().select_lex.ref_pointer_array,
1511
1511
                        &tables, fields, all_fields, order) ||
1512
1512
            !(sortorder= make_unireg_sortorder(order, &length, NULL)) ||
1513
1513
            (from->sort.found_records= filesort.run(from, sortorder, length,