1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2009 Sun Microsystems, Inc.
4
* Copyright (C) 2009 Sun Microsystems
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
18
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
#include <drizzled/server_includes.h>
22
22
#include <drizzled/show.h>
23
23
#include <drizzled/session.h>
24
24
#include <drizzled/statement/release_savepoint.h>
25
#include "drizzled/transaction_services.h"
26
#include "drizzled/named_savepoint.h"
35
29
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();
32
for (sv= session->transaction.savepoints; sv; sv= sv->prev)
50
NamedSavepoint &sv= *iter;
51
const string &sv_name= sv.getName();
52
34
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(),
35
(unsigned char *) session->lex->ident.str,
36
session->lex->ident.length,
37
(unsigned char *) sv->name,
59
if (iter != savepoints.end())
61
NamedSavepoint &sv= *iter;
62
(void) transaction_services.releaseSavepoint(*getSession(), sv);
63
savepoints.erase(iter);
64
getSession()->my_ok();
45
if (ha_release_savepoint(session, sv))
53
session->transaction.savepoints= sv->prev;
68
57
my_error(ER_SP_DOES_NOT_EXIST,
71
getSession()->lex->ident.str);
60
session->lex->ident.str);
76
65
} /* namespace drizzled */