OH_Predicates

typedef struct {...} OH_Predicates

Overview

Defines a predicates object.

Since: 10

Related module: RDB

Header file: oh_predicates.h

Member Variables

Name Description
int64_t id Unique identifier of the OH_Predicates struct.

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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.
const char *field Pointer to the column name in the database table.
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.

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

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.

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.

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.

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.

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.

Returns

Type Description
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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.
const char *field Column name in the database table.

Returns

Type Description
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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.
const char *field Column name in the database table.
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.

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

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

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

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

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

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

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.
OH_VObject type Sorting type, which is an OH_VObject.

Returns

Type Description
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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.

Returns

Type Description
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

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.

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.

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 Names of columns to group.
int length Length of fields.

Returns

Type Description
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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.
const char *field Pointer to the column name in the database table.
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.

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

Name Description
OH_Predicates *predicates Pointer to the OH_Predicates instance.
const char *field Pointer to the column name in the database table.
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.

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.

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.