Skip to Content.
Sympa Menu

freetds - Re: [freetds] Problem with datetime from a MS SQL Server

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT schemamania.org>
  • To: freetds AT lists.ibiblio.org
  • Subject: Re: [freetds] Problem with datetime from a MS SQL Server
  • Date: Sun, 9 Feb 2003 19:23:43 -0500

On Sun, 09 Feb 2003 14:54:34 -0800, "Frank M. Kromann"
<frank AT kromann.info> wrote:
>
> When fetching a datetime column I get two different results:
>
> using dbconvert() I get 'Mar 17 2001 12:00AM'
>
> using dbdatecrack() I get '2001-02-17 00:00:00'
>
> Notice the difference in the Month. According to MS documentation the
> month should be 1-12 and this works on Windows using the ntwdblib.lib.

Hi Frank,

Sybase says 0-11:

typedef struct dbdaterec
{
long dateyear; /* 1900 to the future */
long datemonth; /* 0 - 11 */
long datedmonth; /* 1 - 31 */
long datedyear; /* 1 - 366 */
long datedweek; /* 0 - 6 */
long datehour; /* 0 - 23 */
long dateminute; /* 0 - 59 */
long datesecond; /* 0 - 59 */
long datemsecond; /* 0 - 997 */
long datetzone; /* 0 - 127 */

Our db-lib should change, according to whether or not --enable-msdblib was
configured. If it is, we should produce 1-12, if not, 0-11. That would
be the only appropriate answer for FreeTDS, if --enable-msdblib is going
to do what it's supposed to do.

What you should do is less clear to me. If your extension relies on our
configuration, that would preclude use of some combinations of servers.
If OTOH you write to Sybase's spec, I'll do what I can to make sure you
don't get less functionality than you would if you --enable-msdblib.

Thanks for the pr.

--jkl





Archive powered by MHonArc 2.6.24.

Top of Page