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 17 #ifndef DATASHARE_PREDICATES_DEF_H 18 #define DATASHARE_PREDICATES_DEF_H 19 20 #include <string> 21 #include <vector> 22 #include "datashare_predicates_object.h" 23 #include "datashare_predicates_objects.h" 24 namespace OHOS { 25 namespace DataShare { 26 /** 27 * @brief SetOperationList parameters. 28 */ 29 typedef enum { 30 /** Indicates the parameters is INVALID_OPERATION.*/ 31 INVALID_OPERATION = 0x0, 32 /** Indicates the parameters is EQUAL_TO.*/ 33 EQUAL_TO, 34 /** Indicates the parameters is NOT_EQUAL_TO.*/ 35 NOT_EQUAL_TO, 36 /** Indicates the parameters is GREATER_THAN.*/ 37 GREATER_THAN, 38 /** Indicates the parameters is LESS_THAN.*/ 39 LESS_THAN, 40 /** Indicates the parameters is GREATER_THAN_OR_EQUAL_TO.*/ 41 GREATER_THAN_OR_EQUAL_TO, 42 /** Indicates the parameters is LESS_THAN_OR_EQUAL_TO.*/ 43 LESS_THAN_OR_EQUAL_TO, 44 /** Indicates the parameters is AND.*/ 45 AND, 46 /** Indicates the parameters is OR.*/ 47 OR, 48 /** Indicates the parameters is IS_NULL.*/ 49 IS_NULL, 50 /** Indicates the parameters is IS_NOT_NULL.*/ 51 IS_NOT_NULL, 52 /** Indicates the parameters is SQL_IN.*/ 53 SQL_IN, 54 /** Indicates the parameters is NOT_IN.*/ 55 NOT_IN, 56 /** Indicates the parameters is LIKE.*/ 57 LIKE, 58 /** Indicates the parameters is UNLIKE.*/ 59 UNLIKE, 60 /** Indicates the parameters is ORDER_BY_ASC.*/ 61 ORDER_BY_ASC, 62 /** Indicates the parameters is ORDER_BY_DESC.*/ 63 ORDER_BY_DESC, 64 /** Indicates the parameters is LIMIT.*/ 65 LIMIT, 66 /** Indicates the parameters is OFFSET.*/ 67 OFFSET, 68 /** Indicates the parameters is BEGIN_WARP.*/ 69 BEGIN_WARP, 70 /** Indicates the parameters is END_WARP.*/ 71 END_WARP, 72 /** Indicates the parameters is BEGIN_WITH.*/ 73 BEGIN_WITH, 74 /** Indicates the parameters is END_WITH.*/ 75 END_WITH, 76 /** Indicates the parameters is IN_KEY.*/ 77 IN_KEY, 78 /** Indicates the parameters is DISTINCT.*/ 79 DISTINCT, 80 /** Indicates the parameters is GROUP_BY.*/ 81 GROUP_BY, 82 /** Indicates the parameters is INDEXED_BY.*/ 83 INDEXED_BY, 84 /** Indicates the parameters is CONTAINS.*/ 85 CONTAINS, 86 /** Indicates the parameters is GLOB.*/ 87 GLOB, 88 /** Indicates the parameters is BETWEEN.*/ 89 BETWEEN, 90 /** Indicates the parameters is NOTBETWEEN.*/ 91 NOTBETWEEN, 92 /** Indicates the parameters is KEY_PREFIX.*/ 93 KEY_PREFIX, 94 /** Indicates the parameters is CROSSJOIN.*/ 95 CROSSJOIN, 96 /** Indicates the parameters is INNERJOIN.*/ 97 INNERJOIN, 98 /** Indicates the parameters is LEFTOUTERJOIN.*/ 99 LEFTOUTERJOIN, 100 /** Indicates the parameters is USING.*/ 101 USING, 102 /** Indicates the parameters is ON.*/ 103 ON, 104 /** Indicates the parameters is LAST_TYPE.*/ 105 LAST_TYPE 106 } OperationType; 107 108 /** 109 * @brief OperationItem. 110 */ 111 struct OperationItem { 112 /** operation.*/ 113 int32_t operation; 114 /** The type of singleParams*/ 115 std::vector<SingleValue::Type> singleParams; 116 /** The type of multiParams*/ 117 std::vector<MutliValue::Type> multiParams; 118 /** SingleValue GetSingle.*/ GetSingleOperationItem119 inline SingleValue GetSingle(int32_t index) const 120 { 121 return singleParams[index]; 122 } 123 }; 124 125 /** 126 * @brief typedef. 127 */ 128 typedef enum : int16_t { 129 /** The type of INVALID_MODE*/ 130 INVALID_MODE, 131 /** The type of QUERY_LANGUAGE*/ 132 QUERY_LANGUAGE, 133 /** The type of PREDICATES_METHOD*/ 134 PREDICATES_METHOD 135 } SettingMode; 136 } // namespace DataShare 137 } // namespace OHOS 138 139 #endif