[Lazarus] Database access and thread-safety
Mark Morgan Lloyd
markMLl.lazarus at telemetry.co.uk
Mon Nov 8 10:19:31 CET 2010
Michael Van Canneyt wrote:
> On Mon, 8 Nov 2010, Mark Morgan Lloyd wrote:
>
>> Can anybody say whether a TSQLQuery can be activated in a thread,
>> provided that the portions of the app which activate it and the
>> portions which read data from it are protected by critical sections?
>>
>> I'm trying to increase the responsiveness of a program that I'm using
>> as a testbed before moving onto anything critical. Backend is
>> PostgreSQL accessed via a TPQConnection.
>
> If the postgres client library is thread safe, then SQLDB (and in
> particular
> TSQLQuery) should also be thread safe.
Thanks Graeme and Michael, that's encouraging. I'm not planning to use
any graphical DB-aware controls, or if I do I'll have an in-memory
database as a buffer.
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.
--
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