Re: ODBC driver and Dates - Mailing list pgsql-interfaces

From Byron Nikolaidis
Subject Re: ODBC driver and Dates
Date
Msg-id 353657E1.5955C81C@insightdist.com
Whole thread Raw
Responses ODBC Driver and password auth.
List 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@postgreSQL.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




pgsql-interfaces by date:

Previous
From: David Hartwig
Date:
Subject: Re: [INTERFACES] Re: Insight ODBC driver
Next
From: WAGNERP@UWSTOUT.EDU
Date:
Subject: documentation on using PostODBC?