Skip to Content.
Sympa Menu

freetds - numeric column size bug with TDS7

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Gerry Jensen <gerry AT ship-to-order.com>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: numeric column size bug with TDS7
  • Date: Thu, 18 Jan 2001 13:57:53 -0700


I'm using dblib from FreeTDS5.1 compiled for SQL Server 7 support in a C program. The following query returned unexpected results: "SELECT @@IDENTITY". In looking at the code, the problem is that the column size is shorter than it should be so the entire numeric returned is not being received (increasing the column size by one fixed the problem in this situation). In token.c, I see that tds_process_result() has the following code which contains 2 places which would affect the column size in this situation:

if (is_numeric_type(curcol->column_type)) {
>>> info->row_size += sizeof(TDS_NUMERIC) + 1;
} else if (!is_blob_type(curcol->column_type)) {
info->row_size += curcol->column_size + 1;
}


/* actually this 4 should be a machine dependent #define */
remainder = info->row_size % 4;
>>> if (remainder) info->row_size += (4 - remainder);

However, neither of these are present in the tds7_process_result() function. I'm guessing that one (or both of them) should be in the tds7 version as well. Anyone know which one should be there (or both or neither)? I looked in the snapshot as of a week or so ago, and I didn't see any change in this file.

Thanks,

Gerry





Archive powered by MHonArc 2.6.24.

Top of Page