[SOLVED] What does TSQLConnection send to the database? lazarus / 16-Databases ---------------------------------------------------------------------- Slawek · 2023-06-06 17:31 Hi, A long time ago I used some simple way to see what the final command sent by TSQLConnection to the database looks like (MySQL/MariaDB). But I can't find it. Does anyone know how to see it? Now I've tried using a sniffer but so far I'm having trouble with it. ---------------------------------------------------------------------- paweld · 2023-06-06 17:53 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses  eventlog; var  EventLog1: TEventLog;  s: String = ' if exists (select 1 from sys.objects where name=''sdfglkoi'') ' + LineEnding + ' drop table sdfglkoi '; procedure TForm1.FormCreate(Sender: TObject);begin  EventLog1 := TEventLog.Create(nil);  EventLog1.LogType := ltFile;  EventLog1.FileName := 'd:\lazsql.log';  EventLog1.Active := True;  conn.LogEvents := [detExecute];  conn.ExecuteDirect(s);end; procedure TForm1.FormDestroy(Sender: TObject);begin  EventLog1.Free;end; procedure TForm1.connLog(Sender: TSQLConnection; EventType: TDBEventType; const Msg: String);begin  if EventType = detExecute then    EventLog1.Debug('Execute: ' + Msg);end; ---------------------------------------------------------------------- dsiders · 2023-06-06 17:54 Quote from: Slawek on June 06, 2023, 07:31:39 pmHi, A long time ago I used some simple way to see what the final command sent by TSQLConnection to the database looks like (MySQL/MariaDB). But I can't find it. Does anyone know how to see it? Now I've tried using a sniffer but so far I'm having trouble with it. The connection has a LogEvents property and an OnLog event handler. Check the FPC demo programs in: packages/fcl- db/examples/logsqldemo.pas ---------------------------------------------------------------------- Slawek · 2023-06-06 21:53 This is what I need. Many thanks paweld and dsiders!