1 /*
2  * Copyright (C) 2024 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 
16 
17 #ifndef OHOS_MEDIA_DFX_DATABASE_UTILS_H
18 #define OHOS_MEDIA_DFX_DATABASE_UTILS_H
19 
20 #include <string>
21 #include <vector>
22 
23 #include "rdb_helper.h"
24 #include "result_set.h"
25 #include "rdb_predicates.h"
26 #include "dfx_const.h"
27 
28 namespace OHOS {
29 namespace Media {
30 #define EXPORT __attribute__ ((visibility ("default")))
31 class DfxDatabaseUtils {
32 public:
33     EXPORT static int32_t QueryFromPhotos(int32_t mediaType, int32_t position);
34     EXPORT static AlbumInfo QueryAlbumInfoBySubtype(int32_t albumSubtype);
35     EXPORT static std::vector<PhotoInfo> QueryDirtyCloudPhoto();
36     EXPORT static int32_t QueryAnalysisVersion(const std::string &table, const std::string &column);
37     EXPORT static int32_t QueryDownloadedAndGeneratedThumb(int32_t& downloadedThumb, int32_t& generatedThumb);
38     EXPORT static int32_t QueryTotalCloudThumb(int32_t& totalDownload);
39     EXPORT static int32_t QueryDbVersion();
40     EXPORT static int32_t QueryPhotoRecordInfo(PhotoRecordInfo &photoRecordInfo);
41 
42 private:
43     static int32_t QueryInt(const NativeRdb::AbsRdbPredicates &predicates, const std::vector<std::string> &columns,
44         const std::string &queryColumn, int32_t &value);
45     static int32_t QueryDouble(const NativeRdb::AbsRdbPredicates &predicates, const std::vector<std::string> &columns,
46         const std::string &queryColumn, double &value);
47 };
48 } // namespace Media
49 } // namespace OHOS
50 
51 #endif  // OHOS_MEDIA_DFX_DATABASE_UTILS_H