I am tracking down an issue where an error condition is not returned from a call to $sth->execute().

Here is my example code with comments. I show the output for 3 tests. Test 1 and test 2 produce results that I understand. The problem is in test 3. In test 3 I would expect the returned value (retCode) for the error condition to be undefined or 0. Instead it is -1. Is this a bug in the Sybase driver? If so, how do I report such bugs?

Do you have an explanation for it?

--- code example -----------------------------------------
# Execute query. Capture $retCode for later examination.

$retCode = $sth->execute()

# Examine $retCode, err, and errstr

print "<BR>after execute retCode is: $retCode <br>";
printf(""dbh->err= '%s'<br>" .
"dbh->errstr= '%s'<br>",
$dbh->err,
$dbh->errstr
);

--- test 1 ------------------------------------------
Here is the output from successful execution. You can see that retCode is -1, which is what I would expect in a successful $sth->execute().


after execute retCode is: -1
dbh->err= ''
dbh->errstr= ''

--- test 2 ------------------------------------------
Here I deliberately changed the stored procedure name to an incorrect one. $retCode is not defined, which is what I would expect in an $sth->execute() error condition.


after execute retCode is:
dbh->err= '2812'
dbh->errstr= 'Server message number=2812 severity=16 state=5 line=22 server=SCATS1P_SQL text=Stored procedure 's_deal_update' not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output). '


--- test 3 ------------------------------------------
Here I deliberately passed an incorrect data type as a parameter to the stored procedure. As you can see, there was an error, but the value returned from $sth->execute() was -1 (indicating success?). I would expect it to be undefined. This looks like a bug, maybe in the Sybase driver. What do you think? If it is a bug, how and where do I report it?


after execute retCode is: -1
dbh->err= '257'
dbh->errstr= 'Server message number=257 severity=16 state=1 line=0 server=SCATS1P_SQL procedure=sc_deal_update text=Implicit conversion from datatype 'VARCHAR' to 'SMALLINT' is not allowed. Use the CONVERT function to run this query.'






_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail




Reply via email to