Module box
-
int
box_return_tuple
(box_function_ctx_t *ctx, box_tuple_t *tuple) Return a tuple from a C stored procedure.
The returned tuple is automatically reference-counted by Tarantool. An example program that uses
box_return_tuple()
is write.c.Parameters: - ctx (box_funtion_ctx_t*) – an opaque structure passed to the C stored procedure by Tarantool
- tuple (box_tuple_t*) – a tuple to return
Returns: -1 on error (perhaps, out of memory; check box_error_last())
Returns: 0 otherwise
-
uint32_t
box_space_id_by_name
(const char *name, uint32_t len) Find space id by name.
This function performs a SELECT request on the
_vspace
system space.Parameters: - char* name (const) – space name
- len (uint32_t) – length of
name
Returns: BOX_ID_NIL
on error or if not found (check box_error_last())Returns: space_id otherwise
See also:
box_index_id_by_name
-
uint32_t
box_index_id_by_name
(uint32_t space_id, const char *name, uint32_t len) Find index id by name.
This function performs a SELECT request on the
_vindex
system space.Parameters: - space_id (uint32_t) – space identifier
- char* name (const) – index name
- len (uint32_t) – length of
name
Returns: BOX_ID_NIL
on error or if not found (check box_error_last())Returns: space_id otherwise
See also:
box_space_id_by_name
-
int
box_insert
(uint32_t space_id, const char *tuple, const char *tuple_end, box_tuple_t **result) Execute an INSERT/REPLACE request.
Parameters: - space_id (uint32_t) – space identifier
- char* tuple (const) – encoded tuple in MsgPack Array format ([ field1, field2, …])
- char* tuple_end (const) – end of a
tuple
- result (box_tuple_t**) – output argument. Resulting tuple. Can be set to NULL to discard result
Returns: -1 on error (check box_error_last())
Returns: 0 otherwise
See also space_object.insert()
-
int
box_replace
(uint32_t space_id, const char *tuple, const char *tuple_end, box_tuple_t **result) Execute a REPLACE request.
Parameters: - space_id (uint32_t) – space identifier
- char* tuple (const) – encoded tuple in MsgPack Array format ([ field1, field2, …])
- char* tuple_end (const) – end of a
tuple
- result (box_tuple_t**) – output argument. Resulting tuple. Can be set to NULL to discard result
Returns: -1 on error (check box_error_last())
Returns: 0 otherwise
See also space_object.replace()
-
int
box_delete
(uint32_t space_id, uint32_t index_id, const char *key, const char *key_end, box_tuple_t **result) Execute a DELETE request.
Parameters: - space_id (uint32_t) – space identifier
- index_id (uint32_t) – index identifier
- char* key (const) – encoded key in MsgPack Array format ([ field1, field2, …])
- char* key_end (const) – end of a
key
- result (box_tuple_t**) – output argument. An old tuple. Can be set to NULL to discard result
Returns: -1 on error (check box_error_last())
Returns: 0 otherwise
See also space_object.delete()
-
int
box_update
(uint32_t space_id, uint32_t index_id, const char *key, const char *key_end, const char *ops, const char *ops_end, int index_base, box_tuple_t **result) Execute an UPDATE request.
Parameters: - space_id (uint32_t) – space identifier
- index_id (uint32_t) – index identifier
- char* key (const) – encoded key in MsgPack Array format ([ field1, field2, …])
- char* key_end (const) – end of a
key
- char* ops (const) – encoded operations in MsgPack Array format, e.g.
[[ '=', field_id, value ], ['!', 2, 'xxx']]
- char* ops_end (const) – end of an
ops
section - index_base (int) – 0 if field_ids are zero-based as in C, 1 if field ids are 1-based as in Lua
- result (box_tuple_t**) – output argument. An old tuple. Can be set to NULL to discard result
Returns: -1 on error (check box_error_last())
Returns: 0 otherwise
See also space_object.update()
-
int
box_upsert
(uint32_t space_id, uint32_t index_id, const char *tuple, const char *tuple_end, const char *ops, const char *ops_end, int index_base, box_tuple_t **result) Execute an UPSERT request.
Parameters: - space_id (uint32_t) – space identifier
- index_id (uint32_t) – index identifier
- char* tuple (const) – encoded tuple in MsgPack Array format ([ field1, field2, …])
- char* tuple_end (const) – end of a
tuple
- char* ops (const) – encoded operations in MsgPack Array format, e.g.
[[ '=', field_id, value ], ['!', 2, 'xxx']]
- char* ops_end (const) – end of a
ops
- index_base (int) – 0 if field_ids are zero-based as in C, 1 if field ids are 1-based as in Lua
- result (box_tuple_t**) – output argument. An old tuple. Can be set to NULL to discard result
Returns: -1 on error (check :box_error_last())
Returns: 0 otherwise
See also space_object.upsert()