]> granicus.if.org Git - postgresql/blob - src/interfaces/libpq++/pgtransdb.h
Here's a version of my suggested diffs transplanted to 7.1 beta 5. I'm
[postgresql] / src / interfaces / libpq++ / pgtransdb.h
1 /*-------------------------------------------------------------------------
2  *
3  * pgtransdb.h
4  *    
5  *
6  *   DESCRIPTION
7  *              Postgres Transaction Database Class: 
8  *                 Query Postgres backend using a transaction block
9  *
10  *   NOTES
11  *      Currently under construction.
12  *
13  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
14  * Portions Copyright (c) 1994, Regents of the University of California
15  *
16  *
17  *  $Id: pgtransdb.h,v 1.7 2001/05/09 17:29:10 momjian Exp $
18  *
19  *-------------------------------------------------------------------------
20  */
21  
22 #ifndef PGTRANSDB_H
23 #define PGTRANSDB_H
24
25 #ifndef PGDATABASE_H
26 #include "pgdatabase.h"
27 #endif
28
29 // ****************************************************************
30 //
31 // PgTransaction - a class for running transactions against databases
32 //
33 // ****************************************************************
34 // This is the database access class that keeps an open
35 // transaction block during its lifetime.  The block is ENDed when
36 // the object is destroyed.
37 class PgTransaction : public PgDatabase {
38 public:
39   explicit PgTransaction(const char* conninfo); // use reasonable & environment defaults
40   // connect to the database with given environment and database name
41   // explicit PgTransaction(const PgConnection&);
42   ~PgTransaction();     // close connection and clean up
43   
44 protected:
45   ExecStatusType BeginTransaction();
46   ExecStatusType EndTransaction();
47   
48 protected:
49   PgTransaction() : PgDatabase(), pgCommitted(true) {}  // Do not connect
50
51 private:
52   bool pgCommitted;
53
54 // We don't support copying of PgTransaction objects,
55 // so make copy constructor and assignment op private.
56    PgTransaction(const PgTransaction&);
57    PgTransaction& operator= (const PgTransaction&);
58 }; // End PgTransaction Class Declaration
59
60 #endif  // PGTRANSDB_H