Fix crash when invalid parameter given
[platform/core/api/capability-manager.git] / src / sql_transaction.h
1 // Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by a apache 2.0 license that can be
3 // found in the LICENSE file.
4
5 #ifndef SQL_TRANSACTION_H_
6 #define SQL_TRANSACTION_H_
7
8 namespace capmgr {
9
10 class SQLConnection;
11
12 // BasicLockableClass.
13 // usage:
14 //  SQLTransaction t;
15 //  std::lock_guard<SQLTransaction> guard(t);
16 class SQLTransaction {
17  public:
18   explicit SQLTransaction(SQLConnection* sql_conn) : sql_conn_(sql_conn) {}
19   void lock() const;
20   void unlock() const;
21
22  private:
23   SQLConnection* sql_conn_;
24 };
25
26 }  // namespace capmgr
27
28 #endif  // SQL_TRANSACTION_H_