1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems
5
* Copyright (c) 2010 Jay Pipes <jaypipes@gmail.com>
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; version 2 of the License.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
#ifndef DRIZZLED_RESOURCE_CONTEXT_H
22
#define DRIZZLED_RESOURCE_CONTEXT_H
31
class MonitoredInTransaction;
32
class TransactionalStorageEngine;
33
class XaResourceManager;
37
* Either statement transaction or normal transaction - related
38
* session-specific resource manager data state.
40
* If a resource manager participates in a statement/transaction,
41
* an instance of this class is present in
42
* session->transaction.{stmt|all}.resource_contexts.
44
* When it's time to commit or rollback, each resource context
45
* is used to access the resource manager's prepare()/commit()/rollback()
46
* methods, and also to evaluate if a full two phase commit is
49
* @sa General description of transaction handling in drizzled/transaction_services.cc.
56
xa_resource_manager(NULL),
57
trx_storage_engine(NULL),
61
/** Clear, prepare for reuse. */
65
* Marks that the underlying resource manager
66
* has modified data state.
68
void markModifiedData();
71
* Returns true if the underlying resource manager
72
* has modified data state.
74
bool hasModifiedData() const;
77
* Returns true if the underlying resource
78
* manager has registered with the transaction
79
* manager for this transaction.
81
bool isStarted() const;
84
* Mark this context as modifying data if the argument has also modified data
86
void coalesceWith(const ResourceContext *stmt_trx);
89
* Returns the underlying descriptor for the resource
90
* this context tracks.
92
plugin::MonitoredInTransaction *getMonitored() const
98
* Sets the underlying descriptor for the resource
100
void setMonitored(plugin::MonitoredInTransaction *in_monitored)
102
monitored= in_monitored;
106
* Returns the underlying transactional storage engine
107
* this context tracks or NULL if not SQL transactional capable.
109
plugin::TransactionalStorageEngine *getTransactionalStorageEngine() const
111
return trx_storage_engine;
115
* Sets the underlying transactional storage engine
117
void setTransactionalStorageEngine(plugin::TransactionalStorageEngine *in_trx_storage_engine)
119
trx_storage_engine= in_trx_storage_engine;
123
* Returns the underlying XA resource manager
124
* this context tracks or NULL if not XA capable.
126
plugin::XaResourceManager *getXaResourceManager() const
128
return xa_resource_manager;
132
* Sets the underlying xa resource manager
134
void setXaResourceManager(plugin::XaResourceManager *in_xa_resource_manager)
136
xa_resource_manager= in_xa_resource_manager;
140
* A descriptor of the monitored resource
142
plugin::MonitoredInTransaction *monitored;
144
* The XA resource manager or NULL if not XA capable.
146
plugin::XaResourceManager *xa_resource_manager;
148
* The transactional storage engine or NULL if not SQL transaction capable.
150
plugin::TransactionalStorageEngine *trx_storage_engine;
152
* Whether the underlying resource manager has changed
158
} /* namespace drizzled */
160
#endif /* DRIZZLED_RESOURCE_CONTEXT_H */