Re: ODBC driver and Dates

Поиск
Список
Период
Сортировка
От Aleksey Demakov
Тема Re: ODBC driver and Dates
Дата
Msg-id 86u37s50a2.fsf@avd.garsib.ru
обсуждение исходный текст
Ответ на Re: [INTERFACES] Re: ODBC driver and Dates  (Stephen Davies <scldad@sdc.com.au>)
Список pgsql-interfaces
Stephen Davies <scldad@sdc.com.au> writes:

>
> Surely the way to go is to retrieve the date style from Windows. That is, use
> the setting in Control Panel Regional Settings.
>
> This can also be used to pick up decimal point and currency settings.

Hm... I have to disagree. I see things another way.

All data including dates are transferred in three steps:

1) ODBC driver gets it from Postgres;
2) ODBC driver converts data and passes it to an application;
3) application presents data to user;

It's a duty of applications to represent data accordingly to
Windows settings (using library functions, of course).
The data format on the second step (between ODBC and app)
is defined by the ODBC spec.

The only thing which should be fixed in the driver is defining
the data format on the first step. This step is completely invisible
for end-users and the exact format doesn't matter. It just should be
defined.

> > Byron Nikolaidis <byronn@insightdist.com> writes:
> >
> > > 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")?
> >
> > I beleave there is no need for such an option. The only thing is
> > needed that ODBC-driver and Postgres use the same format during
> > connection. Thus opening connection ODBC-driver should always set
> > the datestyle which it uses. Asking the datestyle from backend and
> > than using appropriate conversion is posible but why to bother with
> > this while the opposite (instructing backend what datestyle to use)
> > is much simpler to implement and will work equaly well?

--
Aleksey Demakov
avd@avd.garsib.ru

В списке pgsql-interfaces по дате отправления:

Предыдущее
От: Stephen Davies
Дата:
Сообщение: Re: ODBC driver
Следующее
От: Hannu Krosing
Дата:
Сообщение: Re: ODBC driver and Dates