Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: DBD::Sybase bug that could affect you
Date: Oct 5 2000 4:16PM

I've discovered a bug in all versions of DBD::Sybase that support
?-style placeholders. This bug shows up with the 12.0 ESD#1 for
Solaris that I have available here. It is NOT present in
ESD#6 for linux. I do not know on what other platforms this bug may
exist. You are NOT affected if you do not use placeholders.


Prepare a statement with ?-style placeholders.
Execute it a with an invalid parameter that causes Sybase to return
with an error message (I discovered this getting an "arithmetic
overflow" error).
Now try to re-execute the statement, with valid parameters.
Result: Sybase responds:
ERROR: 2812 'Server message number=2812 severity=16 state=5 line=65535 procedure=DBD1 text=Stored procedure '*00001400000000_1c3c17' not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output).

As if the statement had been dropped. DBI->trace() shows that the
statement is not destroyed or freed after the initial error, so I
suspect Sybase of doing a "bad thing" here.

You can run the following little script to see if you are affected:


use DBI;

$Srv = "SYBASE";
$Uid = "sa";
$Pwd = "";

my $dbh = DBI->connect("dbi:Sybase:server=$Srv", $Uid, $Pwd, {PrintError => 1});

my $rc;

$rc = $dbh->do("create table #t(string varchar(20), date datetime, val float, other_val numeric(9,3))");

my $sth = $dbh->prepare("insert #t values(?, ?, ?, ?)");

$rc = $sth->execute("test", "Jan 1 1998", 123.4, 222.3334);
print "rc = $rc\n";
$rc = $sth->execute("test", "Feb 30 1998", 123.4, 222.3334);
print "rc = $rc\n";

$rc = $sth->execute("test", "Feb 28 1998", 123.4, 222.3355);
print "rc = $rc\n";
$rc = $sth->execute("test", "Feb 28 1998", 123.4, 999.99999);
print "rc = $rc\n";




Michael Peppler         -||-  Data Migrations Inc.    -||-
Int. Sybase User Group  -||-
Sybase on Linux mailing list: