diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-01-25 23:40:09 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-01-25 23:41:12 +0000 |
commit | 5e71132df0a1dced91b1bd169a2398e982db2c02 (patch) | |
tree | f66416f0763af62a84c5537f77f4982e55438922 /src/lua/lua_sqlite3.c | |
parent | 5bdacfb3d1d3a62dc39c936e656f523dee654158 (diff) | |
download | rspamd-5e71132df0a1dced91b1bd169a2398e982db2c02.tar.gz rspamd-5e71132df0a1dced91b1bd169a2398e982db2c02.zip |
Store int64 as strings
There are no 64 bits integers in lua, so store them as strings
Diffstat (limited to 'src/lua/lua_sqlite3.c')
-rw-r--r-- | src/lua/lua_sqlite3.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/lua/lua_sqlite3.c b/src/lua/lua_sqlite3.c index 4442cacab..594fd6117 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)); |