Transaction.hh

00001 //********************************************************************
00002 //*** ResourcePool/mysql/Transaction.hh
00003 //*** Copyright (c) 2003-2009 by Markus Winand <mws@fatalmind.com>
00004 //*** $Id: Transaction.hh,v 1.4 2009-03-02 14:16:45 mws Exp $
00005 //********************************************************************
00006 /*
00007 This file is part of ResourcePool.
00008 
00009 ResourcePool is free software; you can redistribute it
00010 and/or modify it under the terms of the GNU General Public License
00011 as published by the Free Software Foundation; either version 2 of
00012 the License, or (at your option) any later version.
00013 
00014 ResourcePool is distributed in the hope that it will be
00015 useful, but WITHOUT ANY WARRANTY; without even the implied warranty
00016 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 GNU General Public License for more details.
00018 
00019 You should have received a copy of the GNU General Public License
00020 along with ResourcePool; if not, write to the Free Software
00021 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00022 02111-1307  USA */
00023 
00024 #ifndef RESOURCEPOOL_MYSQL_RESOURCEPOOL_HH
00025 #include "ResourcePool.hh"
00026 #endif
00027 
00028 #include <memory>
00029 
00030 #ifndef RESOURCEPOOL_MYSQL_TRANSACTION_HH
00031 #define RESOURCEPOOL_MYSQL_TRANSACTION_HH
00032 
00033 #ifndef RESOURCEPOOL_COMMAND_HH
00034 #include "ResourcePool/Command.hh"
00035 #endif
00036 
00037 //#ifndef RESOURCEPOOL_MYSQL_SQLTYPE_HH
00038 //#include "SQLType.hh"
00039 //#endif
00040 
00041 #ifndef RESOURCEPOOL_MYSQL_MYSQLFWD_HH
00042 #include "mysqlFwd.hh"
00043 #endif
00044 
00045 #ifndef INCLUDED_GC_PTR_HH
00046 #include "mm/gc_ptr.hh"
00047 #endif
00048 
00049 #include <string>
00050 
00051 namespace fatalmind {
00052 namespace mysql {
00053 
00057 class Transaction
00058 : public Command<fatalmind::ResourceType::mysql>
00059 {
00060     public:
00061         Transaction(const Command<fatalmind::ResourceType::mysql>& );
00062         Transaction(const ResourcePool<ResourceType>& p, const Command<fatalmind::ResourceType::mysql>& );
00063         Transaction();
00064         Transaction(const Transaction&);
00065         virtual ~Transaction();
00066         virtual void execute(mysqlResource&);
00067 
00068     protected:
00069         virtual Clone* DoClone() const;
00070         void startTransaction(mysqlResource&);
00071         void commit(mysqlResource&);
00072         void rollback(mysqlResource&);
00073 
00074     private:
00075         std::auto_ptr<Command<fatalmind::ResourceType::mysql> > cmd;
00076 };
00077 
00078 
00079 } // namespace mysql
00080 } // namespace fatalmind
00081 #endif

Generated on Mon Nov 9 16:21:24 2009 for ResourcePool by  doxygen 1.5.3