• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef FRAMEWORKS_MEDIATOOLS_UTILS_DATABASE_UTILS_H_
16 #define FRAMEWORKS_MEDIATOOLS_UTILS_DATABASE_UTILS_H_
17 #include <string>
18 #include <vector>
19 
20 #include "datashare_result_set.h"
21 #include "fetch_result.h"
22 #include "file_asset.h"
23 #include "utils/constant_utils.h"
24 
25 namespace OHOS {
26 namespace Media {
27 namespace MediaTool {
28 class DatabaseUtils {
29 public:
30     static bool Dump(const DumpOpt &opt, const std::shared_ptr<FetchResult<FileAsset>> &resultSet);
31     static bool Dump(const DumpOpt &opt, const std::shared_ptr<DataShare::DataShareResultSet> &resultSet);
32     static std::string TitleToStr(const DumpOpt &opt, const std::vector<ColumnInfo> &columnInfos);
33     static int RowToStr(const DumpOpt &opt, const std::shared_ptr<DataShare::DataShareResultSet> &resultSet,
34         const std::vector<ColumnInfo> &columnInfos, std::string &rowStr);
35     static int FieldToStr(const DumpOpt &opt, const ColumnInfo &columnInfo,
36         const std::shared_ptr<DataShare::DataShareResultSet> &resultSet, std::string &value);
37     static int32_t GetColumnInfo(const DumpOpt &opt, const std::shared_ptr<DataShare::DataShareResultSet> &resultSet,
38         std::vector<ColumnInfo> &columnInfos);
39 };
40 } // namespace MediaTool
41 } // namespace Media
42 } // namespace OHOS
43 #endif // FRAMEWORKS_MEDIATOOLS_UTILS_DATABASE_UTILS_H_
44