freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
[freetds] BUG?: incorrect struct tds_microsoft_dbdaterec
- From: LacaK <lacak AT zoznam.sk>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: [freetds] BUG?: incorrect struct tds_microsoft_dbdaterec
- Date: Fri, 20 Aug 2010 10:03:53 +0200
Hi,
I am not sure if this is right place to report bug or not, but I do not know if bug-tracker on sourceforge.net is active.
(if there is active bug tracke, let me know please)
There is in sybdb.h defined:
struct tds_microsoft_dbdaterec
{
DBINT year; /* 1753 - 9999 */
DBINT quarter; /* 1 - 4 */
DBINT month; /* 1 - 12 */
DBINT day; /* 1 - 31 */
DBINT dayofyear; /* 1 - 366 */
DBINT week; /* 1 - 54 (for leap years) */
DBINT weekday; /* 1 - 7 (Mon. - Sun.) */
DBINT hour; /* 0 - 23 */
DBINT minute; /* 0 - 59 */
DBINT second; /* 0 - 59 */
DBINT millisecond; /* 0 - 999 */
DBINT tzone; /* 0 - 127 (Sybase only) */ };
But Microsoft uses slightly different format, see: http://msdn.microsoft.com/en-us/library/aa937027(v=SQL.80).aspx
|typedef struct dbdaterec
{
int year; // 1753 - 9999 int quarter; // 1 - 4 int month; // 1 - 12 int dayofyear; // 1 - 366 int day; // 1 - 31 int week; // 1 - 54 (for leap years) int weekday; // 1 - 7 (Mon. - Sun.) int hour; // 0 - 23 int minute; // 0 - 59 int second; // 0 - 59 int millisecond; // 0 - 999 } DBDATEREC;|
*
"day" and "dayofyear" are exchanged !!!*
So I think, that struct tds_microsoft_dbdaterec and function dbdatecrack (which only uses dbdaterec) must be adjusted:
(to keep "binnary" compatibilty with Microsoft implementation in ntwdblib.dll)
...
if (dbproc ? dbproc->msdblib : msdblib) {
++di->quarter;
++di->datemonth;
++di->datedweek;
//add these two lines:
di->datedmonth = dr.dayofyear;
di->datedyear = dr.day;
}
...
-Laco.
-
[freetds] BUG?: incorrect struct tds_microsoft_dbdaterec,
LacaK, 08/20/2010
-
Re: [freetds] BUG?: incorrect struct tds_microsoft_dbdaterec,
Frediano Ziglio, 08/22/2010
- Re: [freetds] BUG?: incorrect struct tds_microsoft_dbdaterec, LacaK, 08/23/2010
-
Re: [freetds] BUG?: incorrect struct tds_microsoft_dbdaterec,
Frediano Ziglio, 08/22/2010
Archive powered by MHonArc 2.6.24.