Fix crash when invalid parameter given
[platform/core/api/capability-manager.git] / src / sql_transaction.cc
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 #include "src/sql_transaction.h"
6
7 #include "src/sql_connection.h"
8
9 namespace capmgr {
10
11 void SQLTransaction::lock() const {
12   sql_conn_->BeginTransaction();
13 }
14
15 void SQLTransaction::unlock() const {
16   if (!sql_conn_->GetErrorCode())
17     sql_conn_->CommitTransaction();
18   else
19     sql_conn_->RollbackTransaction();
20 }
21
22 }  // namespace capmgr