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 RINGTONE_UNISTORE_H 17 #define RINGTONE_UNISTORE_H 18 19 #include "ability_context.h" 20 #include "rdb_helper.h" 21 #include "ringtone_data_command.h" 22 23 namespace OHOS { 24 namespace Media { 25 #define EXPORT __attribute__ ((visibility ("default"))) 26 class RingtoneUnistore { 27 public: 28 EXPORT RingtoneUnistore() = default; 29 EXPORT virtual ~RingtoneUnistore() = default; 30 31 EXPORT virtual int32_t Init() = 0; 32 EXPORT virtual void Stop() = 0; 33 34 EXPORT virtual int32_t Insert(RingtoneDataCommand &cmd, int64_t &rowId) = 0; 35 EXPORT virtual int32_t Delete(RingtoneDataCommand &cmd, int32_t &rowId) = 0; 36 EXPORT virtual int32_t Update(RingtoneDataCommand &cmd, int32_t &rowId) = 0; Query(RingtoneDataCommand & cmd,const std::vector<std::string> & columns)37 EXPORT virtual std::shared_ptr<NativeRdb::ResultSet> Query(RingtoneDataCommand &cmd, 38 const std::vector<std::string> &columns) 39 { 40 return nullptr; 41 } 42 ExecuteSql(const std::string & sql)43 EXPORT virtual int32_t ExecuteSql(const std::string &sql) 44 { 45 return NativeRdb::E_NOT_SUPPORT; 46 } 47 48 EXPORT virtual std::shared_ptr<NativeRdb::ResultSet> QuerySql(const std::string &sql, 49 const std::vector<std::string> &selectionArgs = std::vector<std::string>()) 50 { 51 return nullptr; 52 } 53 EXPORT virtual std::shared_ptr<NativeRdb::RdbStore> GetRaw() = 0; 54 }; 55 } // namespace Media 56 } // namespace OHOS 57 58 #endif // RINGTONE_UNISTORE_H 59