1 /*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 #include "rdb_errno.h"
16 #include "ability_rdb_open_callback.h"
17 #include "hilog_wrapper.h"
18
19 namespace OHOS {
20 namespace AAFwk {
AbilityRdbOpenCallback(const RdbConfig & rdbConfig)21 AbilityRdbOpenCallback::AbilityRdbOpenCallback(const RdbConfig &rdbConfig)
22 : rdbConfig_(rdbConfig) {}
23
OnCreate(NativeRdb::RdbStore & rdbStore)24 int32_t AbilityRdbOpenCallback::OnCreate(NativeRdb::RdbStore &rdbStore)
25 {
26 HILOG_INFO("OnCreate");
27 return NativeRdb::E_OK;
28 }
29
OnUpgrade(NativeRdb::RdbStore & rdbStore,int currentVersion,int targetVersion)30 int32_t AbilityRdbOpenCallback::OnUpgrade(
31 NativeRdb::RdbStore &rdbStore, int currentVersion, int targetVersion)
32 {
33 HILOG_INFO("OnUpgrade currentVersion: %{plubic}d, targetVersion: %{plubic}d",
34 currentVersion, targetVersion);
35 return NativeRdb::E_OK;
36 }
37
OnDowngrade(NativeRdb::RdbStore & rdbStore,int currentVersion,int targetVersion)38 int32_t AbilityRdbOpenCallback::OnDowngrade(
39 NativeRdb::RdbStore &rdbStore, int currentVersion, int targetVersion)
40 {
41 HILOG_INFO("OnDowngrade currentVersion: %{plubic}d, targetVersion: %{plubic}d",
42 currentVersion, targetVersion);
43 return NativeRdb::E_OK;
44 }
45
OnOpen(NativeRdb::RdbStore & rdbStore)46 int32_t AbilityRdbOpenCallback::OnOpen(NativeRdb::RdbStore &rdbStore)
47 {
48 HILOG_INFO("OnOpen");
49 return NativeRdb::E_OK;
50 }
51
onCorruption(std::string databaseFile)52 int32_t AbilityRdbOpenCallback::onCorruption(std::string databaseFile)
53 {
54 return NativeRdb::E_OK;
55 }
56 } // namespace AAFwk
57 } // namespace OHOS
58