freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Re: [freetds] OK to call SQLGetData more than once?
- From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
- To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] OK to call SQLGetData more than once?
- Date: Wed, 6 Feb 2008 09:04:19 +0100
>
> odbc.c:3337:odbc_process_tokens: returning result_type 4040
> odbc.c:4565:SQLGetData(0x806b000, 1, -16, 0x8066340, 11, 0xbfbff148)
> convert_tds2sql.c:62:convert_tds2sql: src is 56 dest = -16
> odbc.c:4097:SQLNumResultCols(0x806b000, 0xbfbff302)
> odbc.c:4097:SQLNumResultCols(0x806b000, 0xbfbff312)
> odbc.c:4565:SQLGetData(0x806b000, 1, -16, 0x8066340, 11, 0xbfbff168)
> error.c:630:SQLGetDiagField(3, 0x806b000, 0, 2, 0xbfbff128,
> 4, 0xbfbfecfe)
> odbc.c:4565:SQLGetData(0x806b000, 1, -16, 0x8066340, 11, 0xbfbff148)
> error.c:630:SQLGetDiagField(3, 0x806b000, 0, 2, 0xbfbff108,
> 4, 0xbfbfecde)
> odbc.c:4565:SQLGetData(0x806b000, 1, -16, 0x8066340, 11, 0xbfbff128)
> error.c:630:SQLGetDiagField(3, 0x806b000, 0, 2, 0xbfbff0e8,
> 4, 0xbfbfecbe)
> odbc.c:4565:SQLGetData(0x806b000, 1, -16, 0x8066340, 11, 0xbfbff108)
> error.c:630:SQLGetDiagField(3, 0x806b000, 0, 2, 0xbfbff0c8,
> 4, 0xbfbfec9e)
>
> Successive calls to SQLGetData for the same column return
> SQL_NO_DATA.
> They should succeed. :-(
>
> http://msdn2.microsoft.com/en-us/library/ms715441(VS.85).aspx
>
> "... within a row of data, the value of the
> ColumnNumber argument in each
> call to SQLGetData must be greater than or equal to the value of
> ColumnNumber in the previous call".
>
> Humbly submitted.
>
SQL_NO_DATA is not an error so this is correct according to
documentation. The documentation state that you cannot retrieve data of
previous columns. This is not correct for all drivers but for instance
is correct for MS SQL Server driver. Successive calls to SQLGetData
returns other parts of the data. For fixed type you have to read all
data, for variable you can read splitting chunks. For instance you read
10 characters with a call and other 10 characters with the second.
Passing size of zero is useful to read no data but get lengths. There
should be a test that tests this SQL_NO_DATA behavior (previously you
could read data twice but this was an error)
freddy77
-
[freetds] OK to call SQLGetData more than once?,
James K. Lowden, 02/06/2008
-
Re: [freetds] OK to call SQLGetData more than once?,
ZIGLIO, Frediano, VF-IT, 02/06/2008
- Re: [freetds] OK to call SQLGetData more than once?, James K. Lowden, 02/06/2008
-
Re: [freetds] OK to call SQLGetData more than once?,
ZIGLIO, Frediano, VF-IT, 02/06/2008
Archive powered by MHonArc 2.6.24.