Re: ODBC driver and Dates

From: Byron Nikolaidis <byronn(at)insightdist(dot)com>
To: Hannu Krosing <hannu(at)trust(dot)ee>, "pgsql-interfaces(at)postgreSQL(dot)org" <pgsql-interfaces(at)postgreSQL(dot)org>
Subject: Re: ODBC driver and Dates
Date: 1998-04-16 19:11:29
Message-ID: 353657E1.5955C81C@insightdist.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Hello,

Yes it is true that there should be something done about supporting other date
styles. In making the driver be able to handle all the odbc conversions of
date, time, and timestamp, assumptions were made about what format they were in.

It would be relatively easy to modify this to allow for other styles.

Should the driver query the database (i.e., "show datestyle") to see what format
it should use, -OR-, should it be an option for the datasource, where you select
what style to use, and the driver sets the style when it makes a connection
("set datestyle")?

HERE IS A POSSIBLY USEFUL BUT UNDOCUMENTED FEATURE OF THE NEW ODBC DRIVER:

By the way, there is a feature in this driver that allows you to send simple
commands to the driver at connection time. Its registry key is 'ConnSettings'
and it can be on a driver level or datasource level, or both.

Here is an example, if you had a datasource called 'co1', then in the registry
under the HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\co1 you would create a String
Value called 'ConnSettings' which can contain a list of commands, separated by
semicolans, to send to Postgres on a successful connection. Example, "set geqo
to 'off'; set datestyle to 'ISO' "

You can also set this on a driver level so that for any datasource these
commands would be set. That key is
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\PostgreSQL
and it is also called 'ConnSettings'.

It will first send the driver 'ConnSettings' (if any) followed by the datasource
'ConnSettings' (if any).

This feature has its limitations. For example, it can only handle commands;
not queries that would generate tuples.

Byron

P.S., Please send these notes to the pgsql-interfaces(at)postgreSQL(dot)org list so
that everyone can read them, including me.

Hannu Krosing wrote:

> Stephen Davies wrote:
> >
> > > The driver at
> > > > http://www.insightdist.com/download/
> > > > works great. Very well done and much quicker than previous drivers.
> > > >
> > > > I have had a couple of problems though. The problems seem to be with
> >
> > G'day all.
> >
> > I too have had good success with this driver except for one MAJOR problem:
> >
> > it does not seem to handle date fields at all well.
>
> To get a uniform date access across different databases one should
> first issue a query like "set DateStyle to 'ISO'" or some other that the
> driver is developed for
>
> I routinely do it always when accessin PostgreSQL. I think it would be
> nice of the driver to always start the session by settin the DateStyle
> to some known value
>
> Does it not do that already?
>
>
> Hannu

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message David Hartwig 1998-04-16 19:47:51 Re: [INTERFACES] ODBC 6.3.2
Previous Message David Hartwig 1998-04-16 18:49:32 Re: [INTERFACES] Re: Insight ODBC driver