~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/cursor.cc

This patch does not change any algorithms or code paths, 
it just moves the transaction-related methods in the
drizzled/ha_commands.cc file into a file named
drizzled/transaction_services.cc and creates a singleton
Service class called TransactionServices containing all
the previous ha_xxx methods related specifically to the
XA distributed transaction processing model.

This is a quick stopgap patch in the move towards separating
out the XA Resource Manager API from the Storage Engine API.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
#include "drizzled/lock.h"
40
40
#include "drizzled/item/int.h"
41
41
#include "drizzled/item/empty_string.h"
42
 
#include "drizzled/unireg.h" // for mysql_frm_type
43
42
#include "drizzled/field/timestamp.h"
44
43
#include "drizzled/message/table.pb.h"
45
44
#include "drizzled/plugin/client.h"
46
45
#include "drizzled/internal/my_sys.h"
 
46
#include "drizzled/transaction_services.h"
47
47
 
48
48
using namespace std;
49
49
using namespace drizzled;
833
833
  return drop_table(name);
834
834
}
835
835
 
836
 
/**
837
 
  Tell the storage engine that it is allowed to "disable transaction" in the
838
 
  Cursor. It is a hint that ACID is not required - it is used in NDB for
839
 
  ALTER Table, for example, when data are copied to temporary table.
840
 
  A storage engine may treat this hint any way it likes. NDB for example
841
 
  starts to commit every now and then automatically.
842
 
  This hint can be safely ignored.
843
 
*/
844
 
int ha_enable_transaction(Session *session, bool on)
845
 
{
846
 
  int error= 0;
847
 
 
848
 
  if ((session->transaction.on= on))
849
 
  {
850
 
    /*
851
 
      Now all storage engines should have transaction handling enabled.
852
 
      But some may have it enabled all the time - "disabling" transactions
853
 
      is an optimization hint that storage engine is free to ignore.
854
 
      So, let's commit an open transaction (if any) now.
855
 
    */
856
 
    if (!(error= ha_commit_trans(session, 0)))
857
 
      if (! session->endTransaction(COMMIT))
858
 
        error= 1;
859
 
 
860
 
  }
861
 
  return error;
862
 
}
863
 
 
864
836
int Cursor::index_next_same(unsigned char *buf, const unsigned char *key, uint32_t keylen)
865
837
{
866
838
  int error;