openharmony 鸿蒙 capi-rdb-oh-predicates

2026-08-25 浏览 (1)

OH_Predicates

typedef struct {...} OH_Predicates

Overview

Defines a predicates object.

Since: 10

Related module: RDB

Header file: oh_predicates.h

Member Variables

NameDescription
int64_t idUnique identifier of the OH_Predicates struct.

Member Functions

NameDescription
OH_Predicates *(*equalTo)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject)Pointer to the function used to create a predicates object to search for the field values that are equal to the specified value.
OH_Predicates *(*notEqualTo)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject)Pointer to the function used to create a predicates object to search for the field values that are not equal to the specified value.
This method is equivalent to "!=" in SQL statements.
OH_Predicates *(*beginWrap)(OH_Predicates *predicates)Pointer to the function used to add a left parenthesis to the predicates.
This method is equivalent to "(" in SQL statements.
OH_Predicates *(*endWrap)(OH_Predicates *predicates)Pointer to the function used to add a right parenthesis to the predicates.
This method is equivalent to ")" in SQL statements.
OH_Predicates *(*orOperate)(OH_Predicates *predicates)Pointer to the function used to add the OR operator to the predicates.
This method is equivalent to OR in SQL statements.
OH_Predicates *(*andOperate)(OH_Predicates *predicates)Pointer to the function used to add the AND operator to the predicates.
This method is equivalent to AND in SQL statements.
OH_Predicates *(*isNull)(OH_Predicates *predicates, const char *field)Pointer to the function used to create a predicates object to search for the field values that are null.
This method is equivalent to IS NULL in SQL statements.
OH_Predicates *(*isNotNull)(OH_Predicates *predicates, const char *field)Pointer to the function used to create a predicates object to search for the field values that are not null.
This method is equivalent to IS NOT NULL in SQL statements.
OH_Predicates *(*like)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject)Pointer to the function used to create a predicates object to search for the field values that are similar to the specified string.
This method is equivalent to LIKE in SQL statements.
OH_Predicates *(*between)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject)Pointer to the function used to create a predicates object to search for the field values that are within the specified range.
This method is equivalent to BETWEEN in SQL statements.
OH_Predicates *(*notBetween)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject)Pointer to the function used to create a predicates object to search for the field values that are out of the specified range.
This method is equivalent to NOT BETWEEN in SQL statements.
OH_Predicates *(*greaterThan)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject)Pointer to the function used to create a predicates object to search for the field values that are greater than the specified value.
This method is equivalent to ">" in SQL statements.
OH_Predicates *(*lessThan)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject)Pointer to the function used to create a predicates object to search for the records that are less than the given value in the specified field.
This method is equivalent to "<" in SQL statements.
OH_Predicates *(*greaterThanOrEqualTo)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject)Pointer to the function used to create a predicates object to search for the field values that are greater than or equal to the specified value.
This method is equivalent to ">=" in SQL statements.
OH_Predicates *(*lessThanOrEqualTo)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject)Pointer to the function used to create a predicates object to search for the records that are less than or equal to the specified valueObject in the specified field.
This method is equivalent to "<=" in SQL statements.
OH_Predicates *(*orderBy)(OH_Predicates *predicates, const char *field, OH_OrderType type)Pointer to the function used to create a predicates object to sort the values in the specified column in ascending or descending order.
This method is equivalent to ORDER BY in SQL statements.
OH_Predicates *(*distinct)(OH_Predicates *predicates)Pointer to the function used to create a predicates object to filter out duplicate records.
This method is equivalent to DISTINCT in SQL statements.
OH_Predicates *(*limit)(OH_Predicates *predicates, unsigned int value)Pointer to the function used to create a predicates object to specify the maximum number of records.
This method is equivalent to LIMIT in SQL statements.
OH_Predicates *(*offset)(OH_Predicates *predicates, unsigned int rowOffset)Pointer to the function used to create a predicates object to specify the start position of the query result.
This method is equivalent to OFFSET in SQL statements.
OH_Predicates *(*groupBy)(OH_Predicates *predicates, char const *const *fields, int length)Pointer to the function used to create a predicates object to group the results by the specified columns.
This method is equivalent to GROUP BY in SQL statements.
OH_Predicates *(*in)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject)Pointer to the function used to create a predicates object to search for the field values that are within the specified range.
This method is equivalent to IN in SQL statements.
OH_Predicates *(*notIn)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject)Pointer to the function used to create a predicates object to search for the field values that are out of the specified range.
This method is equivalent to NOT IN in SQL statements.
OH_Predicates *(*clear)(OH_Predicates *predicates)Pointer to the function used to clear a predicates instance.
int (*destroy)(OH_Predicates *predicates)Destroys an OH_Predicates object and reclaims the memory occupied.

Member Function Description

equalTo()

OH_Predicates *(*equalTo)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject)

Description

Pointer to the function used to create a predicates object to search for the field values that are equal to the specified value.

Since: 10

Parameters

NameDescription
OH_Predicates *predicatesPointer to the OH_Predicates instance.
const char *fieldPointer to the column name in the database table.
OH_VObject *valueObjectPointer to an OH_VObject instance, indicating the value to be matched with the predicate.

Returns

TypeDescription
OH_Predicates *Predicates that match the specified field.

notEqualTo()

OH_Predicates *(*notEqualTo)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject)

Description

Pointer to the function used to create a predicates object to search for the field values that are not equal to the specified value.
This method is equivalent to "!=" in SQL statements.

Since: 10

Parameters

NameDescription
OH_Predicates *predicatesPointer to the OH_Predicates instance.
const char *fieldColumn name in the database table.
OH_VObject *valueObjectPointer to an OH_VObject instance, indicating the value to be matched with the predicate.

Returns

TypeDescription
OH_Predicates *Predicates that match the specified field.

beginWrap()

OH_Predicates *(*beginWrap)(OH_Predicates *predicates)

Description

Pointer to the function used to add a left parenthesis to the predicates.
This method is equivalent to "(" in SQL statements.

Since: 10

Parameters

NameDescription
OH_Predicates *predicatesPointer to the OH_Predicates instance.

Returns

TypeDescription
OH_Predicates *Predicates with a left parenthesis.

endWrap()

OH_Predicates *(*endWrap)(OH_Predicates *predicates)

Description

Pointer to the function used to add a right parenthesis to the predicates.
This method is equivalent to ")" in SQL statements.

Since: 10

Parameters

NameDescription
OH_Predicates *predicatesPointer to the OH_Predicates instance.

Returns

TypeDescription
OH_Predicates *Predicates with a right parenthesis.

orOperate()

OH_Predicates *(*orOperate)(OH_Predicates *predicates)

Description

Pointer to the function used to add the OR operator to the predicates.
This method is equivalent to OR in SQL statements.

Since: 10

Parameters

NameDescription
OH_Predicates *predicatesPointer to the OH_Predicates instance.

Returns

TypeDescription
OH_Predicates *Predicates with the OR condition.

andOperate()

OH_Predicates *(*andOperate)(OH_Predicates *predicates)

Description

Pointer to the function used to add the AND operator to the predicates.
This method is equivalent to AND in SQL statements.

Since: 10

Parameters

NameDescription
OH_Predicates *predicatesPointer to the OH_Predicates instance.

Returns

TypeDescription
OH_Predicates *Predicates with the AND condition.

isNull()

OH_Predicates *(*isNull)(OH_Predicates *predicates, const char *field)

Description

Pointer to the function used to create a predicates object to search for the field values that are null.
This method is equivalent to IS NULL in SQL statements.

Since: 10

Parameters

NameDescription
OH_Predicates *predicatesPointer to the OH_Predicates instance.
const char *fieldColumn name in the database table.

Returns

TypeDescription
OH_Predicates *Predicates that match the specified field.

isNotNull()

OH_Predicates *(*isNotNull)(OH_Predicates *predicates, const char *field)

Description

Pointer to the function used to create a predicates object to search for the field values that are not null.
This method is equivalent to IS NOT NULL in SQL statements.

Since: 10

Parameters

NameDescription
OH_Predicates *predicatesPointer to the OH_Predicates instance.
const char *fieldColumn name in the database table.

Returns

TypeDescription
OH_Predicates *Predicates that match the specified field.

like()

OH_Predicates *(*like)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject)

Description

Pointer to the function used to create a predicates object to search for the field values that are similar to the specified string.
This method is equivalent to LIKE in SQL statements.

Since: 10

Parameters

NameDescription
OH_Predicates *predicatesPointer to the OH_Predicates instance.
const char *fieldColumn name in the database table.
OH_VObject *valueObjectPointer to an OH_VObject instance, indicating the value to be matched with the predicate.

Returns

TypeDescription
OH_Predicates *Predicates that match the specified field.

between()

OH_Predicates *(*between)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject)

Description

Pointer to the function used to create a predicates object to search for the field values that are within the specified range.
This method is equivalent to BETWEEN in SQL statements.

Since: 10

Parameters

NameDescription
OH_Predicates *predicatesPointer to the OH_Predicates instance.
const char *fieldColumn name in the database table.
OH_VObject *valueObjectPointer to an OH_VObject instance, indicating the value to be matched with the predicate.

Returns

TypeDescription
OH_Predicates *Predicates that match the specified field.

notBetween()

OH_Predicates *(*notBetween)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject)

Description

Pointer to the function used to create a predicates object to search for the field values that are out of the specified range.
This method is equivalent to NOT BETWEEN in SQL statements.

Since: 10

Parameters

NameDescription
OH_Predicates *predicatesPointer to the OH_Predicates instance.
const char *fieldColumn name in the database table.
OH_VObject *valueObjectPointer to an OH_VObject instance, indicating the value to be matched with the predicate.

Returns

TypeDescription
OH_Predicates *Predicates that match the specified field.

greaterThan()

OH_Predicates *(*greaterThan)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject)

Description

Pointer to the function used to create a predicates object to search for the field values that are greater than the specified value.
This method is equivalent to ">" in SQL statements.

Since: 10

Parameters

NameDescription
OH_Predicates *predicatesPointer to the OH_Predicates instance.
const char *fieldColumn name in the database table.
OH_VObject *valueObjectPointer to an OH_VObject instance, indicating the value to be matched with the predicate.

Returns

TypeDescription
OH_Predicates *Predicates that match the specified field.

lessThan()

OH_Predicates *(*lessThan)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject)

Description

Pointer to the function used to create a predicates object to search for the records that are less than the given value in the specified field.
This method is equivalent to "<" in SQL statements.

Since: 10

Parameters

NameDescription
OH_Predicates *predicatesPointer to the OH_Predicates instance.
const char *fieldColumn name in the database table.
OH_VObject *valueObjectPointer to an OH_VObject instance, indicating the value to be matched with the predicate.

Returns

TypeDescription
OH_Predicates *Predicates that match the specified field.

greaterThanOrEqualTo()

OH_Predicates *(*greaterThanOrEqualTo)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject)

Description

Pointer to the function used to create a predicates object to search for the field values that are greater than or equal to the specified value.
This method is equivalent to ">=" in SQL statements.

Since: 10

Parameters

NameDescription
OH_Predicates *predicatesPointer to the OH_Predicates instance.
const char *fieldColumn name in the database table.
OH_VObject *valueObjectPointer to an OH_VObject instance, indicating the value to be matched with the predicate.

Returns

TypeDescription
OH_Predicates *Predicates that match the specified field.

lessThanOrEqualTo()

OH_Predicates *(*lessThanOrEqualTo)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject)

Description

Pointer to the function used to create a predicates object to search for the records that are less than or equal to the specified valueObject in the specified field.
This method is equivalent to "<=" in SQL statements.

Since: 10

Parameters

NameDescription
OH_Predicates *predicatesPointer to the OH_Predicates instance.
const char *fieldColumn name in the database table.
OH_VObject *valueObjectPointer to an OH_VObject instance, indicating the value to be matched with the predicate.

Returns

TypeDescription
OH_Predicates *Predicates that match the specified field.

orderBy()

OH_Predicates *(*orderBy)(OH_Predicates *predicates, const char *field, OH_OrderType type)

Description

Pointer to the function used to create a predicates object to sort the values in the specified column in ascending or descending order.
This method is equivalent to ORDER BY in SQL statements.

Since: 10

Parameters

NameDescription
OH_Predicates *predicatesPointer to the OH_Predicates instance.
const char *fieldColumn name in the database table.
OH_VObject typeSorting type, which is an OH_VObject.

Returns

TypeDescription
OH_Predicates *Predicates that match the specified field.

distinct()

OH_Predicates *(*distinct)(OH_Predicates *predicates)

Description

Pointer to the function used to create a predicates object to filter out duplicate records.
This method is equivalent to DISTINCT in SQL statements.

Since: 10

Parameters

NameDescription
OH_Predicates *predicatesPointer to the OH_Predicates instance.

Returns

TypeDescription
OH_Predicates *Predicates that can filter out duplicate records.

limit()

OH_Predicates *(*limit)(OH_Predicates *predicates, unsigned int value)

Description

Pointer to the function used to create a predicates object to specify the maximum number of records.
This method is equivalent to LIMIT in SQL statements.

Since: 10

Parameters

NameDescription
OH_Predicates *predicatesPointer to the OH_Predicates instance.
unsigned int valueMaximum number of data records.

Returns

TypeDescription
OH_Predicates *Predicates that specify the maximum number of records.

offset()

OH_Predicates *(*offset)(OH_Predicates *predicates, unsigned int rowOffset)

Description

Pointer to the function used to create a predicates object to specify the start position of the query result.
This method is equivalent to OFFSET in SQL statements.

Since: 10

Parameters

NameDescription
OH_Predicates *predicatesPointer to the OH_Predicates instance.
unsigned int rowOffsetStart position, which is a positive integer.

Returns

TypeDescription
OH_Predicates *Predicates that specify the start position of the returned result.

groupBy()

OH_Predicates *(*groupBy)(OH_Predicates *predicates, char const *const *fields, int length)

Description

Pointer to the function used to create a predicates object to group the results by the specified columns.
This method is equivalent to GROUP BY in SQL statements.

Since: 10

Parameters

NameDescription
OH_Predicates *predicatesPointer to the OH_Predicates instance.
char const *const *fieldsNames of columns to group.
int lengthLength of fields.

Returns

TypeDescription
OH_Predicates *Predicates that group rows with the same value.

in()

OH_Predicates *(*in)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject)

Description

Pointer to the function used to create a predicates object to search for the field values that are within the specified range.
This method is equivalent to IN in SQL statements.

Since: 10

Parameters

NameDescription
OH_Predicates *predicatesPointer to the OH_Predicates instance.
const char *fieldPointer to the column name in the database table.
OH_VObject *valueObjectPointer to an OH_VObject instance, indicating the value to be matched with the predicate.

Returns

TypeDescription
OH_Predicates *Predicates that match the specified field.

notIn()

OH_Predicates *(*notIn)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject)

Description

Pointer to the function used to create a predicates object to search for the field values that are out of the specified range.
This method is equivalent to NOT IN in SQL statements.

Since: 10

Parameters

NameDescription
OH_Predicates *predicatesPointer to the OH_Predicates instance.
const char *fieldPointer to the column name in the database table.
OH_VObject *valueObjectPointer to an OH_VObject instance, indicating the value to be matched with the predicate.

Returns

TypeDescription
OH_Predicates *Predicates that match the specified field.

clear()

OH_Predicates *(*clear)(OH_Predicates *predicates)

Description

Pointer to the function used to clear a predicates instance.

Since: 10

Parameters

NameDescription
OH_Predicates *predicatesPointer to the OH_Predicates instance.

Returns

TypeDescription
OH_Predicates *Cleared predicates.

destroy()

int (*destroy)(OH_Predicates *predicates)

Description

Pointer to the function used to destroy an OH_Predicates object and reclaim the memory occupied.

Since: 10

Parameters

NameDescription
OH_Predicates *predicatesPointer to the OH_Predicates instance.

Returns

TypeDescription
intReturns RDB_OK if the operation is successful; returns an error code otherwise.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 js-apis-distributedKVStore-sys

openharmony 鸿蒙 capi-oh-preferences-h

openharmony 鸿蒙 capi-udmf-oh-udshyperlink

openharmony 鸿蒙 js-apis-data-dataSharePredicates

openharmony 鸿蒙 capi-udmf-oh-udsappitem

openharmony 鸿蒙 capi-rdb-oh-data-vbuckets

openharmony 鸿蒙 capi-rdb-oh-data-value

openharmony 鸿蒙 capi-preferences-oh-preferencespair

openharmony 鸿蒙 errorcode-datashare

openharmony 鸿蒙 arkts-apis-data-relationalStore-Transaction

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/sWKJmtro