[tarantool-patches] [PATCH 02/13] sql: make VDBE recognize big integers
Konstantin Osipov
kostja at tarantool.org
Tue Apr 2 10:38:32 MSK 2019
* Stanislav Zudin <szudin at tarantool.org> [19/03/15 22:09]:
> diff --git a/src/box/lua/sql.c b/src/box/lua/sql.c
> index ee20faab7..cb2927144 100644
> --- a/src/box/lua/sql.c
> +++ b/src/box/lua/sql.c
> @@ -32,7 +32,10 @@ lua_push_row(struct lua_State *L, struct sql_stmt *stmt)
> int type = sql_column_type(stmt, i);
> switch (type) {
> case SQL_INTEGER:
> - luaL_pushint64(L, sql_column_int64(stmt, i));
> + if (sql_column_is_unsigned(stmt, i))
> + luaL_pushuint64(L, sql_column_int64(stmt, i));
> + else
> + luaL_pushint64(L, sql_column_int64(stmt, i));
> break;
> case SQL_FLOAT:
> lua_pushnumber(L, sql_column_double(stmt, i));
I'd kindly ask to rewrite this function altogether in a separate
patch.
When pushing data into Lua, we should look at value type,
not column type. AFAICS sql_column_type() is a recent addition.
The name itself -sql_column_is_unsigned() implies we're checking
the property of entire column, not a single value.
Re SQL value types, I would kill sqlite's enum for value types as
well as mem flags and use mp_type wherever possible instead.
--
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.io - www.twitter.com/kostja_osipov
More information about the Tarantool-patches
mailing list