This file is indexed.

/usr/include/KDb3/KDbTransaction.h is in libkdb3-dev 3.1.0-2.

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
/* This file is part of the KDE project
   Copyright (C) 2003-2017 Jarosław Staniek <staniek@kde.org>

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this program; see the file COPYING.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
*/

#ifndef KDB_TRANSACTION_H
#define KDB_TRANSACTION_H

#include "config-kdb.h"
#include "kdb_export.h"

#include <QtGlobal>

class KDbConnection;
class KDbTransactionData;

/**
 * @brief This class encapsulates a single database transaction
 *
 * The KDbTransaction handle abstracts a database transaction for given database connection.
 * Transaction objects are value-based, implicitly shared.
 *
 * Lifetime of the transaction object is closely related to a KDbConnection object.
 * Deleting the either instance does not commit or rollback the actual transaction.
 * Use KDbTransactionGuard for automatic commits or rolls back.
 *
 * @see KDbConnection::beginTransaction()
 */
class KDB_EXPORT KDbTransaction
{
public:
    /**
     * @brief Constructs a null transaction.
     *
     * @note It can be initialized only by KDbConnection.
     */
    KDbTransaction();

    /**
     * @brief Copy constructor
     */
    KDbTransaction(const KDbTransaction& trans);

    ~KDbTransaction();

    //! Options for commiting and rolling back transactions
    //! @see KDbConnection::beginTransaction() KDbConnection::rollbackTransaction()
    //! @see KDbTransactionGuard::commit() KDbTransactionGuard::rollback()
    enum class CommitOption {
        None = 0,
        IgnoreInactive = 1 //!< Do not return error for inactive or null transactions when
                           //!< requesting commit or rollback
    };
    Q_DECLARE_FLAGS(CommitOptions, CommitOption)

    KDbTransaction& operator=(const KDbTransaction& trans);

    /**
     * @brief Returns @c true if this transaction is equal to @a other; otherwise returns @c false
     *
     * Two transactions are equal if they encapsulate the same physical transaction,
     * i.e. copy constructor or assignment operator was used.
     * Two null transaction objects are equal.
     */
    bool operator==(const KDbTransaction& other) const;

    //! @return @c true if this transaction is not equal to @a other; otherwise returns @c false.
    //! @since 3.1
    inline bool operator!=(const KDbTransaction &other) const { return !operator==(other); }

    /**
     * @brief Returns database connection for which the transaction belongs.
     *
     * @c nullptr is returned for null transactions.
     */
    KDbConnection* connection();

    //! @overload
    //! @since 3.1
    const KDbConnection* connection() const;

    /**
     * @brief Returns @c true if transaction is active (i.e. started)
     *
     * @return @c false also if transaction is uninitialised (null) or not started.
     * @see KDbConnection::beginTransaction()
     * @since 3.1
     */
    bool isActive() const;

    /**
     * @brief Returns @c true if this transaction is null.
     *
     * Null implies !isActive().
     */
    bool isNull() const;

#ifdef KDB_TRANSACTIONS_DEBUG
    //! Helper for debugging, returns value of global transaction data reference counter
    static int globalCount();
#endif

protected:
    KDbTransactionData *m_data;

    friend class KDbConnection;
};

Q_DECLARE_OPERATORS_FOR_FLAGS(KDbTransaction::CommitOptions)

#endif