freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "Ou Liu" <ou AT qbt.com>
- To: <freetds AT lists.ibiblio.org>
- Subject: [freetds] maybe a small bug in the odbc driver
- Date: Thu, 9 Jan 2003 15:08:37 -0500
Hi, Freddy
Your code solved the DATE problem decently, thank you very much.
Now another small problem:
If I create a table including a column of REAL type
CREATE TABLE test(rl REAL);
INSERT INTO test VALUES(33.14);
Then later when I use the code below to fetch it:
SQLDescribeCol(m_hstmt, col + 1, (SQLCHAR *) name, \
sizeof(name), NULL, &colType, &colSize, \
&colScale, &colNullable);
switch(colType)
{
...
case SQL_FLOAT:
case SQL_DOUBLE:
colType = GetDefaultFieldType(colType);
m_CurRecord[col].vt.vt = VT_R8;
iRet = SQLGetData(m_hstmt, col + 1, colType,
&m_CurRecord[col].vt.dblVal,
colSize + 1,\
&cbSize);
break;
case SQL_REAL:
colType = GetDefaultFieldType(colType);
m_CurRecord[col].vt.vt = VT_R4;
iRet = SQLGetData(m_hstmt, col + 1, colType,
&m_CurRecord[col].vt.fltVal,
colSize + 1,\
&cbSize);
break;
...
Don't worry, although I used VARIANT type here in my code, it can be
compiled normally on solaris,(we used a tool called MainWin which help us to
compile Win32 program on the UNIX platform, so you see all these programs
can run normally under Win32 and UNIX platform without changing a line of
code, however on the win32 we can link to the odbc driver provided by MS,
but on UNIX we have no one but you to turn to)
So here is the problem, if this program is running under Win32 and
using
odbc driver provided by the Mircosoft, it always return as SQL_REAL, but
using FreeTDS I always got SQL_FLOAT/SQL_DOUBLE. so I thought maybe you want
to change it in your code.
By the way, no matter which driver I use, win32 or solaris, the value
will
be 33.139999 instead of 33.14, but tsql do can get 33.14. I thought it is
because it fetch the data using string format.
thank you
Ou
By the way the function GetDefaultFieldType is borrowed freely from the MFC
source code,(just a little modification) ^_^
-
[freetds] maybe a small bug in the odbc driver,
Ou Liu, 01/09/2003
- <Possible follow-up(s)>
- RE: [freetds] maybe a small bug in the odbc driver, ZIGLIO Frediano, 01/10/2003
Archive powered by MHonArc 2.6.24.