/usr/include/pqxx/transaction.hxx is in libpqxx-dev 4.0.1+dfsg-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | /*-------------------------------------------------------------------------
*
* FILE
* pqxx/transaction.hxx
*
* DESCRIPTION
* definition of the pqxx::transaction class.
* pqxx::transaction represents a standard database transaction
* DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/transaction instead.
*
* Copyright (c) 2001-2011, Jeroen T. Vermeulen <jtv@xs4all.nl>
*
* See COPYING for copyright license. If you did not receive a file called
* COPYING with this source code, please notify the distributor of this mistake,
* or contact the author.
*
*-------------------------------------------------------------------------
*/
#ifndef PQXX_H_TRANSACTION
#define PQXX_H_TRANSACTION
#include "pqxx/compiler-public.hxx"
#include "pqxx/compiler-internal-pre.hxx"
#include "pqxx/dbtransaction"
#ifdef PQXX_QUIET_DESTRUCTORS
#include "pqxx/errorhandler"
#endif
/* Methods tested in eg. self-test program test1 are marked with "//[t1]"
*/
namespace pqxx
{
/**
* @addtogroup transaction Transaction classes
*/
//@{
class PQXX_LIBEXPORT basic_transaction : public dbtransaction
{
protected:
basic_transaction( //[t1]
connection_base &C,
const PGSTD::string &IsolationLevel,
readwrite_policy);
private:
virtual void do_commit(); //[t1]
};
/// Standard back-end transaction, templatized on isolation level
/** This is the type you'll normally want to use to represent a transaction on
* the database.
*
* While you may choose to create your own transaction object to interface to
* the database backend, it is recommended that you wrap your transaction code
* into a transactor code instead and let the transaction be created for you.
* @see pqxx/transactor.hxx
*
* If you should find that using a transactor makes your code less portable or
* too complex, go ahead, create your own transaction anyway.
*
* Usage example: double all wages
*
* @code
* extern connection C;
* work T(C);
* try
* {
* T.exec("UPDATE employees SET wage=wage*2");
* T.commit(); // NOTE: do this inside try block
* }
* catch (const exception &e)
* {
* cerr << e.what() << endl;
* T.abort(); // Usually not needed; same happens when T's life ends.
* }
* @endcode
*/
template<
isolation_level ISOLATIONLEVEL=read_committed,
readwrite_policy READWRITE=read_write>
class transaction : public basic_transaction
{
public:
typedef isolation_traits<ISOLATIONLEVEL> isolation_tag;
/// Create a transaction
/**
* @param C Connection for this transaction to operate on
* @param TName Optional name for transaction; must begin with a letter and
* may contain letters and digits only
*/
explicit transaction(connection_base &C, const PGSTD::string &TName): //[t1]
namedclass(fullname("transaction", isolation_tag::name()), TName),
basic_transaction(C, isolation_tag::name(), READWRITE)
{ Begin(); }
explicit transaction(connection_base &C) : //[t1]
namedclass(fullname("transaction", isolation_tag::name())),
basic_transaction(C, isolation_tag::name(), READWRITE)
{ Begin(); }
virtual ~transaction() throw ()
{
#ifdef PQXX_QUIET_DESTRUCTORS
quiet_errorhandler quiet(conn());
#endif
End();
}
};
/// Bog-standard, default transaction type
typedef transaction<> work;
/// Read-only transaction
typedef transaction<read_committed, read_only> read_transaction;
//@}
}
#include "pqxx/compiler-internal-post.hxx"
#endif
|