Skip to Content.
Sympa Menu

freetds - Off-by-one bug using Freetds-CVS + MSSQL 7.0 + Perl DBD::Sybase

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Ludovic LANGE <llange AT ftd.fr>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Off-by-one bug using Freetds-CVS + MSSQL 7.0 + Perl DBD::Sybase
  • Date: Mon, 16 Oct 2000 14:35:21 +0200


Hello,

I'd like to report the following :

I'm using Perl DBI Interface + Sybase interface (DBD::Sybase 0.23) to
interact with a MSSQL 7.0 database.
I'm using the CVS version of FreeTDS

I compiled using '--with-tdsver=7.0'.

I'm using an auto-incremented index column in the database (identity in
MSSQL terms), and I use it that way :
1) insert a record in the DB using 'INSERT (...) values (....)'
2) querying the generated value of the index using 'SELECT @@IDENTITY'

When I get then the result of the query, the value returned lacks the
rightmost digit. (Ie, instead of getting, after 'SELECT @@IDENTITY', the
value '41759' for index, I have instead the value '4157' )

Did anybody experience the same problem ? Do you have a solution ?

As a temporary workaround, I applied the following patch to
'src/ctlib/ct.cc', and it seems to solve the problem (But it is surely
breaking something, as I'm comenting out a piece of code that surely
have some purpose. Nevertheless, I found nothing wrong with the basic
queries I'm using.)

As I have no knowledge of neither MSSQL neither TDS, can you please
analyse this and tell me what's wrong ? I may also be totally wrong, and
the problem may be in DBD::Sybase.

Please keep my informed (I do read the mailing list).


Regards,

Ludovic LANGE



Index: src/ctlib/ct.c
===================================================================
RCS file: /Repository/freetds/src/ctlib/ct.c,v
retrieving revision 1.49
diff -r1.49 ct.c
436c436
< len--;
---
> //LLA len--;
441c441
< tdsdump_log("%L inside _ct_bind_data() length
binding len = %d", len);
---
> tdsdump_log("%L inside _ct_bind_data() length binding
> len = %d\n", len);



  • Off-by-one bug using Freetds-CVS + MSSQL 7.0 + Perl DBD::Sybase, Ludovic LANGE, 10/16/2000

Archive powered by MHonArc 2.6.24.

Top of Page