~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/release_savepoint.cc

  • Committer: Tim Penhey
  • Date: 2010-01-20 02:39:01 UTC
  • mto: This revision was merged to the branch mainline in revision 1275.
  • Revision ID: tim.penhey@canonical.com-20100120023901-8teeunid6gwlthzx
Add in a rot 13 function.

Show diffs side-by-side

added added

removed removed

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