Off-by-one bug using Freetds-CVS + MSSQL 7.0 + Perl DBD::Sybase
llange at ftd.fr
Mon Oct 16 08:35:21 EDT 2000
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).
RCS file: /Repository/freetds/src/ctlib/ct.c,v
retrieving revision 1.49
diff -r1.49 ct.c
> //LLA len--;
< 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);
More information about the FreeTDS