Posted this in the Google Group, but not sure if it's going through, so I apologize for the duplicate if that's the case.
We're continuing with our struggles to get Perl working properly to connect to MS SQL server, and have come up against a nasty bug that results in segmentation faults when attempting to do a $dbh->do(...) to set TEXTSIZE or truncate tables. I'm running the following: Perl : 5.012003 (x86_64-linux) OS : linux (2.6.18-194.el5) DBI : 1.616 DBD::ODBC : 1.29 EasySoft ODBC driver: 1.3 MS SQL Server 2008. The following code generates a segfault when _ExecDirect is called at DBD/ODBC.pm at line 396. my $dbh = DBI->connect("dbi:ODBC:MSSQL", $user, $password) || die "Error connecting: $!"; $dbh->{LongReadLen} = 25000; $sql = 'SELECT @@TEXTSIZE'; $sth = $dbh->prepare($sql); $sth->execute(); print "SQL1: $sql:\n"; while ( @row = $sth->fetchrow_array ) { print join( ", ", @row ), "\n"; } $sql = 'set textsize 100'; print "SQL2: $sql:\n"; $sth = $dbh->do($sql); warn 0; And the output is: $ ./set_text_size_test.pl SQL1: SELECT @@TEXTSIZE: -1 SQL2: set textsize 100: Segmentation fault (core dumped) and the "0" is never printed. Running this in the Perl debugger shows me that it dies at DBD::ODBC at line 396, at which point it calls is an XS method defined in ODBC.c on line 133: void _ExecDirect( dbh, stmt ) SV * dbh SV * stmt CODE: { STRLEN lna; /*char *pstmt = SvOK(stmt) ? SvPV(stmt,lna) : "";*/ ST(0) = sv_2mortal(newSViv( (IV)dbd_db_execdirect( dbh, stmt ) ) ); } Anyone have any idea what might be going on here? Also, notice that the initial "SELECT @@TEXTSIZE" returns -1, which is an unusual value. Thanks for any help you might be able to provide. Eric _______________________________________________ This e-mail may contain information that is confidential, privileged or otherwise protected from disclosure. If you are not an intended recipient of this e-mail, do not duplicate or redistribute it by any means. Please delete it and any attachments and notify the sender that you have received it in error. Unless specifically indicated, this e-mail is not an offer to buy or sell or a solicitation to buy or sell any securities, investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Barclays. Any views or opinions presented are solely those of the author and do not necessarily represent those of Barclays. This e-mail is subject to terms available at the following link: www.barcap.com/emaildisclaimer. By messaging with Barclays you consent to the foregoing. Barclays Capital is the investment banking division of Barclays Bank PLC, a company registered in England (number 1026167) with its registered office at 1 Churchill Place, London, E14 5HP. This email may relate to or be sent from other members of the Barclays Group. _______________________________________________