Page 1 of 1
Is it possible to trap the SQL text after parameter substitution?
Posted: Fri 03 Aug 2007 09:25
by NoComprende
While debugging in BCB, is there any way of finding the actual TMyQuery SQL->Text after the parameter substitution takes place? I'm trying to find why certain queries aren't returning results by running them directly in MySQL and it would save having to substitute the param values in the SQL->Text every time. I thought that was what FinalSQL was for but see now that isn't the case.
Posted: Fri 03 Aug 2007 10:49
by Antaeus
Put the TMySQLMonitor component at the form, turn all TraceFlags to False except the tfMisc flag, and add a handler to the TMySQLMonitor.OnSQL event.
Another way is to setup MySQL logs. For more information see the description of the log parameter in the MySQL Reference Manual.
Posted: Fri 03 Aug 2007 12:29
by NoComprende
Many thanks Antaeus, that worked fine. I had been trying for the past 4 hours to find out what I was doing wrong. It turned out I had been supplying the required single quote on either side of a string whereas TMyQuery does this automatically.