[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pear-doc
Subject:    [PEAR-DOC] [PEAR-BUG] Bug #4452 [Opn->Csd]: Return of query function
From:       "markus dot espenlaub at espas dot ch" <pear-doc () lists ! php ! net>
Date:       2005-05-27 15:03:25
Message-ID: 20050527150325.44441.qmail () pb12 ! pair ! com
[Download RAW message or body]

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

-- 
PEAR Documentation List Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic