Page 1 of 1

How to get the last Sql statement?

Posted: Sun 10 Oct 2021 12:48
by starhu
Hello,

For bug reporting purposes, when an error occurs (using MadExcept) I want to log the last Sql event.
How can I do this? I haven't found anything under TMyConnection or TMySqlMonitor.

Thank you!

Re: How to get the last Sql statement?

Posted: Fri 22 Oct 2021 16:02
by ViktorV
Hi there!

Thank you for contacting Devart and for your question!

Please note that MyDAC does not contain a similar property or method.

But you can try to implement this functionality yourself using the following tips:

- You can organize independent logging of all requests you perform in any way convenient for you.

- Or take advantage of MySQL's ability to log:

1. Execute SET GLOBAL log_output = 'TABLE';
2. Execute SET GLOBAL general_log = 'ON';
3. Take a look at the table mysql.general_log. Например:

Code: Select all

SELECT * FROM mysql.general_log WHERE command_type ='Query' ORDER BY event_time DESC 
Note, estarting the server leaves you where you started (log is by default still off).
For more information, see http://dev.mysql.com/doc/refman/5.1/en/ ... eneral_log

Please, let us know if you have any questions!