Skip to content

Commit ed01269

Browse files
authored
Add mgp_result_reserve to C-API (#1236)
* docs * docs
1 parent 6880f8c commit ed01269

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pages/custom-query-modules/c/c-api.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ Memgraph in order to use them.
143143
| enum [mgp_error](#variable-mgp-error) | **[mgp_path_equal](#function-mgp-path-equal)**(struct mgp_path * p1, struct mgp_path * p2, int * result)<br />Result is non-zero if given paths are equal, otherwise 0. |
144144
| enum [mgp_error](#variable-mgp-error) | **[mgp_result_set_error_msg](#function-mgp-result-set-error-msg)**(struct mgp_result * res, const char * error_msg)<br />Set the error as the result of the procedure. |
145145
| enum [mgp_error](#variable-mgp-error) | **[mgp_result_new_record](#function-mgp-result-new-record)**(struct mgp_result * res, struct mgp_result_record ** result)<br />Create a new record for results. |
146+
| enum [mgp_error](#variable-mgp-error) | **[mgp_result_reserve](#function-mgp-result-reserve)**(struct mgp_result * res, size_t n)<br />Reserves memory for `n` result records. |
146147
| enum [mgp_error](#variable-mgp-error) | **[mgp_result_record_insert](#function-mgp-result-record-insert)**(struct mgp_result_record * record, const char * field_name, struct mgp_value * val)<br />Assign a value to a field in the given record. |
147148
| void | **[mgp_properties_iterator_destroy](#function-mgp-properties-iterator-destroy)**(struct mgp_properties_iterator * it)<br />Free the memory used by a mgp_properties_iterator. |
148149
| enum [mgp_error](#variable-mgp-error) | **[mgp_properties_iterator_get](#function-mgp-properties-iterator-get)**(struct mgp_properties_iterator * it, struct [mgp_property](#mgp_property) ** result)<br />Get the current property pointed to by the iterator. |
@@ -1659,6 +1660,17 @@ Create a new record for results.
16591660

16601661
The previously obtained mgp_result_record pointer is no longer valid, and you must not use it. Return MGP_ERROR_UNABLE_TO_ALLOCATE if unable to allocate a mgp_result_record.
16611662

1663+
### mgp_result_reserve [#function-mgp-result-reserve]
1664+
```cpp
1665+
enum mgp_error mgp_result_reserve(
1666+
struct mgp_result * res,
1667+
size_t n
1668+
)
1669+
```
1670+
1671+
Reserves memory for `n` result records.
1672+
1673+
Returns MGP_ERROR_UNABLE_TO_ALLOCATE if there's no memory for allocating the records.
16621674

16631675
### mgp_result_record_insert [#function-mgp-result-record-insert]
16641676
```cpp
@@ -4040,6 +4052,8 @@ enum mgp_error mgp_result_set_error_msg(struct mgp_result *res, const char *erro
40404052

40414053
enum mgp_error mgp_result_new_record(struct mgp_result *res, struct mgp_result_record **result);
40424054

4055+
enum mgp_error mgp_result_reserve(struct mgp_result *res, size_t n);
4056+
40434057
enum mgp_error mgp_result_record_insert(struct mgp_result_record *record, const char *field_name,
40444058
struct mgp_value *val);
40454059

0 commit comments

Comments
 (0)