~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to drizzled/statement/savepoint.cc

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-06-19 10:46:49 UTC
  • mfrom: (1.1.6)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20120619104649-e2l0ggd4oz3um0f4
Tags: upstream-7.1.36-stable
ImportĀ upstreamĀ versionĀ 7.1.36-stable

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <drizzled/statement/savepoint.h>
25
25
#include <drizzled/transaction_services.h>
26
26
#include <drizzled/named_savepoint.h>
 
27
#include <drizzled/session/transactions.h>
27
28
 
28
29
#include <string>
29
30
#include <deque>
30
31
 
31
32
using namespace std;
32
33
 
33
 
namespace drizzled
34
 
{
 
34
namespace drizzled {
35
35
 
36
36
bool statement::Savepoint::execute()
37
37
{
61
61
     * Look through the savepoints.  If we find one with
62
62
     * the same name, delete it.
63
63
     */
64
 
    TransactionServices &transaction_services= TransactionServices::singleton();
65
64
    deque<NamedSavepoint> &savepoints= transaction().savepoints;
66
65
    deque<NamedSavepoint>::iterator iter;
67
66
 
72
71
      NamedSavepoint &sv= *iter;
73
72
      const string &sv_name= sv.getName();
74
73
      if (my_strnncoll(system_charset_info,
75
 
                       (unsigned char *) lex().ident.str,
76
 
                       lex().ident.length,
 
74
                       (unsigned char *) lex().ident.data(),
 
75
                       lex().ident.size(),
77
76
                       (unsigned char *) sv_name.c_str(),
78
77
                       sv_name.size()) == 0)
79
78
        break;
81
80
    if (iter != savepoints.end())
82
81
    {
83
82
      NamedSavepoint &sv= *iter;
84
 
      (void) transaction_services.releaseSavepoint(session(), sv);
 
83
      (void) TransactionServices::releaseSavepoint(session(), sv);
85
84
      savepoints.erase(iter);
86
85
    }
87
86
    
88
 
    NamedSavepoint newsv(lex().ident.str, lex().ident.length);
 
87
    NamedSavepoint newsv(lex().ident.data(), lex().ident.size());
89
88
 
90
 
    if (transaction_services.setSavepoint(session(), newsv))
 
89
    if (TransactionServices::setSavepoint(session(), newsv))
91
90
    {
92
91
      return true;
93
92
    }