SQL query: created simple sql log, add and replaced statement on prepared statements