From: Vsevolod Stakhov Date: Mon, 25 Jan 2016 23:40:09 +0000 (+0000) Subject: Store int64 as strings X-Git-Tag: 1.1.2~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e71132df0a1dced91b1bd169a2398e982db2c02;p=thirdparty%2Frspamd.git Store int64 as strings There are no 64 bits integers in lua, so store them as strings --- diff --git a/src/lua/lua_sqlite3.c b/src/lua/lua_sqlite3.c index 4442cacabe..594fd61172 100644 --- a/src/lua/lua_sqlite3.c +++ b/src/lua/lua_sqlite3.c @@ -218,9 +218,11 @@ lua_sqlite3_sql (lua_State *L) static void lua_sqlite3_push_row (lua_State *L, sqlite3_stmt *stmt) { - gint nresults, i, type; const gchar *str; gsize slen; + gint64 num; + gchar numbuf[32]; + gint nresults, i, type; nresults = sqlite3_column_count (stmt); lua_createtable (L, 0, nresults); @@ -231,7 +233,12 @@ lua_sqlite3_push_row (lua_State *L, sqlite3_stmt *stmt) switch (type) { case SQLITE_INTEGER: - lua_pushnumber (L, sqlite3_column_int64 (stmt, i)); + /* XXX: we represent int64 as strings, as we can nothing else to do + * about it portably + */ + num = sqlite3_column_int64 (stmt, i); + rspamd_snprintf (numbuf, sizeof (numbuf), "%L", num); + lua_pushstring (L, numbuf); break; case SQLITE_FLOAT: lua_pushnumber (L, sqlite3_column_double (stmt, i));