1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2009 Sun Microsystems, Inc.
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
#include <drizzled/show.h>
23
#include <drizzled/session.h>
24
#include <drizzled/statement/release_savepoint.h>
25
#include "drizzled/transaction_services.h"
26
#include "drizzled/named_savepoint.h"
35
bool statement::ReleaseSavepoint::execute()
38
* Look through the deque of savepoints. If we
39
* find one with the same name, we release it and
40
* unbind it from our deque.
42
TransactionServices &transaction_services= TransactionServices::singleton();
43
deque<NamedSavepoint> &savepoints= getSession()->transaction.savepoints;
44
deque<NamedSavepoint>::iterator iter;
46
for (iter= savepoints.begin();
47
iter != savepoints.end();
50
NamedSavepoint &sv= *iter;
51
const string &sv_name= sv.getName();
52
if (my_strnncoll(system_charset_info,
53
(unsigned char *) getSession()->lex->ident.str,
54
getSession()->lex->ident.length,
55
(unsigned char *) sv_name.c_str(),
59
if (iter != savepoints.end())
61
NamedSavepoint &sv= *iter;
62
(void) transaction_services.releaseSavepoint(*getSession(), sv);
63
savepoints.erase(iter);
64
getSession()->my_ok();
68
my_error(ER_SP_DOES_NOT_EXIST,
71
getSession()->lex->ident.str);
76
} /* namespace drizzled */