• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
19 #include "sqlite_log_table_manager.h"
20 
21 namespace DistributedDB {
22 class SplitDeviceLogTableManager : public SqliteLogTableManager {
23 public:
24     SplitDeviceLogTableManager() = default;
25     ~SplitDeviceLogTableManager() 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     std::string GetConflictPkSql(const TableInfo &table) override;
31 private:
32     std::string GetPrimaryKeySql(const TableInfo &table) override;
33 
34     // The parameter "identity" is a hash string that identifies a device. The same for the next two functions.
35     std::string GetInsertTrigger(const TableInfo &table, const std::string &identity) override;
36     std::string GetUpdateTrigger(const TableInfo &table, const std::string &identity) override;
37     std::string GetDeleteTrigger(const TableInfo &table, const std::string &identity) override;
38     std::vector<std::string> GetDropTriggers(const TableInfo &table) override;
39 };
40 } // namespace DistributedDB
41 #endif // SPLICT_DEVICE_LOG_TABLE_MANAGER_H