Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.12.3

Bug #4452 Return of query function
Submitted: 2005-05-27 13:50 UTC
From: markus dot espenlaub at espas dot ch Assigned: danielc
Status: No Feedback Package: DB
PHP Version: 5.0.3 OS: Windows 2000
Roadmaps: (Not assigned)    
Subscription  


 [2005-05-27 13:50 UTC] markus dot espenlaub at espas dot ch
Description: ------------ I use DB 1.7.6 and MSDE (Microsoft SQL Server) 2000 SP3. When I *successfully* create a table using query() then the function returns always a DB_Error object with error code 0. I don't know if other DBMS behave different or give another result code on success. According to the documentation the correct result should be DB_OK. I also think that the maintainer team don't expect the developers to read error codes manually to determine success or failure. Reproduce code: --------------- <?php require_once 'DB.php'; $db =& DB::connect('pgsql://usr:pw@localhost/dbnam'); if (PEAR::isError($db)) { die($db->getMessage()); } $res =& $db->query('create table example ( ID_Example int identity constraint st_pk primary key, ID_Location int, Date datetime constraint st_c1 not null);'); // Always check that result is not an error if (PEAR::isError($res)) { // Dies always in release 1.7.6 when using MSDE 2000 die($res->getMessage()); } ?> Expected result: ---------------- $db->query() returns DB_OK on success Actual result: -------------- $db->query() returns a DB_Error object $res::getCode() returns 0

Comments

 [2005-05-27 15:03 UTC] markus dot espenlaub at espas dot ch
Seems to be a bug in Microsoft SQL Server 2000 (returns bogus error code on successful data definition commands).
 [2005-05-27 15:15 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2005-11-17 22:40 UTC] markus dot espenlaub at espas dot ch
Workaround: My code now considers error 0 (unknown error) as no error. I did find no better solution and had no other msde installations for testing.
 [2007-06-29 12:58 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!