Skip to Content.
Sympa Menu

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

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddyz77 AT tin.it>
  • To: FreeTDS <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Sorry, I copy the wrong code, but problem persists
  • Date: 09 Jan 2003 18:15:30 +0100

Il gio, 2003-01-09 alle 15:13, Ou Liu ha scritto:
> 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
>

Thanks.
Should fixed in CVS. I added a test (from your code) and all work (both
SQL_C_TIMESTAMP and SQL_C_CHAR).

freddy77






Archive powered by MHonArc 2.6.24.

Top of Page