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 16 #ifndef CLOUD_SYNC_LOG_TABLE_MANAGER_H 17 #define CLOUD_SYNC_LOG_TABLE_MANAGER_H 18 19 #include "sqlite_log_table_manager.h" 20 21 namespace DistributedDB { 22 class CloudSyncLogTableManager : public SqliteLogTableManager { 23 public: 24 CloudSyncLogTableManager() = default; 25 ~CloudSyncLogTableManager() override = default; 26 27 // The parameter "references" is "", "NEW." or "OLD.". "identity" is a hash string that identifies a device. 28 std::string CalcPrimaryKeyHash(const std::string &references, const TableInfo &table, 29 const std::string &identity) override; 30 31 private: 32 void GetIndexSql(const TableInfo &table, std::vector<std::string> &schema) override; 33 std::string GetPrimaryKeySql(const TableInfo &table) override; 34 35 // The parameter "identity" is a hash string that identifies a device. The same for the next two functions. 36 std::string GetInsertTrigger(const TableInfo &table, const std::string &identity) override; 37 std::string GetUpdateTrigger(const TableInfo &table, const std::string &identity) override; 38 std::string GetDeleteTrigger(const TableInfo &table, const std::string &identity) override; 39 std::vector<std::string> GetDropTriggers(const TableInfo &table) override; 40 }; 41 42 } // DistributedDB 43 44 #endif // DISTRIBUTED_UT_CLOUD_SYNC_LOG_TABLE_MANAGER_H 45