Skip to Content.
Sympa Menu

freetds - [freetds] ctlib bulk text copy segmentation fault

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Patrick Dunnigan" <patrick.dunnigan AT centivia.com>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: [freetds] ctlib bulk text copy segmentation fault
  • Date: Mon, 7 Mar 2005 12:16:30 -0500

Hi All,
I am attempting to do a bulk copy IN in a SQL Server 2000 table that has two
columns, an INT and a TEXT using freeTDS 0.63RC9 on RH 7.3 using TDS 8.

The binds seem to be returning properly. When I call the blk_rowxfer function
it produces a "segmentation fault". I have traced it down to the cs_convert
call performed inside _blk_get_col_data (as below) in blk.c for the second
column in the database table - the TEXT field. Further the segmentation fault
occurs because of the 6th parameter: bindcol->bcp_column_data->data.

result = cs_convert(ctx, &srcfmt, (CS_VOID *) src, &destfmt, (CS_VOID *)
bindcol->bcp_column_data->data, &destlen);

Now when I do nothing but change the fieldtype in SQL Server to say VARCHAR,
the bulk copy works without modifying my bind parameters (which are set to
the Text variety. If I change the database field type back to TEXT, it fails.

I know it's the bindcol->bcp_column_data->data parameter (pointer to the
destination data buffer) because I created a stub function with printf and
return statement only inside and removed each parameter until it successfully
called the function and returned.

With this parameter in the cs_convert call, it does a segmentation fault just
by simply calling the function. The blk_bind for this column appears to be
functioning properly and is returning with a CS_SUCCEED.

Therefore my questions for the community are as such:
- Are bulk text inserts even possible with freeTDS and MSSQL?
- I've been through the examples and on the web, examples of TEXT bulk copies
are sparse. Any guidence?
- What other info can I provide? I can provide the code if needed, I
basically took the bulk copy in example from src/ctlib/unittests and modified
it for the text operation.

Thanks
Patrick




Archive powered by MHonArc 2.6.24.

Top of Page