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