Adds SQL queries log performed from Lua

This commit is contained in:
Simone Mainardi 2018-08-13 19:27:00 +02:00
parent cacbdaa9e7
commit cd6c7c4338
6 changed files with 36 additions and 2 deletions

View file

@ -808,6 +808,12 @@ int MySQLDB::exec_sql_query(lua_State *vm, char *sql, bool limitRows, bool wait_
if(m) m->lock(__FILE__, __LINE__);
if(ntop->getPrefs()->is_sql_log_enabled() && log_fd && sql) {
fprintf(log_fd, "%s\n", sql);
fflush(log_fd);
}
if((rc = mysql_query(&mysql, sql)) != 0) {
/* retry */
disconnectFromDB(&mysql);