From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 2 Apr 2019 10:38:32 +0300 From: Konstantin Osipov Subject: Re: [tarantool-patches] [PATCH 02/13] sql: make VDBE recognize big integers Message-ID: <20190402073832.GC25072@chai> References: <250778a6f016d3be9eb288255cea0e4a7c7b22c5.1552663061.git.szudin@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <250778a6f016d3be9eb288255cea0e4a7c7b22c5.1552663061.git.szudin@tarantool.org> To: tarantool-patches@freelists.org Cc: vdavydov.dev@gmail.com, Stanislav Zudin List-ID: * Stanislav Zudin [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