fusqueta's post in How to execute a simple query in source was marked as the answer
I created a function on log.cpp that already have all mysql pre-configs needed
void log_death(int charid, int16 m, int16 killertype, int killerid, int lasthit)
{
StringBuf_Init(&buf);
StringBuf_Printf(&buf, "%s INTO `%s` ( `map`, `time`)", LOG_QUERY, "death_log");
StringBuf_Printf(&buf, "values ('%s',NOW() )", map_getmapdata(m)->name[0] ? map_getmapdata(m)->name : "");
if (SQL_SUCCESS != SqlStmt_PrepareStr(stmt, StringBuf_Value(&buf)) || SQL_SUCCESS != SqlStmt_Execute(stmt))
SqlStmt_ShowDebug(stmt);
}