• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# oh_predicates.h
2
3## Overview
4
5Defines the predicates for an RDB store.
6
7**File to include**: <database/rdb/oh_predicates.h>
8
9**Library**: libnative_rdb_ndk.z.so
10
11**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
12
13**Since**: 10
14
15**Related module**: [RDB](capi-rdb.md)
16
17## Summary
18
19### Structs
20
21| Name                                  | typedef Keyword| Description      |
22| -------------------------------------- | ------------- | ---------- |
23| [OH_Predicates](capi-rdb-oh-predicates.md) | OH_Predicates | Defines a **predicates** object.|
24
25### Enums
26
27| Name                         | typedef Keyword| Description      |
28| ----------------------------- | ------------- | ---------- |
29| [OH_OrderType](#oh_ordertype) | OH_OrderType  | Enumerates the sorting types.|
30
31### Functions
32
33| Name                                                        | Description                                                        |
34| ------------------------------------------------------------ | ------------------------------------------------------------ |
35| [int OH_Predicates_NotLike(OH_Predicates *predicates, const char *field, const char *pattern)](#oh_predicates_notlike) | Sets an **OH_Predicates** object to match a string that is not similar to the specified value.<br>This API is similar to the SQL **Not like** statement.|
36| [int OH_Predicates_Glob(OH_Predicates *predicates, const char *field, const char *pattern)](#oh_predicates_glob) | Sets an **OH_Predicates** object to match a string containing a wildcard.<br>Different from **like**, the input parameters of this API are case-sensitive.|
37| [int OH_Predicates_NotGlob(OH_Predicates *predicates, const char *field, const char *pattern)](#oh_predicates_notglob) | Sets an **OH_Predicates** object to not match a string containing a wildcard.<br>Different from **Not Like**, the input parameters of this API are case-sensitive.|
38| [int OH_Predicates_Having(OH_Predicates *predicates, const char *conditions, const OH_Data_Values *values)](#oh_predicates_having) | Sets an **OH_Predicates** object to filter grouped results by specified conditions.|
39
40## Enum Description
41
42### OH_OrderType
43
44```
45enum OH_OrderType
46```
47
48**Description**
49
50Enumerates the sorting types.
51
52**Since**: 10
53
54| Enum Item  | Description      |
55| -------- | ---------- |
56| ASC = 0  | Ascending order.|
57| DESC = 1 | Descending order.|
58
59
60## Function Description
61
62### OH_Predicates_NotLike()
63
64```
65int OH_Predicates_NotLike(OH_Predicates *predicates, const char *field, const char *pattern)
66```
67
68**Description**
69
70Sets an **OH_Predicates** object to match a string that is not similar to the specified value.<br>This API is similar to the SQL **Not like** statement.
71
72**Since**: 20
73
74
75**Parameters**
76
77| Name                                            | Description                                                      |
78| -------------------------------------------------- | ---------------------------------------------------------- |
79| [OH_Predicates](capi-rdb-oh-predicates.md) *predicates | Pointer to the [OH_Predicates](capi-rdb-oh-predicates.md) instance.|
80| const char *field                                  | Pointer to the column name in the database table.                                    |
81| const char *pattern                                | Pointer to the pattern used.                                    |
82
83**Returns**
84
85| Type| Description                                                        |
86| ---- | ------------------------------------------------------------ |
87| int  | Returns an execution result.<br>**RDB_OK** indicates that the execution is successful.<br>**RDB_E_INVALID_ARGS** indicates that invalid parameters are specified.|
88
89### OH_Predicates_Glob()
90
91```
92int OH_Predicates_Glob(OH_Predicates *predicates, const char *field, const char *pattern)
93```
94
95**Description**
96
97Sets an **OH_Predicates** object to match a string containing a wildcard.<br>Different from **like**, the input parameters of this API are case-sensitive.
98
99**Since**: 20
100
101
102**Parameters**
103
104| Name                                            | Description                                                      |
105| -------------------------------------------------- | ---------------------------------------------------------- |
106| [OH_Predicates](capi-rdb-oh-predicates.md) *predicates | Pointer to the [OH_Predicates](capi-rdb-oh-predicates.md) instance.|
107| const char *field                                  | Pointer to the column name in the database table.                                    |
108| const char *pattern                                | Pointer to the pattern used.                                      |
109
110**Returns**
111
112| Type| Description                                                        |
113| ---- | ------------------------------------------------------------ |
114| int  | Returns an execution result.<br>**RDB_OK** indicates that the execution is successful.<br>**RDB_E_INVALID_ARGS** indicates that invalid parameters are specified.|
115
116### OH_Predicates_NotGlob()
117
118```
119int OH_Predicates_NotGlob(OH_Predicates *predicates, const char *field, const char *pattern)
120```
121
122**Description**
123
124Sets an **OH_Predicates** object to not match a string containing a wildcard.<br>Different from **Not Like**, the input parameters of this API are case-sensitive.
125
126**Since**: 20
127
128
129**Parameters**
130
131| Name                                            | Description                                                      |
132| -------------------------------------------------- | ---------------------------------------------------------- |
133| [OH_Predicates](capi-rdb-oh-predicates.md) *predicates | Pointer to the [OH_Predicates](capi-rdb-oh-predicates.md) instance.|
134| const char *field                                  | Pointer to the column name in the database table.                                    |
135| const char *pattern                                | Pointer to the pattern used.                                    |
136
137**Returns**
138
139| Type| Description                                                        |
140| ---- | ------------------------------------------------------------ |
141| int  | Returns an execution result.<br>**RDB_OK** indicates that the execution is successful.<br>**RDB_E_INVALID_ARGS** indicates that invalid parameters are specified.|
142
143### OH_Predicates_Having()
144
145```
146int OH_Predicates_Having(OH_Predicates *predicates, const char *conditions, const OH_Data_Values *values)
147```
148
149**Description**
150
151Sets an **OH_Predicates** object to filter grouped results by specified conditions.
152
153**Since**: 20
154
155
156**Parameters**
157
158| Name                                                | Description                                                        |
159| ------------------------------------------------------ | ------------------------------------------------------------ |
160| [OH_Predicates](capi-rdb-oh-predicates.md) *predicates     | Pointer to the [OH_Predicates](capi-rdb-oh-predicates.md) instance.  |
161| const char *conditions                                 | Pointer to the filter condition specified in the HAVING clause.                                |
162| const [OH_Data_Values](capi-rdb-oh-data-values.md) *values | Pointer to the [OH_Data_Values](capi-rdb-oh-data-values.md) instance.|
163
164**Returns**
165
166| Type| Description                                                        |
167| ---- | ------------------------------------------------------------ |
168| int  | Returns an execution result.<br>**RDB_OK** indicates that the execution is successful.<br>**RDB_E_INVALID_ARGS** indicates that invalid parameters are specified.|
169