How to get last executed sql query?

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
eimix
Posts: 5
Joined: Fri 12 Sep 2008 12:52

How to get last executed sql query?

Post by eimix » Fri 12 Sep 2008 12:55

Hi

I use EurekaLog, and i want it to add sql query into error report.

Is it possible to get what sql query was send to server from TMyConnection or anythere else?

Thanks,
Eimis

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Mon 15 Sep 2008 09:14

MyDAC doesn't allow getting SQL queries that were sent to server from TMyConnection.
However, you can use the TMySQLMonitor component to monitor dynamic SQL execution in MyDAC based applications. Also you can use the DBMonitor tool.
You can find more detailed information about it in the MyDAC help.

eimix
Posts: 5
Joined: Fri 12 Sep 2008 12:52

Post by eimix » Mon 15 Sep 2008 12:14

DB Monitor is not a solution - EurekaLog cannot take anything from it, and DB monitor is not running on client's PC's.

So i made some workaround - TMySQLMonitor has OnSQL event - i write every SQL into temp var (always overwriting last value).
And if exception is caught by EurekaLog, i use that temp var as last known send SQL to server.

It looks a little bit slow for me,
i did not measured changes in performance, but it this is not a straight forward way i think,

but if there is not anything faster, it suites for me :)

Post Reply