Forum > Databases
[SOLVED] What does TSQLConnection send to the database?
(1/1)
Slawek:
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:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---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:
--- Quote from: Slawek on June 06, 2023, 07:31:39 pm ---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.
--- End quote ---
The connection has a LogEvents property and an OnLog event handler. Check the FPC demo programs in: packages/fcl-db/examples/logsqldemo.pas
Slawek:
This is what I need. Many thanks paweld and dsiders! :)
Navigation
[0] Message Index