[freetds] FreeTDS problems with converting SQL BigInt

Feroze Daud khichdo at yahoo.com
Mon Sep 16 13:30:54 EDT 2013



I am using odbc.

I know 0.64 is not supported, but I dont have the liberty to upgrade. I could make a case for upgrading if this bug is fixed in 0.82.

Is this a known bug that was fixed in 0.82?

Thanks

feroze.


----- Original Message -----
From: Frediano Ziglio <freddy77 at gmail.com>
To: Feroze Daud <khichdo at yahoo.com>; FreeTDS Development Group <freetds at lists.ibiblio.org>
Cc: 
Sent: Monday, September 16, 2013 12:47 AM
Subject: Re: [freetds] FreeTDS problems with converting SQL BigInt

2013/9/15 Feroze Daud <khichdo at yahoo.com>:
> I have a program on Unix that is querying a MSSQL Database. The DB exposes functionality as a Stored procedure, with a BigINT output parameter.
> On the client side, we have a C++ program that is calling that sproc and trying to get the bigint from the output parameter.
> What we are seeing is that the data is getting corrupted. In other words, garbage value for the BigInt is being returned from the driver.
> More Information:
> Client:
> Ubuntu 11.10 with freetds 0.64 TDS Version: 0.8 Custom C++ program linked with freetds 0.64
> Server:
> MSSQL 2008 Stored Procedure that returns a BigInt as an output parameter.
> NOTE:
> We tried changing the sproc to return the BigInt as the first resultset. If we try to read it as a BigInt, we get the garbage value. However, if we try to read it as a string, it comes across correctly.
> I enabled freetds logging for the driver, and I see that the driver is thinking that the value is a NUMERIC, not a BigInt....
> token.c:526:processing result tokens. marker is ac(PARAM)
>>token.c:1526:processing result. type = 108(numeric), varint_size 1
>>token.c:1547:processing result. column_size 17
>>token.c:1863:tds_get_data: column 0, type 108, varint size 1
> However, the SQL server SP definition correctly defines the output parameter as a BigInt...
> ALTERPROCEDURE[dbo].[SomeSproc](@pParam1        bigint, at pReturnCnt     int =5000,-- how many records to return at pOutParam1    bigint =NULLOUTPUT )AS
> Any idea why this is happening?
> Thanks,
> feroze.

Which library (ctlib, dblib, odbc) are you using ?

FreeTDS 0.64 ?? Sorry, not supported anymore.

Frediano



More information about the FreeTDS mailing list