[Tarantool-patches] [PATCH v4 48/53] sql: introduce mem_get_unsigned()
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Tue Mar 30 02:08:46 MSK 2021
Thanks for the patch!
On 23.03.2021 10:36, Mergen Imeev via Tarantool-patches wrote:
> This patch introduces mem_get_unsigned() function which is used to
> receive unsigned value from MEM.
>
> Part of #5818
> ---
> src/box/sql/func.c | 16 +++++++++++-----
> src/box/sql/mem.c | 37 +++++++++++++++++++++++++++----------
> src/box/sql/mem.h | 6 +++---
> src/box/sql/sqlInt.h | 3 ---
> src/box/sql/vdbeapi.c | 6 ------
> 5 files changed, 41 insertions(+), 27 deletions(-)
>
> diff --git a/src/box/sql/func.c b/src/box/sql/func.c
> index 0fa0f6ac7..a851d98f2 100644
> --- a/src/box/sql/func.c
> +++ b/src/box/sql/func.c
> @@ -118,9 +118,12 @@ port_vdbemem_dump_lua(struct port *base, struct lua_State *L, bool is_flat)
> luaL_pushint64(L, n);
> break;
> }
> - case MP_UINT:
> - luaL_pushuint64(L, sql_value_uint64(param));
> + case MP_UINT: {
> + uint64_t u;
> + mem_get_unsigned(param, &u);
> + luaL_pushuint64(L, u);
Maybe we could make 2 functions? One to get the value and ignore
the errors, and the other to get as an out parameter + return an
error?
For instance, mem_to_uint() - returns uint64_t and internally asserts
that the value is correct. And mem_get_uint() works like your version.
The same for the other get functions whose result is often ignored.
More information about the Tarantool-patches
mailing list