00001 /* -*- c++ -*- 00002 * __BEGIN_COPYRIGHT 00003 * SimpleDB: C++ ODBC database API 00004 * Copyright (C) 2006 Eminence Technology Pty Ltd 00005 * Copyright (C) 2008-2010 Russell Kliese 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public License 00018 * along with this library; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00020 * 00021 * Russell Kliese can be contacted by email: russell [at] kliese [dot] id [dot] au 00022 * 00023 * __END_COPYRIGHT 00024 */ 00025 00026 #ifndef _SIMPLEDB_SCOPEDTRANSACTION_H_ 00027 #define _SIMPLEDB_SCOPEDTRANSACTION_H_ 00028 00029 namespace SimpleDB { 00030 00031 class Database; 00032 00033 struct DatabasePimplData; 00034 00054 class ScopedTransaction { 00055 00056 public: 00057 00061 ScopedTransaction(Database& database); 00062 00065 virtual void commit(); 00066 00069 virtual void rollback(); 00070 00075 virtual ~ScopedTransaction(); 00076 00077 private: 00078 00079 bool _commit; 00080 DatabasePimplData& databasePimplData; 00081 }; 00082 } 00083 #endif