目录

OH_Predicates

typedef struct {...} OH_Predicates

Overview

Defines a predicates object.

Since: 10

Related module: RDB

Header file: oh_predicates.h

[h2]Member Variables

Name Description
int64_t id Unique identifier of the OH_Predicates struct.

[h2]Member Functions

Name Description
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 set.

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 set.

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

[h2]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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.
const char *field Column name in the database table. It must not be a null pointer.
OH_VObject *valueObject Pointer to the OH_VObject instance, indicating the value to match the predicate.

Returns

Type Description
OH_Predicates * Predicates that match the specified field.

[h2]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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.
const char *field Column name in the database table. It must not be a null pointer.
OH_VObject *valueObject Pointer to an OH_VObject instance, indicating the value to be matched with the predicate.

Returns

Type Description
OH_Predicates * Predicates that match the specified field.

[h2]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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.

Returns

Type Description
OH_Predicates * Predicates with a left parenthesis.

[h2]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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.

Returns

Type Description
OH_Predicates * Predicates with a right parenthesis.

[h2]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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.

Returns

Type Description
OH_Predicates * Predicates with the OR condition.

[h2]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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.

Returns

Type Description
OH_Predicates * Predicates with the AND condition.

[h2]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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.
const char *field Column name in the database table. It must not be a null pointer.

Returns

Type Description
OH_Predicates * Predicates that match the specified field.

[h2]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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.
const char *field Column name in the database table. It must not be a null pointer.

Returns

Type Description
OH_Predicates * Predicates that match the specified field.

[h2]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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.
const char *field Column name in the database table. It must not be a null pointer.
OH_VObject *valueObject Pointer to an OH_VObject instance, indicating the value to be matched with the predicate.

Returns

Type Description
OH_Predicates * Predicates that match the specified field.

[h2]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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.
const char *field Column name in the database table. It must not be a null pointer.
OH_VObject *valueObject Pointer to an OH_VObject instance, indicating the value to be matched with the predicate.

Returns

Type Description
OH_Predicates * Predicates that match the specified field.

[h2]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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.
const char *field Column name in the database table. It must not be a null pointer.
OH_VObject *valueObject Pointer to an OH_VObject instance, indicating the value to be matched with the predicate.

Returns

Type Description
OH_Predicates * Predicates that match the specified field.

[h2]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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.
const char *field Column name in the database table. It must not be a null pointer.
OH_VObject *valueObject Pointer to an OH_VObject instance, indicating the value to be matched with the predicate.

Returns

Type Description
OH_Predicates * Predicates that match the specified field.

[h2]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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.
const char *field Column name in the database table. It must not be a null pointer.
OH_VObject *valueObject Pointer to an OH_VObject instance, indicating the value to be matched with the predicate.

Returns

Type Description
OH_Predicates * Predicates that match the specified field.

[h2]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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.
const char *field Column name in the database table. It must not be a null pointer.
OH_VObject *valueObject Pointer to an OH_VObject instance, indicating the value to be matched with the predicate.

Returns

Type Description
OH_Predicates * Predicates that match the specified field.

[h2]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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.
const char *field Column name in the database table. It must not be a null pointer.
OH_VObject *valueObject Pointer to the OH_VObject instance, indicating the value to match the predicate.

Returns

Type Description
OH_Predicates * Predicates that match the specified field.

[h2]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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.
const char *field Column name in the database table. It must not be a null pointer.
OH_OrderType type Order type.

Returns

Type Description
OH_Predicates * Predicates that match the specified field.

[h2]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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.

Returns

Type Description
OH_Predicates * Predicates that can filter out duplicate records.

[h2]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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.
unsigned int value Maximum number of data records.

Returns

Type Description
OH_Predicates * Predicates that specify the maximum number of records.

[h2]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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.
unsigned int rowOffset Start position, which is a positive integer.

Returns

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

[h2]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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.
char const *const *fields Column name that grouping depends on. It must not be a null pointer.
int length Length of the fields array. This parameter is an input parameter.

Returns

Type Description
OH_Predicates * Predicates that group rows with the same value.

[h2]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 set.

This method is equivalent to IN in SQL statements.

Since: 10

Parameters

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.
const char *field Column name in the database table. It must not be a null pointer.
OH_VObject *valueObject Pointer to an OH_VObject instance, indicating the value to be matched with the predicate.

Returns

Type Description
OH_Predicates * Predicates that match the specified field.

[h2]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 set.

This method is equivalent to NOT IN in SQL statements.

Since: 10

Parameters

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.
const char *field Column name in the database table. It must not be a null pointer.
OH_VObject *valueObject Pointer to an OH_VObject instance, indicating the value to be matched with the predicate.

Returns

Type Description
OH_Predicates * Predicates that match the specified field.

[h2]clear()

OH_Predicates *(*clear)(OH_Predicates *predicates)

Description

Pointer to the function used to clear a predicates instance.

Since: 10

Parameters

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.

Returns

Type Description
OH_Predicates * Cleared predicates.

[h2]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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.

Returns

Type Description
int Returns RDB_OK if the operation is successful; returns an error code otherwise. For details, see OH_Rdb_ErrCode.