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 FIRMWARE_COMPONENT_TABLE_H 17 #define FIRMWARE_COMPONENT_TABLE_H 18 19 #ifdef RELATIONAL_STORE_NATIVE_RDB_ENABLE 20 #include "values_bucket.h" 21 22 #include "itable.h" 23 #endif 24 #include "firmware_component.h" 25 26 namespace OHOS { 27 namespace UpdateEngine { 28 const std::string FIRMWARE_TABLE_COMPONENT = "component"; 29 const std::string COLUMN_COMPONENT_VERSION_ID = "versionId"; 30 const std::string COLUMN_COMPONENT_VERSION_PACKAGE_TYPE = "versionPackageType"; 31 const std::string COLUMN_COMPONENT_PACKAGE_INDEX = "packageIndex"; 32 const std::string COLUMN_COMPONENT_TARGET_BL_DISPLAY_VERSION_NUMBER = "targetBlDisplayVersionNumber"; 33 const std::string COLUMN_COMPONENT_TARGET_BL_VERSION_NUMBER = "targetBlVersionNumber"; 34 const std::string COLUMN_COMPONENT_VERSION_NUMBER = "versionNumber"; 35 const std::string COLUMN_COMPONENT_BL_VERSION_INFO = "blVersionInfo"; 36 const std::string COLUMN_COMPONENT_DESCRIPT_PACKAGE_ID = "descriptPackageId"; 37 const std::string COLUMN_COMPONENT_COMPONENT_ID = "componentId"; 38 const std::string COLUMN_COMPONENT_CHANGELOG_URL = "changelogUrl"; 39 const std::string COLUMN_COMPONENT_BL_VERSION_TYPE = "blVersionType"; 40 const std::string COLUMN_COMPONENT_IS_NEED_RESTART = "isNeedRestart"; 41 const std::string COLUMN_COMPONENT_PATCH_TYPE = "patchType"; 42 const std::string COLUMN_COMPONENT_DOWNLOAD_URL = "url"; 43 const std::string COLUMN_COMPONENT_RESERVE_URL = "reserveUrl"; 44 const std::string COLUMN_COMPONENT_STORAGE_TYPE = "storageType"; 45 const std::string COLUMN_COMPONENT_VERIFY_INFO = "verifyInfo"; 46 const std::string COLUMN_COMPONENT_SIZE = "size"; 47 const std::string COLUMN_COMPONENT_FILENAME = "fileName"; 48 const std::string COLUMN_COMPONENT_SPATH = "spath"; 49 const std::string COLUMN_COMPONENT_STATUS = "status"; 50 const std::string COLUMN_COMPONENT_PROGRESS = "progress"; 51 52 // 预留6个字段 53 const std::string COLUMN_COMPONENT_EXTENDS1 = "extends1"; 54 const std::string COLUMN_COMPONENT_EXTENDS2 = "extends2"; 55 const std::string COLUMN_COMPONENT_EXTENDS3 = "extends3"; 56 const std::string COLUMN_COMPONENT_EXTENDS4 = "extends4"; 57 const std::string COLUMN_COMPONENT_EXTENDS5 = "extends5"; 58 const std::string COLUMN_COMPONENT_EXTENDS6 = "extends6"; 59 60 #ifdef RELATIONAL_STORE_NATIVE_RDB_ENABLE 61 class FirmwareComponentTable final: public ITable<FirmwareComponent> { 62 #else 63 class FirmwareComponentTable final { 64 #endif 65 public: 66 FirmwareComponentTable() = default; 67 ~FirmwareComponentTable() = default; 68 #ifdef RELATIONAL_STORE_NATIVE_RDB_ENABLE 69 std::string GetTableName() final; 70 std::string GetTableCreateSql() final; 71 void ParseDbValue(ResultSet *resultSet, FirmwareComponent &value) final; 72 void BuildDbValue(const FirmwareComponent &value, NativeRdb::ValuesBucket &dbValue) final; 73 #else 74 std::string GetTableName(); 75 std::string GetTableCreateSql(); 76 #endif 77 }; 78 } // namespace UpdateEngine 79 } // namespace OHOS 80 #endif // FIRMWARE_COMPONENT_TABLE_H 81