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 #ifndef FRAMEWORKS_SERVICES_MEDIA_CLOUD_ENHANCEMENT_INCLUDE_ENHANCEMENT_DATABASE_OPERATIONS_H 17 #define FRAMEWORKS_SERVICES_MEDIA_CLOUD_ENHANCEMENT_INCLUDE_ENHANCEMENT_DATABASE_OPERATIONS_H 18 19 #include "enhancement_service_callback.h" 20 21 #include "file_asset.h" 22 #include "result_set.h" 23 #include "medialibrary_command.h" 24 #include "rdb_predicates.h" 25 #include "medialibrary_rdb_transaction.h" 26 27 namespace OHOS { 28 namespace Media { 29 #define EXPORT __attribute__ ((visibility ("default"))) 30 class EnhancementDatabaseOperations { 31 public: 32 EXPORT static std::shared_ptr<NativeRdb::ResultSet> Query(MediaLibraryCommand &cmd, 33 NativeRdb::RdbPredicates &servicePredicates, const std::vector<std::string> &columns); 34 EXPORT static std::shared_ptr<NativeRdb::ResultSet> BatchQuery(MediaLibraryCommand &cmd, 35 const std::vector<std::string> &columns, std::unordered_map<int32_t, std::string> &fileId2Uri); 36 EXPORT static int32_t Update(NativeRdb::ValuesBucket &rdbValues, NativeRdb::AbsRdbPredicates &predicates); 37 EXPORT static int32_t InsertCloudEnhancementImageInDb(MediaLibraryCommand &cmd, const FileAsset &fileAsset, 38 int32_t sourceFileId, std::shared_ptr<CloudEnhancementFileInfo> info, 39 std::shared_ptr<NativeRdb::ResultSet> resultSet, std::shared_ptr<TransactionOperations> trans = nullptr); 40 EXPORT static std::shared_ptr<NativeRdb::ResultSet> GetPair(MediaLibraryCommand &cmd); 41 }; 42 } // namespace Media 43 } // namespace OHOS 44 #endif // FRAMEWORKS_SERVICES_MEDIA_CLOUD_ENHANCEMENT_INCLUDE_ENHANCEMENT_DATABASE_OPERATIONS_H