~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/drop_schema.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
34
34
 
35
35
bool statement::DropSchema::execute()
36
36
{
37
 
  if (getSession()->inTransaction())
 
37
  if (! session->endActiveTransaction())
38
38
  {
39
 
    my_error(ER_TRANSACTIONAL_DDL_NOT_SUPPORTED, MYF(0));
40
39
    return true;
41
40
  }
42
 
 
43
 
  identifier::Schema schema_identifier(std::string(getSession()->lex->name.str, getSession()->lex->name.length));
44
 
 
45
 
  if (not check_db_name(getSession(), schema_identifier))
 
41
  SchemaIdentifier schema_identifier(string(session->lex->name.str, session->lex->name.length));
 
42
  if (not check_db_name(session, schema_identifier))
46
43
  {
47
 
    my_error(ER_WRONG_DB_NAME, schema_identifier);
48
 
 
 
44
    my_error(ER_WRONG_DB_NAME, MYF(0), schema_identifier.getSQLPath().c_str());
49
45
    return false;
50
46
  }
51
 
 
52
 
  if (getSession()->inTransaction())
 
47
  if (session->inTransaction())
53
48
  {
54
49
    my_message(ER_LOCK_OR_ACTIVE_TRANSACTION, 
55
50
        ER(ER_LOCK_OR_ACTIVE_TRANSACTION), 
58
53
  }
59
54
  
60
55
  bool res = true;
61
 
  std::string path;
62
 
  schema_identifier.getSQLPath(path);
63
 
  if (unlikely(plugin::EventObserver::beforeDropDatabase(*getSession(), path))) 
 
56
  if (unlikely(plugin::EventObserver::beforeDropDatabase(*session, schema_identifier.getSQLPath()))) 
64
57
  {
65
 
    my_error(ER_EVENT_OBSERVER_PLUGIN, schema_identifier);
 
58
    my_error(ER_EVENT_OBSERVER_PLUGIN, MYF(0), schema_identifier.getSQLPath().c_str());
66
59
  }
67
60
  else
68
61
  {
69
 
    res= rm_db(getSession(), schema_identifier, drop_if_exists);
70
 
    if (unlikely(plugin::EventObserver::afterDropDatabase(*getSession(), path, res)))
 
62
    res= mysql_rm_db(session, schema_identifier, drop_if_exists);
 
63
    if (unlikely(plugin::EventObserver::afterDropDatabase(*session, schema_identifier.getSQLPath(), res)))
71
64
    {
72
 
      my_error(ER_EVENT_OBSERVER_PLUGIN, MYF(0), path.c_str());
 
65
      my_error(ER_EVENT_OBSERVER_PLUGIN, MYF(0), schema_identifier.getSQLPath().c_str());
73
66
      res = false;
74
67
    }
75
68