[Lazarus] What is a TSQLTransaction and why do I need one?

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Wed Dec 1 16:44:22 CET 2010


michael.vancanneyt at wisa.be wrote:
> On Wed, 1 Dec 2010, Joost van der Sluis wrote:
> 
>>
>>> Is there somewhere I can hook into the TSQLQuery to (a) see exactly what
>>> query was passed to the server (b) collect any error text and (c) get
>>> execution timing?
>>
>> a) Easiest is to use the database-client's log mechanism. (If there is
>> any). Else you can change the TPQConnection.Preparestatement function.
>> The 'buf' parameter is the actual query. But as you'll see it also adds
>> some more to the query, so it opens a cursor, before it is send to the
>> database-server.
>>
>> b) Ehm.. the error-text is in the exception?
>>
>> c) Hook into TPQConnection.PrepareStatement and TPQCOnnection.Execute
> 
> I am a firm proponent of putting a unified mechanism for a) and c) in 
> TSQLQuery/TSQLConnection, and have, in fact, a patch ready for this
> (it implements a simple event mechanism for the log).
> 
> I'm tired of re-implementing this for each project...

That'll be nice.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]




More information about the Lazarus mailing list