~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/drop_table.cc

  • Committer: Lee Bieber
  • Date: 2010-11-14 23:15:42 UTC
  • mfrom: (1929.1.42 warning-stack-frame)
  • Revision ID: kalebral@gmail.com-20101114231542-fnnu6ydd2p17n582
Merge Monty - fix bug 672372: some functions use > 32k stack

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2009 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2009 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
33
33
 delete (drop) tables.
34
34
 
35
35
  SYNOPSIS
36
 
   rm_table()
 
36
   mysql_rm_table()
37
37
   session                      Thread handle
38
38
   tables               List of tables to delete
39
39
   if_exists            If 1, don't give error if one table doesn't exists
53
53
 
54
54
*/
55
55
 
56
 
static bool rm_table(Session *session, TableList *tables, bool if_exists, bool drop_temporary)
 
56
static bool mysql_rm_table(Session *session, TableList *tables, bool if_exists, bool drop_temporary)
57
57
{
58
58
  bool error, need_start_waiting= false;
59
59
 
66
66
  }
67
67
 
68
68
  /*
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
 
69
    Acquire LOCK_open after wait_if_global_read_lock(). If we would hold
 
70
    LOCK_open during wait_if_global_read_lock(), other threads could not
71
71
    close their tables. This would make a pretty deadlock.
72
72
  */
73
 
  error= rm_table_part2(session, tables, if_exists, drop_temporary);
 
73
  error= mysql_rm_table_part2(session, tables, if_exists, drop_temporary);
74
74
 
75
75
  if (need_start_waiting)
76
76
  {
87
87
 
88
88
bool statement::DropTable::execute()
89
89
{
90
 
  TableList *first_table= (TableList *) getSession()->lex->select_lex.table_list.first;
91
 
  TableList *all_tables= getSession()->lex->query_tables;
 
90
  TableList *first_table= (TableList *) session->lex->select_lex.table_list.first;
 
91
  TableList *all_tables= session->lex->query_tables;
92
92
  assert(first_table == all_tables && first_table != 0);
93
93
 
94
94
  if (not drop_temporary)
95
95
  {
96
 
    if (getSession()->inTransaction())
 
96
    if (not session->endActiveTransaction())
97
97
    {
98
 
      my_error(ER_TRANSACTIONAL_DDL_NOT_SUPPORTED, MYF(0));
99
98
      return true;
100
99
    }
101
100
  }
102
101
 
103
 
  /* DDL and binlog write order protected by table::Cache::singleton().mutex() */
104
 
 
105
 
  return rm_table(getSession(), first_table, drop_if_exists, drop_temporary);
 
102
  /* DDL and binlog write order protected by LOCK_open */
 
103
  bool res= mysql_rm_table(session,
 
104
                           first_table,
 
105
                           drop_if_exists,
 
106
                           drop_temporary);
 
107
  return res;
106
108
}
107
109
 
108
110
} /* namespace drizzled */