[Lazarus] Setting SQL locale

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Mon Jun 13 22:42:17 CEST 2011


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.

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