106694b06Sopenharmony_ci/* 206694b06Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 306694b06Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 406694b06Sopenharmony_ci * you may not use this file except in compliance with the License. 506694b06Sopenharmony_ci * You may obtain a copy of the License at 606694b06Sopenharmony_ci * 706694b06Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 806694b06Sopenharmony_ci * 906694b06Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1006694b06Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1106694b06Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1206694b06Sopenharmony_ci * See the License for the specific language governing permissions and 1306694b06Sopenharmony_ci * limitations under the License. 1406694b06Sopenharmony_ci */ 1506694b06Sopenharmony_ci 1606694b06Sopenharmony_ci#ifndef RELATIONAL_PREDICATES_IMPL_H 1706694b06Sopenharmony_ci#define RELATIONAL_PREDICATES_IMPL_H 1806694b06Sopenharmony_ci 1906694b06Sopenharmony_ci#include "rdb_predicates.h" 2006694b06Sopenharmony_ci#include "oh_predicates.h" 2106694b06Sopenharmony_ci 2206694b06Sopenharmony_cinamespace OHOS { 2306694b06Sopenharmony_cinamespace RdbNdk { 2406694b06Sopenharmony_ciconstexpr int RDB_PREDICATES_CID = 1234561; // The class id used to uniquely identify the OH_Predicates class. 2506694b06Sopenharmony_ciclass RelationalPredicate : public OH_Predicates { 2606694b06Sopenharmony_cipublic: 2706694b06Sopenharmony_ci explicit RelationalPredicate(const char *table); 2806694b06Sopenharmony_ci static RelationalPredicate *GetSelf(OH_Predicates *predicates); 2906694b06Sopenharmony_ci OHOS::NativeRdb::RdbPredicates &Get(); 3006694b06Sopenharmony_ciprivate: 3106694b06Sopenharmony_ci static OH_Predicates *EqualTo(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 3206694b06Sopenharmony_ci static OH_Predicates *NotEqualTo(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 3306694b06Sopenharmony_ci static OH_Predicates *BeginWrap(OH_Predicates *predicates); 3406694b06Sopenharmony_ci static OH_Predicates *EndWrap(OH_Predicates *predicates); 3506694b06Sopenharmony_ci static OH_Predicates *Or(OH_Predicates *predicates); 3606694b06Sopenharmony_ci static OH_Predicates *And(OH_Predicates *predicates); 3706694b06Sopenharmony_ci static OH_Predicates *IsNull(OH_Predicates *predicates, const char *field); 3806694b06Sopenharmony_ci static OH_Predicates *IsNotNull(OH_Predicates *predicates, const char *field); 3906694b06Sopenharmony_ci static OH_Predicates *Like(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 4006694b06Sopenharmony_ci static OH_Predicates *Between(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 4106694b06Sopenharmony_ci static OH_Predicates *NotBetween(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 4206694b06Sopenharmony_ci static OH_Predicates *GreaterThan(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 4306694b06Sopenharmony_ci static OH_Predicates *LessThan(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 4406694b06Sopenharmony_ci static OH_Predicates *GreaterThanOrEqualTo(OH_Predicates *predicates, const char *field, 4506694b06Sopenharmony_ci OH_VObject *valueObject); 4606694b06Sopenharmony_ci static OH_Predicates *LessThanOrEqualTo(OH_Predicates *predicates, const char *field, 4706694b06Sopenharmony_ci OH_VObject *valueObject); 4806694b06Sopenharmony_ci static OH_Predicates *OrderBy(OH_Predicates *predicates, const char *field, OH_OrderType type); 4906694b06Sopenharmony_ci static OH_Predicates *Distinct(OH_Predicates *predicates); 5006694b06Sopenharmony_ci static OH_Predicates *Limit(OH_Predicates *predicates, unsigned int value); 5106694b06Sopenharmony_ci static OH_Predicates *Offset(OH_Predicates *predicates, unsigned int rowOffset); 5206694b06Sopenharmony_ci static OH_Predicates *GroupBy(OH_Predicates *predicates, char const *const *fields, int length); 5306694b06Sopenharmony_ci static OH_Predicates *In(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 5406694b06Sopenharmony_ci static OH_Predicates *NotIn(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 5506694b06Sopenharmony_ci static OH_Predicates *Clear(OH_Predicates *predicates); 5606694b06Sopenharmony_ci static int Destroy(OH_Predicates *predicates); 5706694b06Sopenharmony_ci static bool GetObjects(OH_Predicates *predicates, OH_VObject *valueObject, 5806694b06Sopenharmony_ci std::vector<std::string> &values); 5906694b06Sopenharmony_ci OHOS::NativeRdb::RdbPredicates predicates_; 6006694b06Sopenharmony_ci}; 6106694b06Sopenharmony_ci} // namespace RdbNdk 6206694b06Sopenharmony_ci} // namespace OHOS 6306694b06Sopenharmony_ci#endif // RELATIONAL_PREDICATES_IMPL_H 64