[Lazarus] Database access and thread-safety

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Thu Nov 18 12:28:54 CET 2010


Mark Morgan Lloyd wrote:
> Martin Schreiber wrote:
>> On Monday, 8. November 2010 10.19:31 Mark Morgan Lloyd wrote:
>>
>>> My normal preference would have been to use ODBC or similar to improve
>>> portability. However in the current case I want to use the
>>> PostgreSQL-specific LISTEN/NOTIFY facility to save having to poll the
>>> database for changes, I haven't yet worked out whether I can get at that
>>> easily but I'm pretty sure that using a generic connection layer would
>>> complicate things.
>>
>> MSEgui has tdbevent component (tab DBf) which works with PostgreSQL.
> 
> [Googles] Thanks Martin, that's useful to know. It's also useful to know 
> that Postgres isn't the only database that offers NOTIFY-style 
> functionality. For the moment I'm trying to stick with "standard" 
> components, but I'm not ruling anything out.

For anybody else using or considering PostgreSQL, LISTEN/NOTIFY works 
well provided that the calls are against TPQConnection.Handle. The 
ExecuteDirect() method uses a different handle which does not have the 
extended lifetime required.

-- 
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