Bug #4452 [NEW]: Return of query function

From: Date: Fri, 27 May 2005 13:50:01 +0000
Subject: Bug #4452 [NEW]: Return of query function
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-6112@lists.php.net to get a copy of this message
From: markus dot espenlaub at espas dot ch Operating system: Windows 2000 PHP version: 5.0.3 Package: Documentation Bug Type: Bug Bug description: Return of query function 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 bug report at http://pear.php.net/bugs/bug.php?id=4452&edit=1 --

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