Skip to Content.
Sympa Menu

freetds - [freetds] Sorry, I copy the wrong code, but problem persists

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Ou Liu" <ou AT qbt.com>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: [freetds] Sorry, I copy the wrong code, but problem persists
  • Date: Thu, 9 Jan 2003 09:13:05 -0500

Hi, Freddy
Sorry I copy the wrong code into my post. I will never make such
mistake
next time.
In fact I use two verisons of code:
1.
SQLDescribeCol(m_hstmt, col + 1, (SQLCHAR *) name, \
sizeof(name), NULL, &colType, &colSize, \
&colScale, &colNullable);
switch(colType)
{
...
case SQL_TYPE_TIMESTAMP:
colType = SQL_C_TIMESTAMP;
{
TIMESTAMP_STRUCT tstamp;
memset((void*) &tstamp, 0, sizeof(TIMESTAMP_STRUCT));
SQLGetData(m_hstmt, col + 1, colType, &tstamp, colSize + 1,
&cbSize);
....

2.
SQLDescribeCol(m_hstmt, col + 1, (SQLCHAR *) name, \
sizeof(name), NULL, &colType, &colSize, \
&colScale, &colNullable);
switch(colType)
{
...
case SQL_TYPE_TIMESTAMP:
colType = SQL_C_CHAR;
{
char* temp = (char*) malloc(100);
memset((void*) temp, 0, 100);
SQLGetData(m_hstmt, col + 1, colType, temp, 100, &cbSize);
...

In the code1 I try to get the data into a structure, and in code 2 I
try to
get the data in a string fromat.
Both failed, in case 1 I got rubbish, and case 2 I only got part of what I
need, namely "2002-02-23".
The data in fact should be "2002-02-23 10:02:03" and that is what
tsql can
fetch.

Any ideas?
Thank you
Ou





Archive powered by MHonArc 2.6.24.

Top of Page