~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/release_savepoint.cc

  • Committer: Padraig O'Sullivan
  • Date: 2009-09-13 01:03:01 UTC
  • mto: (1126.9.2 captain-20090915-01)
  • mto: This revision was merged to the branch mainline in revision 1133.
  • Revision ID: osullivan.padraig@gmail.com-20090913010301-tcvvezipx1124acy
Added calls to the dtrace delete begin/end probes.

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 <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"
27
 
 
28
 
#include <string>
29
 
 
30
 
using namespace std;
31
 
 
32
 
namespace drizzled
33
 
{
 
25
 
 
26
using namespace drizzled;
34
27
 
35
28
bool statement::ReleaseSavepoint::execute()
36
29
{
37
 
  /*
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.
41
 
   */
42
 
  TransactionServices &transaction_services= TransactionServices::singleton();
43
 
  deque<NamedSavepoint> &savepoints= session->transaction.savepoints;
44
 
  deque<NamedSavepoint>::iterator iter;
45
 
 
46
 
  for (iter= savepoints.begin();
47
 
       iter != savepoints.end();
48
 
       ++iter)
 
30
  SAVEPOINT *sv;
 
31
  for (sv= session->transaction.savepoints; sv; sv= sv->prev)
49
32
  {
50
 
    NamedSavepoint &sv= *iter;
51
 
    const string &sv_name= sv.getName();
52
33
    if (my_strnncoll(system_charset_info,
53
 
                     (unsigned char *) session->lex->ident.str,
 
34
                     (unsigned char *) session->lex->ident.str, 
54
35
                     session->lex->ident.length,
55
 
                     (unsigned char *) sv_name.c_str(),
56
 
                     sv_name.size()) == 0)
 
36
                     (unsigned char *) sv->name, 
 
37
                     sv->length) == 0)
 
38
    {
57
39
      break;
 
40
    }
58
41
  }
59
 
  if (iter != savepoints.end())
 
42
  if (sv)
60
43
  {
61
 
    NamedSavepoint &sv= *iter;
62
 
    (void) transaction_services.ha_release_savepoint(session, sv);
63
 
    savepoints.erase(iter);
64
 
    session->my_ok();
 
44
    if (ha_release_savepoint(session, sv))
 
45
    {
 
46
      return true;
 
47
    }
 
48
    else
 
49
    {
 
50
      session->my_ok();
 
51
    }
 
52
    session->transaction.savepoints= sv->prev;
65
53
  }
66
54
  else
67
55
  {
72
60
  }
73
61
  return false;
74
62
}
75
 
 
76
 
} /* namespace drizzled */