~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/savepoint.cc

  • Committer: Brian Aker
  • Date: 2010-12-19 06:20:54 UTC
  • mfrom: (2005.1.1 bug673105)
  • Revision ID: brian@tangent.org-20101219062054-1kt0l3dxs4z2z8md
Merge Dave.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 */
20
20
 
21
21
#include "config.h"
22
 
#include <drizzled/show.h>
23
 
#include <drizzled/session.h>
24
 
#include <drizzled/statement/savepoint.h>
 
22
#include "drizzled/show.h"
 
23
#include "drizzled/session.h"
 
24
#include "drizzled/statement/savepoint.h"
25
25
#include "drizzled/transaction_services.h"
26
26
#include "drizzled/named_savepoint.h"
27
27
 
37
37
{
38
38
  if (! (session->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
39
39
  {
 
40
    /* AUTOCOMMIT is on and not in a BEGIN */
40
41
    session->my_ok();
41
42
  }
42
43
  else
43
44
  {
44
45
    /*
 
46
     * If AUTOCOMMIT is off and resource contexts are empty then we need
 
47
     * to start a transaction. It will be empty when SAVEPOINT starts the
 
48
     * transaction. Table affecting statements do this work in lockTables()
 
49
     * by calling startStatement().
 
50
     */
 
51
    if ( (session->options & OPTION_NOT_AUTOCOMMIT) &&
 
52
         (session->transaction.all.getResourceContexts().empty() == true) )
 
53
    {
 
54
      if (session->startTransaction() == false)
 
55
      {
 
56
        return false;
 
57
      }
 
58
    }
 
59
 
 
60
    /*
45
61
     * Look through the savepoints.  If we find one with
46
62
     * the same name, delete it.
47
63
     */