Drizzled Public API Documentation

resource_context.h
00001 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 2008 Sun Microsystems, Inc.
00005  *  Copyright (C) 2010 Jay Pipes <jaypipes@gmail.com>
00006  *
00007  *  This program is free software; you can redistribute it and/or modify
00008  *  it under the terms of the GNU General Public License as published by
00009  *  the Free Software Foundation; version 2 of the License.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00019  */
00020 
00021 #pragma once
00022 
00023 #include <drizzled/common_fwd.h>
00024 
00025 namespace drizzled {
00026 
00042 class ResourceContext
00043 {
00044 public:
00045   ResourceContext() :
00046     monitored(NULL),
00047     xa_resource_manager(NULL),
00048     trx_storage_engine(NULL),
00049     modified_data(false)
00050   {}
00051 
00053   void reset();
00054 
00059   void markModifiedData();
00060 
00065   bool hasModifiedData() const;
00066 
00072   bool isStarted() const;
00073 
00077   void coalesceWith(const ResourceContext *stmt_trx);
00078 
00083   plugin::MonitoredInTransaction *getMonitored() const
00084   {
00085     return monitored;
00086   }
00087 
00091   void setMonitored(plugin::MonitoredInTransaction *in_monitored)
00092   {
00093     monitored= in_monitored;
00094   }
00095 
00100   plugin::TransactionalStorageEngine *getTransactionalStorageEngine() const
00101   {
00102     return trx_storage_engine;
00103   }
00104 
00108   void setTransactionalStorageEngine(plugin::TransactionalStorageEngine *in_trx_storage_engine)
00109   {
00110     trx_storage_engine= in_trx_storage_engine;
00111   }
00112 
00117   plugin::XaResourceManager *getXaResourceManager() const
00118   {
00119     return xa_resource_manager;
00120   }
00121 
00125   void setXaResourceManager(plugin::XaResourceManager *in_xa_resource_manager)
00126   {
00127     xa_resource_manager= in_xa_resource_manager;
00128   }
00129 private:
00133   plugin::MonitoredInTransaction *monitored;
00137   plugin::XaResourceManager *xa_resource_manager;
00141   plugin::TransactionalStorageEngine *trx_storage_engine;
00146   bool modified_data;
00147 };
00148 
00149 } /* namespace drizzled */
00150