Bug #4452 [Opn->Csd]: Return of query function

From: Date: Fri, 27 May 2005 15:03:25 +0000
Subject: Bug #4452 [Opn->Csd]: Return of query function
References: 1  Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-6114@lists.php.net to get a copy of this message
Edit report at http://pear.php.net/bugs/bug.php?id=4452&edit=1 ID: 4452 User updated by: markus dot espenlaub at espas dot ch Reported By: markus dot espenlaub at espas dot ch -Status: Open +Status: Closed Type: Bug Package: Documentation Operating System: Windows 2000 PHP Version: 5.0.3 New Comment: Seems to be a bug in Microsoft SQL Server 2000 (returns bogus error code on successful data definition commands). Previous Comments: ------------------------------------------------------------------------ [2005-05-27 09:50:01] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://pear.php.net/bugs/bug.php?id=4452&edit=1

« previous php.pear.doc (#6114) next »