[freetds] ctlib bulk text copy segmentation fault

Thompson, Bill D (London) bill_d_thompson at ml.com
Mon Mar 7 13:04:48 EST 2005


Hi Patrick,

Thanks for your well researched and documented bug report.

I think it IS a bug. BCP of text data should indeed be possible,
although it is a (sometimes problematic) special case.

I'll look into the causes and advise (probably tomorrow)

Bill

-----Original Message-----
From: freetds-bounces at lists.ibiblio.org
[mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of Patrick Dunnigan
Sent: 07 March 2005 17:17
To: freetds at lists.ibiblio.org
Subject: [freetds] ctlib bulk text copy segmentation fault


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
_______________________________________________
FreeTDS mailing list
FreeTDS at lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds 
--------------------------------------------------------
 
If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Click here for important additional terms relating to this e-mail.     http://www.ml.com/email_terms/ 
--------------------------------------------------------
 



More information about the FreeTDS mailing list