• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 NATIVE_RDB_PREDICATES_UTILS_H
17 #define NATIVE_RDB_PREDICATES_UTILS_H
18 
19 #include <string>
20 #include <vector>
21 
22 #include "abs_predicates.h"
23 #include "value_object.h"
24 
25 namespace OHOS {
26 namespace NativeRdb {
27 /**
28  * The Predicates class of Utils.
29  */
30 class API_EXPORT PredicatesUtils {
31 public:
32     /**
33      * @brief Constructor.
34      */
35     API_EXPORT PredicatesUtils();
36 
37     /**
38      * @brief Destructor.
39      */
~PredicatesUtils()40     API_EXPORT ~PredicatesUtils() {}
41 
42     /**
43      * @brief Set the parameter of whereClause and bindArgs of the specified Predicates.
44      */
45     [[deprecated("Use SetWhereClauseAndArgs(AbsPredicates *, const std::string &,"
46                  " const std::vector<ValueObject> &) instead.")]]
47     API_EXPORT static void SetWhereClauseAndArgs(
48         AbsPredicates *predicates, const std::string &whereClause, const std::vector<std::string> &whereArgs);
49 
50     /**
51      * @brief Set the parameter of whereClause and bindArgs of the specified Predicates.
52      */
53     API_EXPORT static void SetWhereClauseAndArgs(
54         AbsPredicates *predicates, const std::string &whereClause, const std::vector<ValueObject> &bindArgs);
55 
56     /**
57      * @brief Sets parameters of the specified Predicates including distinct, index, group, order, limit and offset.
58      */
59     API_EXPORT static void SetAttributes(AbsPredicates *predicates, bool isDistinct, const std::string &index,
60         const std::string &group, const std::string &order, const int limit, const int offset);
61 };
62 } // namespace NativeRdb
63 } // namespace OHOS
64 
65 #endif
66