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 namespace OHOS { 27 namespace Media { 28 #define EXPORT __attribute__ ((visibility ("default"))) 29 class EnhancementDatabaseOperations { 30 public: 31 EXPORT static std::shared_ptr<NativeRdb::ResultSet> Query(MediaLibraryCommand &cmd, 32 NativeRdb::RdbPredicates &servicePredicates, const std::vector<std::string> &columns); 33 EXPORT static std::shared_ptr<NativeRdb::ResultSet> BatchQuery(MediaLibraryCommand &cmd, 34 const std::vector<std::string> &columns, std::unordered_map<int32_t, std::string> &fileId2Uri); 35 EXPORT static int32_t Update(NativeRdb::ValuesBucket &rdbValues, NativeRdb::AbsRdbPredicates &predicates); 36 EXPORT static int32_t InsertCloudEnhancementImageInDb(MediaLibraryCommand &cmd, const FileAsset &fileAsset, 37 int32_t sourceFileId, std::shared_ptr<CloudEnhancementFileInfo> info, 38 std::shared_ptr<NativeRdb::ResultSet> resultSet, std::shared_ptr<TransactionOperations> trans = nullptr); 39 EXPORT static std::shared_ptr<NativeRdb::ResultSet> GetPair(MediaLibraryCommand &cmd); 40 EXPORT static int64_t InsertCloudEnhancementPerm(int32_t sourceFileId, int32_t targetFileId); 41 EXPORT static int32_t QueryAndUpdatePhotos(const std::vector<std::string> &photoIds); 42 }; 43 } // namespace Media 44 } // namespace OHOS 45 #endif // FRAMEWORKS_SERVICES_MEDIA_CLOUD_ENHANCEMENT_INCLUDE_ENHANCEMENT_DATABASE_OPERATIONS_H