[prev in list] [next in list] [prev in thread] [next in thread]
List: freetds
Subject: Re: [freetds] dbdatecrack producing erroneous results
From: crunsus <crunsus () gmail ! com>
Date: 2012-04-24 20:44:35
Message-ID: 4F9710B3.8050002 () gmail ! com
[Download RAW message or body]
I solved the problem finally, after investigating deeper into the guts
of dbdatecrack inside dblib.c line 5529
if (dbproc->msdblib) {
++di->month;
++di->weekday;
}
and stepping through this code I realized that dbproc->msdblib is never
set to 1 so no adjustment is performed hence the difference in the
results. I did more digging and found that MSDBLIB had to be defined for
that to happen.
I rebuilt the FreeTDS with MSDBLIB defined which broke some other stuff
because DBDATEREC has now different members but I managed to correct
those errors and voila, now it works perfectly and I no longer need my
lousy replacement function.
It is just that no one told me that I needed to define MSDBLIB, it is
not very evident but it kind of makes sense since I run against SQL
Server and not against Sybase, it never occured to me that they would
be that much different.
Anyways big thanks to Frediano for pointing me into the right
direction, he is right, his code works,it is just that dbproc->msdblib
was never set in my case and I didn't realize that MS had implemented
the encoding of the datetime differently than Sybase and it needed to be
re-adjusted after tds_datecrack was applied for cracking. I always
assumed FreeTDS would work out of the box for SQL Server but apparently
it comes preconfigured for Sybase DBLIB,
I had to change #define SYBDBLIB 1 into #define MSDBLIB 1 and things
started to work out for me.
So many thanks for the help given to a newbie and again congrats for
your product, it absolutely kicks ass.
Best Regards,
Crunsus
Message: 1
Date: Mon, 23 Apr 2012 17:45:36 +0100
From: Frediano Ziglio<freddy77@gmail.com>
Subject: Re: [freetds] dbdatecrack producing erroneous results
To: FreeTDS Development Group<freetds@lists.ibiblio.org>
Message-ID:
<CAHt6W4e4Hg4Nc2f0EbyCMK-jBo3Ei+=45eKfsFSifoXtk_6-hQ@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
I compared your function with tds_datecrack looping with a program
from 1753/1/1 to 4000/1/1 (not taking into account time) and I got
same results.
There should be something in the detection of msdblib flag that is wrong.
Frediano
_______________________________________________
FreeTDS mailing list
FreeTDS@lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic