Skip to Content.
Sympa Menu

freetds - Re: [freetds] SQLGetData returns SQL_ERROR by mistake

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] SQLGetData returns SQL_ERROR by mistake
  • Date: Mon, 28 Jan 2008 22:41:28 -0500

James K. Lowden wrote:
>
> SQLGetData fetches the data even though it returns SQL_ERROR. If there
> is an error, SQLGetDiagRec doesn't know about it.

Eh, some corrections.

1. columns are fetched in reverse order: 3,2,1
2. SQLGetData for column 3 fails.
3. Column 3 is varchar(30) on the server, char[31] on client.
4. No diagnostics are produced even though SQLGetData failed.

New Log:

odbc.c:3253:odbc_process_tokens: tds_process_tokens returned 1
odbc.c:3254: result_type=4040, TDS_DONE_COUNT=0, TDS_DONE_ERROR=0
odbc.c:3323:odbc_process_tokens: returning result_type 4040
odbc.c:4521:SQLGetData(0x806e100, 3, 12, 0x806a220, 31, 0xbfbff2a8)
convert_tds2sql.c:62:convert_tds2sql: src is 39 dest = 12
error.c:630:SQLGetDiagField(3, 0x806e100, 0, 2, 0xbfbff258, 4, 0xbfbfee2e)
odbc.c:4521:SQLGetData(0x806e100, 2, 7, 0x806a240, 25, 0xbfbff288)
convert_tds2sql.c:62:convert_tds2sql: src is 59 dest = 7
odbc.c:4521:SQLGetData(0x806e100, 1, 4, 0x806b2f0, 11, 0xbfbff268)
convert_tds2sql.c:62:convert_tds2sql: src is 56 dest = 4
odbc.c:3613:SQLFetch(0x806e100)

The relevant log line is:

odbc.c:4521:SQLGetData(0x806e100, 3, 12, 0x806a220, 31, 0xbfbff2a8)

which looks OK to me?

I don't know why SQLGetData fails. The target buffer is big enough.
Perhaps the target type is wrong.

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page