~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/drop_table.cc

  • Committer: Andrew Hutchings
  • Date: 2011-02-01 10:23:22 UTC
  • mto: (2136.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 2137.
  • Revision ID: andrew@linuxjedi.co.uk-20110201102322-oxztcyrjzg3c7yta
Fix counters cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#include <config.h>
 
21
#include "config.h"
22
22
#include <drizzled/show.h>
23
23
#include <drizzled/session.h>
24
24
#include <drizzled/lock.h>
25
25
#include <drizzled/statement/drop_table.h>
26
 
#include <drizzled/sql_table.h>
27
 
#include <drizzled/sql_lex.h>
 
26
#include "drizzled/sql_table.h"
28
27
 
29
28
namespace drizzled
30
29
{
67
66
  }
68
67
 
69
68
  /*
70
 
    Acquire table::Cache::mutex() after wait_if_global_read_lock(). If we would hold
71
 
    table::Cache::mutex() during wait_if_global_read_lock(), other threads could not
 
69
    Acquire table::Cache::singleton().mutex() after wait_if_global_read_lock(). If we would hold
 
70
    table::Cache::singleton().mutex() during wait_if_global_read_lock(), other threads could not
72
71
    close their tables. This would make a pretty deadlock.
73
72
  */
74
73
  error= rm_table_part2(session, tables, if_exists, drop_temporary);
88
87
 
89
88
bool statement::DropTable::execute()
90
89
{
91
 
  TableList *first_table= (TableList *) lex().select_lex.table_list.first;
92
 
  TableList *all_tables= lex().query_tables;
 
90
  TableList *first_table= (TableList *) getSession()->lex->select_lex.table_list.first;
 
91
  TableList *all_tables= getSession()->lex->query_tables;
93
92
  assert(first_table == all_tables && first_table != 0);
94
93
 
95
94
  if (not drop_temporary)
96
95
  {
97
 
    if (session().inTransaction())
 
96
    if (getSession()->inTransaction())
98
97
    {
99
98
      my_error(ER_TRANSACTIONAL_DDL_NOT_SUPPORTED, MYF(0));
100
99
      return true;
101
100
    }
102
101
  }
103
102
 
104
 
  /* DDL and binlog write order protected by table::Cache::mutex() */
 
103
  /* DDL and binlog write order protected by table::Cache::singleton().mutex() */
105
104
 
106
 
  return rm_table(&session(), first_table, drop_if_exists, drop_temporary);
 
105
  return rm_table(getSession(), first_table, drop_if_exists, drop_temporary);
107
106
}
108
107
 
109
108
} /* namespace drizzled */