[Lazarus] Setting SQL locale
Mark Morgan Lloyd
markMLl.lazarus at telemetry.co.uk
Tue Jun 14 11:21:39 CEST 2011
Mark Morgan Lloyd wrote:
> Michael Van Canneyt wrote:
>> On Mon, 13 Jun 2011, Mark Morgan Lloyd wrote:
>>
>>> When using the standard DB components connecting to e.g. a PostgreSQL
>>> backend, is there an event that fires between the connection being
>>> established and the query being issued?
>>
>> Normally, I'd suggest TSQLConnection.AfterConnect ?
>
> Thanks Michael, I'll investigate.
>
>>> I'm trying to send a SET TIMEZONE command to the server, to get DST
>>> correction applied to the resultset. This has to be done using the
>>> same handle as will be used for the query, otherwise the server
>>> thinks it's a different session and it has no effect.
>>
>> Hm. I think for the Postgres engine, there is a connection per
>> transaction.
>> I don't think there is an event connected to the transaction. Joost
>> will have to answer this one.
>
> I think you're right, I've "played" a lot with this in the context of
> using Postgres's listen/notify facility and for some things you have to
> use the (long-lived) connection object's handle and for others the
> (short-lived) query object. In the current case I've got two query
> objects being used alternately in a thread, I'm hoping to be able to
> apply the timezone setting immediately after each is reactivated so that
> timestamp presentation is adjusted in the resultset.
Using the connection object's AfterConnect doesn't work unfortunately,
the query object needs an AfterConnect that fires after the handle has
been opened but before the query has been sent. Is Postgres the only
backend that needs separate configuration commands like this?
I could possibly do something by fiddling with the user's default
timezone immediately before and after the query object is activated, but
it would be extremely messy.
--
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