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 <cstddef>
00024 
00025 namespace drizzled
00026 {
00027 
00028 namespace plugin
00029 {
00030 class MonitoredInTransaction;
00031 class TransactionalStorageEngine;
00032 class XaResourceManager;
00033 }
00034 
00050 class ResourceContext
00051 {
00052 public:
00053   ResourceContext() :
00054     monitored(NULL),
00055     xa_resource_manager(NULL),
00056     trx_storage_engine(NULL),
00057     modified_data(false)
00058   {}
00059 
00061   void reset();
00062 
00067   void markModifiedData();
00068 
00073   bool hasModifiedData() const;
00074 
00080   bool isStarted() const;
00081 
00085   void coalesceWith(const ResourceContext *stmt_trx);
00086 
00091   plugin::MonitoredInTransaction *getMonitored() const
00092   {
00093     return monitored;
00094   }
00095 
00099   void setMonitored(plugin::MonitoredInTransaction *in_monitored)
00100   {
00101     monitored= in_monitored;
00102   }
00103 
00108   plugin::TransactionalStorageEngine *getTransactionalStorageEngine() const
00109   {
00110     return trx_storage_engine;
00111   }
00112 
00116   void setTransactionalStorageEngine(plugin::TransactionalStorageEngine *in_trx_storage_engine)
00117   {
00118     trx_storage_engine= in_trx_storage_engine;
00119   }
00120 
00125   plugin::XaResourceManager *getXaResourceManager() const
00126   {
00127     return xa_resource_manager;
00128   }
00129 
00133   void setXaResourceManager(plugin::XaResourceManager *in_xa_resource_manager)
00134   {
00135     xa_resource_manager= in_xa_resource_manager;
00136   }
00137 private:
00141   plugin::MonitoredInTransaction *monitored;
00145   plugin::XaResourceManager *xa_resource_manager;
00149   plugin::TransactionalStorageEngine *trx_storage_engine;
00154   bool modified_data;
00155 };
00156 
00157 } /* namespace drizzled */
00158